/the-workflow:claude-mdfrom the-workflow
Guides how CLAUDE.md and `.claude/rules/` files load, inherit, and are ignored. Covers layer precedence, monorepo scope, and troubleshooting rules that don't apply.
Ships in the-workflow. 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.
CLAUDE.md is delivered as a user message after the system prompt, not as configuration. It is read and weighed, never enforced — which is why a rule that must hold every time belongs in a hook or a permission, and why the goal here is compliance, not completeness. A short file that gets followed beats a full one that gets ignored.
A CLAUDE.md is instruction text. Invoke `prompt-engineering` for the wording, the instruction budget, and the timelessness rules that govern every line written here. This skill covers only what is specific to the CLAUDE.md and `.claude/rules/` artifacts — what loads when, which layer owns which content, and why a stated rule gets ignored.Routing and trimming decisions are wrong whenever the loading model is wrong. Establish this first.
CLAUDE.local.md is appended after CLAUDE.md./Library/Application Support/ClaudeCode/CLAUDE.md on macOS,
/etc/claude-code/CLAUDE.md on Linux and WSL, C:\Program Files\ClaudeCode\CLAUDE.md on Windows) → ~/.claude/ →
the project (./CLAUDE.md or ./.claude/CLAUDE.md) → ./CLAUDE.local.md. Managed policy cannot be excluded.@path imports expand at launch, up to four hops deep. Splitting a large CLAUDE.md into imports buys organization
and never buys context. A path inside backticks stays literal instead of importing.claudeMdExcludes skips files by absolute-path glob, set at any settings layer, with arrays merging across
layers. It is the monorepo tool for another team's files, and it excludes their rules along with their CLAUDE.md./context, under Memory files. The InstructionsLoaded hook logs each file
as it loads, which is how a lazily-loaded rule is debugged..md under .claude/rules/ is discovered recursively. Subdirectories such as frontend/ and backend/
are a supported layout, and nested .claude/rules/ directories deeper in the tree load on demand. Centralizing every
rule at the repository root is a governance choice, never a requirement.paths loads at launch at the same priority as .claude/CLAUDE.md. It costs exactly what a
CLAUDE.md line costs.paths triggers when Claude reads a matching file, not on every tool use. This is the one mechanism
that genuinely reduces baseline context.~/.claude/rules/ loads before project rules, so a project rule outranks a personal one on the same topic.paths-scoped rules do not. They reload when Claude next reads a file they apply to..claude/rules/ — conventions scoped to a file type or a path, via glob paths. Lighter than a skill, no
SKILL.md ceremony.The test: universal rule → CLAUDE.md. Scoped to file types or paths → .claude/rules/. Scoped to a kind of work →
skill. Must happen automatically → hook.
Prefer the path fence. When one glob covers exactly the files a rule governs, put the rule in .claude/rules/ with
paths — not once CLAUDE.md grows too long, but on the way in, while it is still short. A scoped rule is the only layer
that costs nothing until it is relevant, and it arrives in context beside the file it applies to instead of competing
for attention with every unrelated rule from the first turn.
Keep the rule in CLAUDE.md when the fence leaks — the glob matches files the rule does not govern, or misses files it does — or when the rule must hold before Claude reads any file. A fence that needs a growing list of patterns to stay accurate is leaking; state the rule once at the root instead.
Instructions are not enforcement. Models route around soft constraints stated as prose — working from a different directory to dodge a path restriction, rephrasing to dodge a wording rule. Anything that must never happen goes in permissions, sandbox configuration, or a hook. CLAUDE.md states working defaults.
Where the record goes instead. Past work → commit messages and the tracker. A lesson from one incident → memory, promoted to a CLAUDE.md rule only on recurrence. A decision → one present-tense rule here, with any why longer than a clause moved to an ADR the rule links to.
Two tests, both mandatory. If removing an instruction would not change output quality, cut it. If Claude can infer it by reading the codebase, cut it.
Include:
Exclude:
lsyarn lint
doubles its cost and changes nothing.Target under 200 lines per file — past that, adherence measurably drops. Treat 200 as the trigger for a classification pass, never as a cap to cut to: a file that stays above it because every block survived the pass is correct.
/doctor proposes trims for a checked-in CLAUDE.md (v2.1.206 and later): it cuts what Claude can derive from the
codebase — directory layouts, dependency lists, architecture overviews — and keeps pitfalls, rationale, and conventions
that differ from tool defaults.
Classify each block when trimming by hand:
.claude/rules/ — a path- or filetype-scoped convention. With paths frontmatter it stops costing
baseline contextThree exceptions stay regardless of how rarely they apply: safety-critical content (violating it loses data, breaches security, or breaks production), easy-to-violate content (Claude gets it wrong without the reminder), and security-sensitive content (authentication, authorization, secrets, data exposure). The goal is working efficiency, not a line count — moving a critical rule into a rarely-loaded file is a regression.
Trim when the file passes 200 lines, Claude ignores rules that are present, unrelated domains share one file, or a human cannot skim it in under 60 seconds.
Work down this list. The first two causes are mechanical and account for most reports.
paths-scoped rule that has not matched a file, in a
directory outside the launch path, or in a file over 4 MiB. It may also be excluded by claudeMdExcludes. Confirm
with /context under Memory files, or the InstructionsLoaded hook. Fix by moving the rule to a layer that loads
when it is needed.paths-scoped rule, or an instruction that only
ever existed in conversation. Fix by writing it into the project-root CLAUDE.md, which is re-read from disk.Start at 50–100 lines and iterate from observed failures. A file written from static analysis is a starting point; the real content comes from where Claude gets things wrong during work.
Detect the stack from config files (package.json, go.mod, Cargo.toml, pyproject.toml, Makefile, CI and linter
configs). Map capabilities to locations. Identify the conventions that differ from language defaults — those are the
only ones worth writing. Apply the deletion test before delivering.
/init generates a starting file, and suggests improvements rather than overwriting when one already exists.
Read [${CLAUDE_SKILL_DIR}/references/scaffold.md] when creating a file from scratch or restructuring an existing one —
it carries the canonical section order with worked examples, the creation workflow, and the monorepo layouts.
When writing or editing a CLAUDE.md:
When auditing a CLAUDE.md:
What SKILL.md sets; muted values are Claude Code's defaults
Invoke whenever a CLAUDE.md or a `.claude/rules/` file is touched at all — creating, editing, auditing, trimming, or choosing which layer a rule belongs in. Also invoke on the symptoms: a rule in the file gets ignored, Claude cites a path that does not exist, behavior differs between sessions, an instruction disappears after `/compact`, or a rule never loads inside a monorepo package.
Three short reads, in order
npx claudepluginhub xobotyi/cc-foundry --plugin the-workflow3 skills in this plugin
/debriefHarvest corrections from Claude Code sessions and auto memory, and write each lesson that outlives its task into the instruction file, permission rule, or hook it belongs in, after the user approves it./handoffTriage this conversation into a standalone transfer document — decisions, constraints, resource identifiers, verification state, and remaining work — for a session restart or a teammate.Other plugins' skills for the same job