Standards for CLAUDE.md & .claude/ files
Follow these rules when creating or modifying any CLAUDE.md — each repo's root CLAUDE.md
included; it lives outside .claude/, but these rules still apply to it — or any file under
.claude/ (skills, settings.json, hooks).
CLAUDE.md Rules
- Max 200 lines. If it exceeds this, move content to skills.
- Only include instructions Claude would get WRONG without. Delete anything obvious.
- Never duplicate what can be inferred from project files (tsconfig, package.json, etc.).
- No frequently changing info (versions, team members, URLs that rotate).
- No self-evident advice ("write clean code", "follow best practices").
- Structure: Overview > Setup > Code style > Testing > Git workflow > Gotchas.
- Don't inline detailed or occasional content — reference it. For subsystem detail you read only
sometimes, use a plain
[link](path) to a repo-local doc — it's read on demand, so it costs
nothing until a task needs it (cheapest). Reserve @path imports for the rare doc you genuinely
need every session.
@path imports are ALWAYS-ON — expanded into context at launch (up to 4-hop nesting), so they
cost the same as inlining, every session. They organize; they DON'T defer. NEVER @-import a big
doc — link it with a plain path instead.
Deciding Where Content Belongs
| If the instruction... |
Put it in... |
| Applies every session, prevents mistakes |
CLAUDE.md |
| Is specialized to one workflow/domain |
A skill |
| Is a personal/machine-specific override |
CLAUDE.local.md or settings.local.json |
| Must execute deterministically (not advisory) |
A hook |
| Defines a reusable subagent with scoped tools |
agents/ |
Skills Rules
For how to write the SKILL.md itself — frontmatter, descriptions, conciseness, progressive
disclosure, size — follow the writing-skills skill (the single
source of truth for skill craft). This section covers only Claude-Code-specific routing.
- Prefer skills over long CLAUDE.md sections for specialized knowledge.
- Ask per skill: could a cheaper model run it? Only if the workflow is mechanical (judgment spelled
out in the body) AND self-contained — then set frontmatter
model: haiku/sonnet (optionally
effort:), ideally with context: fork. Otherwise inherit: the override lasts the rest of the
turn (downgrading whatever task invoked the skill) and a mid-turn model switch busts the prompt
cache both ways. Judgment-heavy or high-stakes skills (prod migrations, shared-config edits,
session summaries) always inherit.
- Pick the tier by task SHAPE, not just "cheaper":
haiku = mechanical AND terminal (runs at
the turn's end — a commit, a final formatting pass). sonnet = high-VOLUME batch that still
carries light editorial judgment (a playlist-scale copy-edit Haiku would flatten). inherit =
rare (savings ≈ 0) OR judgment-heavy. A mid-turn (non-terminal) skill stays inherit even when
mechanical — the cache-bust outweighs the token saving. The real routing wins are subagents (own
context, no cache cost).
settings.json Rules
- Project-level
settings.json is shared (checked in). No secrets, no personal paths.
- Personal overrides go in
settings.local.json (must be in .gitignore).
- Permissions: prefer specific patterns (
Bash(npm test *)) over broad wildcards.
- Set model and effort at session start to preserve prompt cache.
Token Awareness
When adding ANY content to .claude files, consider token cost:
- Every line of CLAUDE.md costs ~2-4 tokens PER TURN, every turn, every session.
- Ask: "Is this worth paying for on every single message?"
- If the answer is "only sometimes" — it's a skill, not CLAUDE.md.
- Prefer terse, imperative rules over explanatory prose.
- Use bullet points, not paragraphs.
Anti-Patterns to Reject
- Adding "use TypeScript" when tsconfig.json exists
- Listing every file in the project
- Pasting entire style guides (link them instead)
- Adding instructions "just in case" — if it's not causing errors, don't add it
- Duplicating content already in another file (README, CONTRIBUTING, etc.)
Before Saving Changes
- Count lines. Is CLAUDE.md still under 200?
- Could this be a skill instead? If yes, make it one.
- Is this already inferrable from project files? If yes, skip it.
- Read it as if paying per-word. Cut filler.
1---2name: claude-md-and-folder-standards3description: Standards for editing any CLAUDE.md (each repo's root CLAUDE.md included — it lives outside .claude/ but these rules still govern it) and any file under .claude/ (skills, settings.json, hooks). Invoke before modifying any of them.4---56# Standards for CLAUDE.md & `.claude/` files78Follow these rules when creating or modifying **any `CLAUDE.md`** — each repo's **root** `CLAUDE.md`9included; it lives *outside* `.claude/`, but these rules still apply to it — **or any file under10`.claude/`** (skills, `settings.json`, hooks).1112## CLAUDE.md Rules1314- **Max 200 lines.** If it exceeds this, move content to skills.15- Only include instructions Claude would get WRONG without. Delete anything obvious.16- Never duplicate what can be inferred from project files (tsconfig, package.json, etc.).17- No frequently changing info (versions, team members, URLs that rotate).18- No self-evident advice ("write clean code", "follow best practices").19- Structure: Overview > Setup > Code style > Testing > Git workflow > Gotchas.20- **Don't inline detailed or occasional content — reference it.** For subsystem detail you read only21 *sometimes*, use a plain `[link](path)` to a repo-local doc — it's read on demand, so it costs22 nothing until a task needs it (cheapest). Reserve `@path` imports for the rare doc you genuinely23 need *every* session.24- **`@path` imports are ALWAYS-ON** — expanded into context at launch (up to 4-hop nesting), so they25 cost the same as inlining, every session. They organize; they DON'T defer. NEVER `@`-import a big26 doc — link it with a plain path instead.2728## Deciding Where Content Belongs2930| If the instruction... | Put it in... |31|---|---|32| Applies every session, prevents mistakes | CLAUDE.md |33| Is specialized to one workflow/domain | A skill |34| Is a personal/machine-specific override | CLAUDE.local.md or settings.local.json |35| Must execute deterministically (not advisory) | A hook |36| Defines a reusable subagent with scoped tools | agents/ |3738## Skills Rules3940For how to write the SKILL.md itself — frontmatter, descriptions, conciseness, progressive41disclosure, size — follow the [`writing-skills`](../writing-skills/SKILL.md) skill (the single42source of truth for skill craft). This section covers only Claude-Code-specific routing.4344- Prefer skills over long CLAUDE.md sections for specialized knowledge.45- Ask per skill: could a cheaper model run it? Only if the workflow is mechanical (judgment spelled46 out in the body) AND self-contained — then set frontmatter `model: haiku`/`sonnet` (optionally47 `effort:`), ideally with `context: fork`. Otherwise inherit: the override lasts the rest of the48 turn (downgrading whatever task invoked the skill) and a mid-turn model switch busts the prompt49 cache both ways. Judgment-heavy or high-stakes skills (prod migrations, shared-config edits,50 session summaries) always inherit.51- **Pick the tier by task SHAPE, not just "cheaper":** `haiku` = mechanical AND terminal (runs at52 the turn's end — a commit, a final formatting pass). `sonnet` = high-VOLUME batch that still53 carries light editorial judgment (a playlist-scale copy-edit Haiku would flatten). `inherit` =54 rare (savings ≈ 0) OR judgment-heavy. A mid-turn (non-terminal) skill stays `inherit` even when55 mechanical — the cache-bust outweighs the token saving. The real routing wins are subagents (own56 context, no cache cost).5758## settings.json Rules5960- Project-level `settings.json` is shared (checked in). No secrets, no personal paths.61- Personal overrides go in `settings.local.json` (must be in .gitignore).62- Permissions: prefer specific patterns (`Bash(npm test *)`) over broad wildcards.63- Set model and effort at session start to preserve prompt cache.6465## Token Awareness6667When adding ANY content to .claude files, consider token cost:6869- Every line of CLAUDE.md costs ~2-4 tokens PER TURN, every turn, every session.70- Ask: "Is this worth paying for on every single message?"71- If the answer is "only sometimes" — it's a skill, not CLAUDE.md.72- Prefer terse, imperative rules over explanatory prose.73- Use bullet points, not paragraphs.7475## Anti-Patterns to Reject7677- Adding "use TypeScript" when tsconfig.json exists78- Listing every file in the project79- Pasting entire style guides (link them instead)80- Adding instructions "just in case" — if it's not causing errors, don't add it81- Duplicating content already in another file (README, CONTRIBUTING, etc.)8283## Before Saving Changes84851. Count lines. Is CLAUDE.md still under 200?862. Could this be a skill instead? If yes, make it one.873. Is this already inferrable from project files? If yes, skip it.884. Read it as if paying per-word. Cut filler.