coding-agent-playbook-claude-code
CLAUDE.md0 starsChanged 5 months agoMITView on GitHub
This repository is a public playbook of Claude Code global instructions, skills with their packaged reference documents, and custom subagent definitions. It is almost entirely Markdown, plus a standard-library Python installer with two thin launchers and a small amount of YAML frontmatter. Repository-specific guidance here overrides the global instructions where it is more specific.
In this repository10 other files it gives its agents.
- feature-branch-lifecycleSkill
- handoffSkill
- legacy-path-retirementSkill
- multi-session-coordinationSkill
- reference-doc-routingSkill
- senior-code-reviewSkill
- session-cleanupSkill
- subagent-orchestrationSkill
- task-graph-orchestrationSkill
- worktree-lifecycleSkill
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
19 rules. About 0 are common, 15 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Keep the playbook useful across many teams and codebases.
- Distinctive: line 10
Keep global guidance tool-agnostic and durable.
- Distinctive: line 11
Keep repository-specific, machine-specific, and workflow-specific detail out of global instructions.
- Distinctive: line 12
Prefer concise, practical guidance over theory — but do not sacrifice necessary detail for brevity.
- Distinctive: line 13
Keep the root session accountable for framing, delegation, coordination, integration, validation, and the final report.
- Very specific: line 14
Keep the subagent lineup at local-orchestrator, read-only-explorer, senior-reviewer, docs-researcher, test-triager, and isolated-worker.
- Distinctive: line 36
Background subagents: keep only a subset of built-in tools, so one definition can resolve to different tools in the foreground and the …
- Distinctive: line 41
No sensitive access material, private local paths, internal-only URLs, session transcripts, or long incident logs.
- Distinctive: line 42
No hardcoded project names, organization workflows, or local machine quirks in global guidance.
- Distinctive: line 43
No instructions tied to a specific issue tracker, review tool, package manager, shell, or hosting provider unless the file is explicitly an …
- Distinctive: line 44
Use Claude Code terminology in Claude-specific files: CLAUDE.md, the resolved Claude Code home, Markdown agent definitions with YAML …
- Distinctive: line 45
Never copy configuration paths, file names, agent formats, model identifiers, or command vocabulary from another coding-agent environment …
- Distinctive: line 46
Prefer "safety", "access control", and "sensitive access material" over product-specific security terminology.
- Distinctive: line 47
Keep templates reusable and clearly marked as templates.
- Distinctive: line 48
Keep generic behavioral policy aligned with the companion Codex playbook.
- Distinctive: line 65
Run the full check suite locally before finalizing meaningful changes:
- Very specific: line 75
Every SKILL.md has YAML frontmatter with name and description, and its name matches its directory.
- Very specific: line 80
Only agents/local-orchestrator.md lists Agent in tools.
- Very specific: line 81
No bundled agent sets isolation: worktree.
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md 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
Repository Coding Agent Instructions
This repository is a public playbook of Claude Code global instructions, skills with their packaged reference documents, and custom subagent definitions. It is almost entirely Markdown, plus a standard-library Python installer with two thin launchers and a small amount of YAML frontmatter.
Repository-specific guidance here overrides the global instructions where it is more specific.
What This Repository Is For
- Keep the playbook useful across many teams and codebases.
- Keep global guidance tool-agnostic and durable.
- Keep repository-specific, machine-specific, and workflow-specific detail out of global instructions.
- Prefer concise, practical guidance over theory — but do not sacrifice necessary detail for brevity. These files are read by agents that need the specifics.
- Keep the root session accountable for framing, delegation, coordination, integration, validation, and the final report.
- Keep the subagent lineup at
local-orchestrator,read-only-explorer,senior-reviewer,docs-researcher,test-triager, andisolated-worker. - Keep the branch, worktree, session, and dependency lifecycles separate.
feature-branch-lifecycleowns branch topology, promotion, and temporary-branch cleanup;worktree-lifecycleowns checkouts;multi-session-coordinationowns concurrent ownership;task-graph-orchestrationowns dependencies between work outcomes. A branch is not a worktree, a branch is not a session, and a feature integration branch is not automatically a graph node.session-cleanupowns the end-of-work integrity pass over the work delta and routes branch deletion and worktree removal to those skills rather than doing either itself;handoffprepares a fresh continuation, starts one itself only when the user asks, and changes nothing else. - Keep the operating model direct-first: the root session implements by default, including substantial multi-file work; subagents are used sparingly — only when a bounded assignment's concrete benefit outweighs its context, coordination, latency, and review cost, or independent assistance is required — bounded, flat by default, and never mandatory; skills and dependency-graph planning apply whether one agent or several do the work. Do not reintroduce a rule that requires a helper on every task, a direct-execution exception statement, one helper per graph node, or a required sequence of planner, implementer, reviewer, tester, and documentation passes.
- Keep each agent definition usable two ways: as a Role perspective the root applies directly (which changes nothing about the root's model, effort, permissions, or ownership, and is self-review, not independent verification) and as a bounded assignment for an actual subagent, whose Delegated use rules apply only when it runs as one. Keep the two separated in the file, with an Applying this perspective directly section between them.
- Keep the engineering standard: understand the whole affected flow before choosing a fix; improve the existing implementation by default and replace a substantial part only on evidence of a significant benefit that justifies migration, verification, and maintenance costs; treat unnecessary abstractions, speculative compatibility, and redundant tests as maintainability defects; keep testing proportionate (smallest meaningful checks, lasting tests for final behavior and realistic regression risks, obsolete intermediate tests removed, required assertions preserved); and never invent a support commitment for hypothetical users, obsolete test accounts, fixtures, or earlier implementations. Do not introduce numerical quality thresholds or scores.
- Keep every skill self-contained: a skill's
SKILL.mdand every reference or template it depends on live under that skill's directory and install together, and a path written inside a skill resolves against the skill's package root. There is no top-levelreferences/directory. A cross-skill need is met by naming the owning skill, never by reaching into its files or keeping a second copy.
Facts About Claude Code That This Playbook Depends On
These are load-bearing. If you change guidance that touches them, verify against the current Claude Code documentation first — an earlier version of this playbook had the nesting rule backwards, and it propagated to eleven files.
- Subagent frontmatter supports
name,description,tools,disallowedTools,model,permissionMode,effort,isolation, and others. All of the fields used here are documented. - Model precedence (Claude Code v2.1.251 and later): per-invocation
model> frontmattermodel(includinginherit) >CLAUDE_CODE_SUBAGENT_MODEL> the main conversation's model.CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1reverses this — it ignores every definition'smodeland blocks the per-call parameter — and an organizationavailableModelsallowlist can substitute. Before v2.1.251 the environment variable came first; do not reintroduce that ordering. - A helper's model is chosen for its work, within approved routes, independent of the main session's model, nesting depth, retries, and replacements:
haikufor narrow lookup, extraction, file mapping, and log summaries;opusat the definition'seffort: mediumfor implementation, diagnosis, planning, and review; the root itself, on the user's model, for the hardest architecture and cross-system reasoning. Each definition declares the default for its typical work —read-only-exploreranddocs-researcheronhaikuwith noeffortfield (Haiku does not supporteffort), andsenior-reviewer,test-triager,isolated-worker, andlocal-orchestratoronopusateffort: medium— and the per-callmodelselects the actual route. Judgment work never goes to Haiku.sonnetandfableare not helper routes;high,xhigh, andmaxon a helper are deliberately not used because they remove the per-turn thinking ceiling and consume usage quickly on work the root verifies anyway; fast mode is a main-session setting the user controls. The main session's model, effort, and speed are never changed from inside a task. Do not reintroduce a "child at or below the main session's tier" rule, a fixed route that ignores the work, or effort-specific copies of the roles. - There is no per-invocation
effortparameter on theAgentcall. A definition'seffortis the only way to set a subagent's effort; a definition that omits it inherits the session level. This is why effort belongs to the role while the model is chosen per dispatch, and why there is one definition per role rather than copies per effort level. TheeffortLevelsettings key acceptslowthroughxhighbut notmax.mediumis the documented default effort for Opus 5.5, which Anthropic reports matches or exceeds Opus 5 athighthere. - Nesting is enabled by default, up to three layers below the main conversation.
CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=2tightens that to two;1turns nesting off. It is not a switch that enables nesting, and it must never be documented as a precondition for delegation. - What actually prevents a spawn is omitting
Agentfromtoolsand listing it indisallowedTools. Prompt text does not. - Subagents invoke skills only through the
Skilltool. Atoolsallowlist that omitsSkill— as every bundled role's does — means the subagent cannot invoke a skill; the caller names each applicable skill and its entrypoint path in the assignment and the helper reads it. Theskillsfrontmatter field preloads skill content at startup and is not used here because the applicable set is chosen per task. effortoverrides the session effort level. It is a property of the role, not a ceiling inherited from the caller. Do not reintroduce a rule that a child's effort must be at or below the caller's session effort — it would make a role's pinned effort unreachable from a session running below it, and it misreads the field.- Plan mode gates shell commands. Commands outside the built-in read-only set are classifier-reviewed or prompt for approval, so a
plan-mode subagent cannot reliably run tests, linters, type checkers, or builds. Suite execution belongs totest-triager(defaultmode), notsenior-reviewer(planmode). isolation: worktreebranches from the repository default branch, not the parent session'sHEAD, unlessworktree.baseRefis"head". This is why isolation is root-authorized with the base ref recorded.- Agent teams are experimental and off by default (
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1enables them). While on, a named subagent spawn in an interactive session becomes a teammate that runs in the main session's working directory and inherits the lead's effort rather than the definition's; frontmatterisolationdoes not prevent it. - Background subagents keep only a subset of built-in tools, so one definition can resolve to different tools in the foreground and the background.
- Session actions, which the
handoffskill depends on.claude "<prompt>"starts an interactive session with that first prompt,-nnames it, and/clearstarts a new conversation with an empty context while the previous one stays resumable.--continue,--resume, and/resumereopen a conversation with its history;/branch,--fork-session, and/forkcopy that history.claude -pruns headless and exits.claude --bgstarts a background session (agent view, a research preview) that moves into its own worktree under.claude/worktrees/before it edits — branched from the default branch unlessworktree.baseRefis"head"— and commits and pushes its changes unless the task,CLAUDE.md, or memory says the user handles git. It takes the prompt as the positional argument and--namefor its title, and prints the session ID thatclaude logs <id>(recent output) andclaude attach <id>(open it in a terminal) take;claude agents --jsonlists active sessions. Claude Code documents no tool for the model to open a new interactive session. Checked against the Claude Code 2.1.263 documentation andclaude --help.
Content Rules
- No sensitive access material, private local paths, internal-only URLs, session transcripts, or long incident logs.
- No hardcoded project names, organization workflows, or local machine quirks in global guidance.
- No instructions tied to a specific issue tracker, review tool, package manager, shell, or hosting provider unless the file is explicitly an example or template.
- Use Claude Code terminology in Claude-specific files:
CLAUDE.md, the resolved Claude Code home, Markdown agent definitions with YAML frontmatter, model aliases, effort levels, permission modes, real tool names, and real session commands. - Never copy configuration paths, file names, agent formats, model identifiers, or command vocabulary from another coding-agent environment into this repository.
- Prefer "safety", "access control", and "sensitive access material" over product-specific security terminology.
- Keep templates reusable and clearly marked as templates.
- Keep generic behavioral policy aligned with the companion Codex playbook. Where a difference is intentional, name the concrete Claude Code capability that requires it rather than leaving unexplained drift.
Writing Style for Agent-Facing Files
The agents/, skills/ (including each skill's packaged references and templates), and custom-instructions/ files are read by models, and how they are written changes how well they are followed.
- Put a rule where its actor can act on it. Routing rules belong in the caller's documentation, not duplicated into every leaf agent's system prompt — a leaf cannot choose its own model.
- Lead with the decision, then the rule, then the exception.
- Prefer concrete examples over abstract constraint lists. One worked assignment teaches more than twenty required fields.
- Explain the mechanism when it changes behavior. "Plan mode cannot run your test suite" is followed; "respect permission boundaries" is not.
- Use tables for lookups and numbered steps for procedures.
- State positive defaults, then a bounded list of what not to do.
- Avoid invented vocabulary. Say what Claude Code says: subagent,
Agenttool,subagent_type,model,effort,permissionMode,tools,disallowedTools, nesting depth, plan mode. - Do not compress away necessary detail. These files are reference material; length is fine when every paragraph earns its place.
Validation
Run the full check suite locally before finalizing meaningful changes:
bash scripts/validate.shCI runs exactly this script (.github/workflows/validate.yml), plus a PowerShell job that parses install.ps1 and runs the launcher end to end, including a dry run.
Automated checks (CI enforces all of these):
- Every
SKILL.mdhas YAML frontmatter withnameanddescription, and itsnamematches its directory. Every directory underskills/has aSKILL.md, and no file sits loose directly underskills/. - Skill packages are discovered from the tree by both the installer and the validator, so adding one requires no change to either. Do not reintroduce a hardcoded skill list.
- Every
agents/*.mdhasname,description,model,permissionMode,tools, anddisallowedTools, declares an approved default route (haikuwith noeffortonread-only-exploreranddocs-researcher;opuswitheffort: mediumon the other four), and carries the## Role perspective,## Applying this perspective directly, and## Delegated useheadings. Both validators check only the six playbook-managed definitions by name, so a user's own agents are never judged against this policy. read-only-explorer,docs-researcher, andsenior-reviewerusepermissionMode: planand list neitherEditnorWrite.test-triager,isolated-worker, andlocal-orchestratorusepermissionMode: default.- Only
agents/local-orchestrator.mdlistsAgentintools; the other five listAgentindisallowedTools. - No bundled agent sets
isolation: worktree. - Fenced code blocks are balanced; every repository path referenced in Markdown exists; every
references/...path written inside a skill resolves inside that skill's package; no Markdown outsideskills/refers to a top-levelreferences/path; no file carries configuration paths or model names from another coding-agent environment; and no skill package ships another environment's per-skill metadata file. install/install.pypasses a real full-mode install into a temporary home (including a body containing backslashes), a repeat install that changes nothing and writes no backups, a dry run that creates nothing and uses "Would ..." wording, a support-only install that preserves and backs up existingCLAUDE.mdcontent, a legacy-reference migration that retires an unchanged file and preserves a customized one, and exits non-zero when a managed file is missing.install.shandinstall.ps1are thin launchers forinstall.pyand, withpwshavailable, produce a byte-identical Claude Code home in both modes. The former duplicated Bash and PowerShell implementations drifted more than once — a trailing-newline difference and a case-insensitive manifest sort made each rewrite the other's files — so do not reintroduce a second implementation.install.shpassesbash -n,install.pycompiles, and the pointer block inclaude-prompts/setup-global-claude-support-system.mdis identical toinstall/support-only-pointer.md.
Manual review:
- Guidance touching any item in Facts About Claude Code matches current documentation.
README.md's repository-structure block matches the actual tree.- Design-principle wording in
custom-instructions/,agents/, andskills/stays consistent withskills/reference-doc-routing/references/engineering-design.md: whole affected flow understood first, smallest complete solution, improve before replace (a substantial replacement needs evidence of a significant benefit, never a numerical score), earned abstractions rather than a blanket ban on single-use ones, root-cause fixes within scope, and material technical debt recorded with scope, rationale, and follow-up condition. - Testing wording favors the smallest meaningful checks and lasting tests for intended final behavior and realistic regression risks, removes only tests that preserve an abandoned approach, preserves required assertions and explicit coverage gates, and never treats a mocked or partial check as proof of the complete integration.
- Install docs and scripts reference the current file set.
- No file reintroduces mandatory delegation, a direct-execution exception statement, one helper per graph node, graph use that requires delegation, a required role sequence, a claim that applying a role's perspective yourself satisfies an independent-verification gate, or permission to skip a matching skill for direct or familiar work.
- Design guidance asks for existing components, dialogs, hooks, validators, utilities, and interaction patterns to be reused, composed, or extended before new code is written, and justifies shared code by a current need, a real boundary or invariant, an established convention, or meaningful duplication removed — never by hypothetical reuse.
- Legacy-path guidance keeps or adds a compatibility path only for a demonstrated current dependency or an explicit retention requirement, treats a search that finds nothing as an evidence gap rather than proof of non-use, treats hypothetical users, obsolete test accounts, fixtures, and earlier implementations as no support commitment, decides data retention separately from code retirement, and carries correctness safeguards into the authoritative path.
- Handoff guidance names only session actions Claude Code supports, never offers a resume, branch, fork, or cross-session message as a fresh continuation, and gates a background continuation on the user's request and on its worktree and git behavior.
- Session-cleanup guidance derives the work delta from the repository against a verified baseline, preserves unrelated work, requires evidence for compatibility code, and never deletes branches or worktrees itself.
- Branch guidance keeps the detailed procedure in
skills/feature-branch-lifecycle/references/branching-rule.mdrather than the global instructions, detects real branch names instead of assumingmainorstaging, never invents a missing long-lived branch, never lets a development branch bypass the feature integration branch, requires complete-feature validation before promotion, gates every temporary-branch deletion on verified evidence and explicit authority, preserves and reports a branch whose gates fail, and never deletes a permanent branch. - The installer defaults to full mode, maintains the managed-file manifest, retires only unchanged formerly managed files (including loose
references/files left by earlier releases), writes backups outside the managed trees, and preserves customized or unrelated files. - Generic policy changes were compared with the companion Codex playbook.
- The final diff contains no paths, schemas, model names, or commands belonging to another coding-agent environment.
License
MIT (see LICENSE). Do not change the license without an explicit maintainer decision.
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.

