claude-md-writer
Skill1 starsChanged 7 months agoMITView on GitHub
Author and refactor CLAUDE.md and manage .claude/rules/. Analyzes the codebase to produce a best-practice-aligned, efficient CLAUDE.md plus path-scoped rules. Usage: /claude-md-writer [create|refactor|rules]
2 other projects use a version of this.
Adopted by
Most recently taken up by
- OneWave-AI/claude-skillstheir own version, first seen Sep 21, 2026
- serejaris/personal-corp-ostheir own version, first seen Aug 6, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- OneWave-AI/claude-skills★ 321same name
- serejaris/personal-corp-os★ 228same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- feature-researchSkill
- feature-reviewSkill
- feature-testSkill
- feature-workSkill
- new-featureSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 76
If a CLAUDE.md already exists → match its language
- Distinctive: line 81
Use Explore agents to analyze the codebase in parallel.
- Distinctive: line 93
Use AskUserQuestion to collect information that cannot be inferred from the code.
- Distinctive: line 109
Use references/section-guide.md as a reference to author the CLAUDE.md.
- Distinctive: line 142
Read the existing CLAUDE.md
- Distinctive: line 190
After authoring or editing, always confirm:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md Writer
Analyze the codebase to author or refactor an efficient, best-practice-aligned CLAUDE.md, and manage .claude/rules/ path-scoped rule files.
Mode Selection
Determine the mode based on $ARGUMENTS:
create, or no argument + no existing CLAUDE.md → Create moderefactor, or no argument + existing CLAUDE.md → Refactor moderules→ Rules management mode
Core Principles
Apply these principles to every task without exception:
- Stay under 200 lines — Never exceed 200 lines per file. Longer files make Claude more likely to ignore the instructions.
- Only what code cannot reveal — For every line, ask "If I remove this, will Claude make a mistake?"
- Executable commands — Every command must be copy-paste runnable.
- Project-specific information only — Don't include general best practices or language defaults.
- Hierarchical separation — Root CLAUDE.md holds project-wide context, nested CLAUDE.md files hold domain context, rules hold conditional guidance.
What to include
- Build/test/deploy commands (Claude cannot guess these)
- Code style rules that differ from defaults
- Architectural decisions and their rationale (code shows WHAT, CLAUDE.md explains WHY)
- Environment variables and setup requirements
- Gotchas (counterintuitive behavior, common mistakes)
- Workflows (branch naming, PR conventions)
What never to include
- Per-file descriptions (readable from the code itself)
- Standard language conventions (Claude already knows these)
- Verbose explanations or tutorials
- API documentation (link to it instead)
- Information that changes frequently
- Self-evident directives like "write clean code"
Phase 1: Discovery
1.1 Locate existing files
find . -name "CLAUDE.md" -o -name ".claude.local.md" 2>/dev/null | head -50ls -la .claude/rules/ 2>/dev/null1.2 Detect the project type
Inspect the following to determine the project type:
| File/Directory | Project Type |
package.json | Node.js/Frontend |
build.gradle.kts, pom.xml | JVM (Kotlin/Java) |
Cargo.toml | Rust |
go.mod | Go |
pyproject.toml, requirements.txt | Python |
Dockerfile, docker-compose.yml | Container |
kustomization.yaml, Chart.yaml | Kubernetes/Helm |
terraform/, *.tf | IaC |
1.3 Pick the language
- If a CLAUDE.md already exists → match its language
- Otherwise → ask the user with AskUserQuestion
Phase 2: Analysis
Use Explore agents to analyze the codebase in parallel.
Analysis targets
- Build system — build/test/lint commands and scripts
- Architecture — directory layout, core patterns, module relationships
- Environment — required env vars, config files, dependencies
- Workflow — CI/CD, branching strategy, deployment process
- Existing docs — README, prior CLAUDE.md, comments
Phase 3: Interview
Use AskUserQuestion to collect information that cannot be inferred from the code.
Must ask:
- Team/personal workflow rules (branch naming, PR conventions, etc.)
- Gotchas not visible in the code
- The reasoning (WHY) behind architectural decisions
- Any special coding conventions
No need to ask:
- Structure that can be read from the code
- Standard configuration
Phase 4: Generate / Refactor
Create mode
Use references/section-guide.md as a reference to author the CLAUDE.md.
Structure template:
# project-name
One-line description.
## Commands
| Command | Description |
|-------|------|
| `command` | description |
## Architecture
\```
dir/ # purpose
\```
## Code Style
- Only rules that differ from defaults
## Gotchas
- gotcha 1
- gotcha 2Refactor mode
- Read the existing CLAUDE.md
- Evaluate it against references/best-practices.md
- Present the issues to the user:
- Unnecessary content (anything readable from the code)
- Missing content (anything code cannot reveal)
- Whether the file exceeds 200 lines
- Apply changes after user approval
Nested CLAUDE.md
For monorepos or large projects, split CLAUDE.md across subdirectories:
- root: overall project context, common commands
- nested: domain-specific rules, module-local information
Phase 5: Rules Management
.claude/rules/*.md files are conditional rules that load only when working on files matching specific paths.
When rules are a good fit
- Rules that apply only to a specific file type (e.g., API endpoint conventions)
- Patterns that apply only to a specific directory (e.g., test authoring rules)
- Rules whose scope is too narrow to belong in CLAUDE.md
Rules file format
---
paths:
- "src/api/**/*.ts"
- "src/routes/**/*.ts"
---
# API conventions
- Validate input on every endpoint
- Use the standard error response formatRules creation workflow
- Identify the project's primary domains/directories
- Identify patterns that recur within each domain
- Extract rules from CLAUDE.md that can be scoped to a path
- Propose to the user and create after approval
Final Verification
After authoring or editing, always confirm:
- Is each CLAUDE.md under 200 lines?
- Are all commands runnable?
- Have you avoided anything readable from the code itself?
- Does it contain only project-specific information?
- Do the
pathsin rules files match real, existing paths?
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

