agentleFS
Tianea2160Tianea2160/claude-skills/skills/claude-md-writer/SKILL.md

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

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. OneWave-AI/claude-skills★ 321same name
    2. 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.

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
  1. Distinctive:

    If a CLAUDE.md already exists → match its language

    line 76
  2. Distinctive:

    Use Explore agents to analyze the codebase in parallel.

    line 81
  3. Distinctive:

    Use AskUserQuestion to collect information that cannot be inferred from the code.

    line 93
  4. Distinctive:

    Use references/section-guide.md as a reference to author the CLAUDE.md.

    line 109
  5. Distinctive:

    Read the existing CLAUDE.md

    line 142
  6. Distinctive:

    After authoring or editing, always confirm:

    line 190

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 mode
  • refactor, or no argument + existing CLAUDE.md → Refactor mode
  • rules → Rules management mode

Core Principles

Apply these principles to every task without exception:

  1. Stay under 200 lines — Never exceed 200 lines per file. Longer files make Claude more likely to ignore the instructions.
  2. Only what code cannot reveal — For every line, ask "If I remove this, will Claude make a mistake?"
  3. Executable commands — Every command must be copy-paste runnable.
  4. Project-specific information only — Don't include general best practices or language defaults.
  5. 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 -50
ls -la .claude/rules/ 2>/dev/null

1.2 Detect the project type

Inspect the following to determine the project type:

File/DirectoryProject Type
package.jsonNode.js/Frontend
build.gradle.kts, pom.xmlJVM (Kotlin/Java)
Cargo.tomlRust
go.modGo
pyproject.toml, requirements.txtPython
Dockerfile, docker-compose.ymlContainer
kustomization.yaml, Chart.yamlKubernetes/Helm
terraform/, *.tfIaC

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

  1. Build system — build/test/lint commands and scripts
  2. Architecture — directory layout, core patterns, module relationships
  3. Environment — required env vars, config files, dependencies
  4. Workflow — CI/CD, branching strategy, deployment process
  5. 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 2

Refactor mode

  1. Read the existing CLAUDE.md
  2. Evaluate it against references/best-practices.md
  3. 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
  4. 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 format

Rules creation workflow

  1. Identify the project's primary domains/directories
  2. Identify patterns that recur within each domain
  3. Extract rules from CLAUDE.md that can be scoped to a path
  4. 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 paths in rules files match real, existing paths?

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.