/rcc:writing-claude-mdfrom rcc
Creates or improves CLAUDE.md project configuration with token-efficient, actionable instructions. Use when setting up project configuration or improving existing CLAUDE.md.
Ships in rcc. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Writing CLAUDE.md IS establishing project memory that persists across sessions.
CLAUDE.md is context, not enforced configuration. Claude treats it as high-priority guidance loaded every session. For deterministic enforcement, use hooks.
Core principle: Only include what Claude can't figure out from reading the code. Specific and verifiable > vague and aspirational.
Follow task initialization protocol.
Tasks: 0. Fetch latest official memory/CLAUDE.md spec
Announce: "Created 8 tasks (0–7). Starting execution..."
Goal: Pull the current Anthropic CLAUDE.md / memory spec before designing — never trust cached memory.
Action:
Skill tool: fetching-claude-docs
component: memory
question: "CLAUDE.md location precedence (project/user/local), import syntax,
auto-loading behavior, token cost, recommended structure"
Verification: Received YAML with source: https://code.claude.com/docs/en/memory.md and non-empty spec_excerpt. Use as authoritative reference; if any rule in this SKILL conflicts with the fetched spec, the fetched spec wins.
Goal: Understand what exists and what's needed.
If CLAUDE.md exists:
If no CLAUDE.md: Document what Claude would need to know that it can't learn from reading the code.
Verification: Can list specific instructions needed and why each can't be derived from code.
Goal: Observe what Claude gets wrong without guidance.
Process:
What to look for:
Verification: Documented at least 2 specific things Claude got wrong.
Goal: Create specific, verifiable instructions addressing the gaps you documented.
Before writing, walk through prompt-design-principles.md:
MUST / NEVER line should trace to an observed or predicted failure (documented in Task 2 RED), not an aspirational wish.Filter every line through this question first: "Can Claude derive this from reading the code, package.json, or running ls?" If yes, exclude — it's noise that pushes real signal out of attention budget.
The 2026 ETH Zürich study found that LLM-auto-generated CLAUDE.md files reduced task success by ~3% and increased cost ~20% precisely because they re-stated derivable content. The same study found that named tools/commands in CLAUDE.md are used ~160× more — confirming Claude reads it carefully, so every wasted line displaces a useful one.
Three-axis frame (WHAT / WHY / HOW):
bun not npm, uv not pip, custom build scripts, project-specific test filters| Include (Claude can't guess) | Exclude (Claude already knows or can derive) |
|---|---|
Non-default tooling (bun not npm, uv not pip) | Standard language conventions |
| Build/test/deploy commands with project-specific flags | Things a linter or formatter enforces |
| Repo conventions (branch naming, PR format) | General programming practices |
| Why a surprising architecture exists (incident, constraint) | Big architecture overviews / directory listings (Claude can ls) |
| Environment quirks, gotchas, prior incidents | Detailed API docs (link instead) |
| Hidden invariants not visible in code | Restating what package.json / pyproject.toml already says |
| Anti-patterns previously caught in review | Aspirational "write clean code" / "follow best practices" |
Sections: Code Style, Workflow, Architecture, Gotchas. See references/examples.md for complete example.
Instructions MUST be SPECIFIC, VERIFIABLE, NON-OBVIOUS, and ACTIONABLE.
Use MUST/NEVER/IMPORTANT sparingly — if everything is critical, nothing is.
| If the instruction is... | Use... |
|---|---|
| A focused convention scoped to a directory or file glob | .claude/rules/<name>.md with paths: — loads only when Claude reads a matching file, so it costs nothing until relevant |
| A reusable multi-step workflow | A skill in .claude/skills/ (loaded on-demand) |
| Must NEVER be bypassed (force-push protection, secret-commit block, destructive ops) | A hook with exit 2 — text in CLAUDE.md is ~70% compliance, not 100%. Hard rules live in hooks. |
| Only relevant for certain tasks | A skill (loaded on-demand, saves tokens) |
| Specific to a subdirectory of a monorepo | A nested CLAUDE.md inside that subdirectory — Claude Code merges parent + child when working in that path |
When a section only applies to certain task types (testing, deploying, migrating), wrap it in a conditional block instead of always-on prose. Claude reads the condition and skips the body when it doesn't apply, freeing attention budget for the rest of the file.
<important if="writing or modifying tests">
- Use `createTestApp()` helper for integration tests
- Mock the database with `dbMock` (NEVER hit real DB in unit tests)
</important>
<important if="deploying to production">
- Run `bun build` locally first; CI does not auto-build
- Tag the release before pushing to main
</important>
Use this for: test setup, deploy steps, migration procedures, environment-specific gotchas. Do not wrap core identity (tech stack, build command, project layout) — those need to stay always-on.
Claude Code merges nested CLAUDE.md files: when working in apps/api/handlers/foo.ts, it loads root CLAUDE.md + apps/CLAUDE.md + apps/api/CLAUDE.md if they exist. Files above the working directory load in full at launch; files in subdirectories below it load on demand, when Claude first reads a file there. Nested files are also not re-injected after /compact — they reload the next time Claude touches that subdirectory. Use this for monorepos:
CLAUDE.md: project identity, top-level layout, shared commandspackages/<name>/CLAUDE.md: package-specific tooling, test command, gotchasapps/<name>/CLAUDE.md: app-specific build, deploy, runtime quirksReference: OpenAI's Codex repo uses 88 nested CLAUDE.md files. For a 5+ package monorepo, a single 500-line root file is worse than five 80-line nested files.
CLAUDE.md text is advisory: empirical compliance is roughly 70%. For any rule where the 30% miss is unacceptable (force-pushing main, committing secrets, deleting prod data, bypassing pre-commit), encode it as a hook with exit 2 so Claude is mechanically blocked, not asked nicely.
CLAUDE.md may describe the rule for human readers, but the enforcement must be a hook. If you find yourself writing MUST NEVER about a destructive action without a backing hook, you're shipping a 30%-broken safety net.
Verification:
ls)MUST, NEVER) sparingly but effectivelyMUST NEVER about a destructive/irreversible action has a backing hook<important if="..."> conditional blocks where appropriateCLAUDE.md files, not crammed into rootGoal: Add project-specific information that helps agent work effectively. Use the section structure from references/examples.md as a starting point.
Token efficiency:
.claude/rules/<name>.md with paths: — these load only when Claude touches a matching file, so they leave the always-resident budget entirelypaths: still loads at launch; it buys readability, not tokens@path imports load at launch too, so they don't save context either)Verification: Total < 200 lines. Every line earns its place.
Goal: Verify CLAUDE.md is effective and efficient.
Checklist:
.claude/rules/ (rules are auto-loaded into context — do NOT Read or Grep rule files; compare against auto-loaded rule content already in context)Verification: All checklist items pass.
Goal: Have CLAUDE.md reviewed by claudemd-reviewer subagent.
Agent tool:
- subagent_type: "rcc:claudemd-reviewer"
- prompt: "Review CLAUDE.md at [path]"
Interpret YAML output:
pass: true → Proceed to Task 7pass: false → Fix all issues listed, re-run reviewer, repeat until pass: trueVerification: claudemd-reviewer returns YAML with pass: true.
Goal: Verify CLAUDE.md works in practice.
Process:
Signs of a good CLAUDE.md:
Signs of a bad CLAUDE.md:
Verification: Claude follows documented conventions correctly over 5+ turns.
These thoughts mean you're rationalizing. STOP and reconsider:
<important if="writing tests"> instead)All of these mean: You're about to create a bloated, ineffective CLAUDE.md.
| Excuse | Reality |
|---|---|
| "I know what instructions are needed" | You know what YOU think. Baseline reveals actual gaps. |
| "Instructions can be vague for flexibility" | Vague instructions = Claude interprets freely = no control. |
| "Everything goes in CLAUDE.md" | CLAUDE.md = always loaded = expensive. Use skills and rules. |
| "More instructions = better coverage" | More instructions = more noise = important ones get lost. |
| "Standard practices need documenting" | Claude already knows standard practices. Document the exceptions. |
| "Linter rules belong here" | Linter rules belong in linters + hooks. Deterministic > advisory. |
${CLAUDE_SKILL_DIR}/scripts/init_claude_md.py — generates initial CLAUDE.md from project structureWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub wayne930242/reflexive-claude-code --plugin rcc23 skills in this plugin
/advising-architectureValidates component-type choices for agent system work, classifying knowledge as CLAUDE.md vs rule vs skill vs agent vs hook and checking for conflicts. Use when starting any skill/agent/rule workflow to validate approach. Use when classifying knowledge type. Use when checking for component conflicts./analyzing-agent-systemsScans project structure and agent system components, runs 11-category weakness analysis, and produces actionable restructuring recommendations. Use when analyzing an existing agent system for weaknesses. Use when user says "analyze agent system", "check agent setup", "audit agent config". Use when called by migrating-agent-systems or refactoring-skills./Other plugins' skills for the same job