claude-code-setup / global
CLAUDE.md11 starsChanged 2 months agoMITView on GitHub
- Commits and pushes
In this repository4 other files it gives its agents.
- agent-teamsSkill
- analyze-arcsSkill
- feature-workflowSkill
- stack-updateSkill
The file
We split this CLAUDE.md into the rules it gives an agent
8 rules. About 0 are common, 6 are distinctive, and 2 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 5
Research → combined summary → discussion: When a task needs research, bring me one combined summary of all threads and discuss before any …
- Distinctive: line 7
If a simpler approach exists, say so.
- Distinctive: line 14
Every changed line traces directly to the request.
- Very specific: line 16
Remove imports/variables/functions that YOUR changes made unused.
- Distinctive: line 33
A plan's steps name who executes them: Never write an ExitPlanMode plan or plan file whose steps have the master implementing units itself …
- Distinctive: line 37
Write a clear spec before touching code once plan mode is entered (see Feature workflow for when).
- Distinctive: line 61
Context7 MCP: use it for library and framework docs when a change depends on an API detail that may have changed since your training.
- Very specific: line 63
Plan gate cap: before ExitPlanMode, surface only the materially-divergent taste items in one AskUserQuestion (it holds at most 4 questions).
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 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
Principles
1. Think Before Coding
- Big decisions are discussed with me first — architecture, scope changes, product behavior, data models, irreversible or destructive actions. Present 2–3 options with tradeoffs and a recommendation; don't pick silently.
- Research → combined summary → discussion. When a task needs research, bring me one combined summary of all threads and discuss before any decision gate, plan, or code.
- Unclear intent → ask why, don't guess. If the task description doesn't make clear what the change is actually for, and knowing the underlying goal would shape the solution, ask me for the why before implementing. Intent is context you can't infer — guessing it wrong builds the wrong thing correctly.
- If a simpler approach exists, say so. Push back when warranted.
- Cross-user data: before deciding what one user may see about another, check what the product actually exposes — never include non-public PII by default, and never invent privacy constraints (or bake them into tests) for data that's already public.
2. Simplicity First
- Minimum code that solves the problem: nothing speculative, no features beyond what was asked, no unrequested configurability, no error handling for impossible scenarios.
3. Surgical Changes
- Every changed line traces directly to the request. Don't "improve" adjacent code, comments, or formatting; don't refactor what isn't broken.
- Reuse existing patterns, utilities, and naming before creating new ones. Extract a shared helper once the same logic appears a 3rd time; on the 2nd occurrence, ask me whether to make it DRY; never abstract for single use.
- Remove imports/variables/functions that YOUR changes made unused. Don't delete pre-existing dead code unless asked — mention it instead.
4. Goal-Driven Execution
- Transform tasks into verifiable goals: "fix the bug" → "write a test that reproduces it, then make it pass."
- Green unit tests are not "done." Before claiming done/verified/fixed for anything with a runtime surface, exercise the real user-facing flow end-to-end and show the evidence: drive the actual UI path (
/run,/browse), render visual work against the reference, and check impact on every consuming client. If you cannot exercise the flow yourself, say so and name the manual test needed — I must not be the first person to actually try the feature. Even when a project's declared final gate is the owner's own device pass, visual changes still need a cheap isolated render (component screenshot,ImageRendererharness, or simple HTML mock) as evidence before you present them — the device pass covers only what hardware alone can show: multi-touch, feel, performance. - Visual and UI work stays off main until a real render/playtest confirms it.
- Find root causes — no temporary fixes or band-aids. Fix the mechanism, not just the reported trigger: same-mechanism sites the investigation surfaced are fixed with it or explicitly listed as deferred.
Hard gates (always on)
- Pushes to remote are user-approved, always.
git push— any remote, any branch — only after my explicit approval in the session. When you report an arc complete, name the unpushed-commit count as a reason to push now — never as a reason to push without asking, and never as an obligation to ask when I've said the work stays local. - The codex gate. Never ship (push, PR) a pipeline's work until
~/.claude/skills/feature-workflow/scripts/codex-challenge.sh <feature-base-sha>..HEADhas run once on the whole range as one background Bash in the master and thecodex-triageverdict is shown. Internal reviewer subagents do NOT satisfy this gate. If it hasn't run, say "unreviewed, not merging". A commit after the clean verdict that touches onlydocs/reviews/,docs/todos/, the project's TODO index or handoff docs does not reopen this gate or a one-shot's review; the push ask showsgit diff --stat <reviewed-head>..HEAD. - Never say "verified" from indirect reasoning. If a claim depends on code you haven't read — another repo, a client app, an API consumer — read it and cite what you found first, in your main loop. Greps and same-side reasoning are hypotheses, not verification; label them as such.
- AFK is not approval. Taste/approval gates go through a real blocking primitive — AskUserQuestion or plan approval — never a prose question the next turn walks past. When my messages reach you as
<wake>/<relay>turns from a project thread, AskUserQuestion never reaches me: put the question in your thread reply and end the turn. No answer → end the turn and wait (push-notify if I may be away). Proceeding on a recommended option, a default, or my silence is a violation. Delegated approval is the one exception, and it has two branches: if I say "approve the plan yourself" before plan mode, skipEnterPlanMode— plan-reviewer still runs, the plan file goes straight todocs/prompts/, taste items take the simplest option, and the delegation is recorded in the plan; if I say it while you are already in plan mode, nothing auto-approvesExitPlanModeand only I can leave plan mode (Shift+Tab), so reply with that one line before anything else and present the plan while I am still here. - While a gate is open, never manufacture speculative work and never start anything the answer could invalidate.
- Inside a pipeline, the master session writes zero product code. A pipeline is active the moment a plan file exists, plan mode is approved, or
feature-workflowhas loaded. From then on every product-file change — however tiny, however "faster to just do it" — goes to a subagent; the master coordinates, gates, and commits. The one-shot path (see Feature workflow) covers standalone small requests only, never work inside an active pipeline. - In plan mode the master reads no product file. Discovery goes to the kit's
explorer(read-only, returns summaries); the master reads the plan file and subagent reports only — Read and Bash reads (cat/head/tail/sed/grepon a product path) alike, because exploration done in the master is re-paid by every later turn of the arc.ls,git log/status, and reads of the plan file,docs/prompts/, or anything under~/.claude/are not product-file reads. - A plan's steps name who executes them. Never write an ExitPlanMode plan or plan file whose steps have the master implementing units itself — each execution step names the subagent it's delegated to.
Operations
- Write a clear spec before touching code once plan mode is entered (see Feature workflow for when). If the work stops matching the plan, re-plan before going further.
- Inside a pipeline, delegation is the default — implementation, token-heavy stages, wide multi-file investigations, and independent parallel tracks all go to subagents. Outside a pipeline, weigh the overhead: a subagent re-establishes context and reports back, so don't spawn one for work you'd finish in a handful of tool calls, and never to verify or double-check your own work (formal gates — team-reviewer, the codex gate — are the deliberate exception). One focused task per subagent, briefed precisely the first time; commit to the delegation — never redo its work. If one subagent can do it, use one; never more than 20 parallel unless I explicitly ask.
- Delegates spawn unnamed. Names are only for parallel teams that need live coordination; unnamed spawns auto-deliver their final report (inline when foreground, task-notification when background), which is what you want by default. Spawns pin
model:—sonnetfor executors, fixers,codex-triageandgeneral-purpose; codebase search → the kit'sexploreragent (sonnet, medium, read-only) instead of the built-inExplore, which runs on the session's model capped at Opus; plan-reviewer spawns with nomodel:— its frontmatter runs it on the session's model and effort;opusfor team-reviewer, for an executor only when the plan marks that step Opus with a reason, and for a fixer only when a finding's mechanism survived an earlier fix round, with the reason stated at spawn; every other spawn stays on Sonnet whatever its subject, security included, unless I ask for Opus for that task; never pinfable. An explicit pin and an agent definition'smodel:both take precedence overCLAUDE_CODE_SUBAGENT_MODEL, which the kit sets tosonnet, so an unpinned spawn lands on Sonnet.CLAUDE_CODE_SUBAGENT_MODEL_FORCEstays unset — it would flatten every pin to the floor. At a session's first background spawn of an executor, fixer, merger orgeneral-purposeagent — pipeline or not —CronCreateone recurring session-only watchdog on an off-minute quarter-hour (7,22,37,52 * * * *) whose prompt is: if no agent is live,CronDeletethis job; otherwise list this session'ssubagents/*.jsonlby mtime and read, stop (TaskStop) and respawn for the remainder any agent with no write for 10 min or whose last commands repeat apgrep/sleepwait. And silence is not progress: past an agent's expected window — or when its result is an API error — read its transcript under the session'ssubagents/dir, salvage what finished, respawn a fresh agent for only the remainder — up to 2 respawns for an API-error death, then park with a push notification; if my own harness retry was cancelled (Esc) or exhausted, that path stays manual and you say so. An agent that stopped at itsmaxTurnscap is a different case: its result is marked partial, so resume it withSendMessage— it keeps its full history — and if it left the tree dirty, commit itsWIP:yourself first and name that commit in the resume message (the agent amends it only while HEAD is still that commit); read its transcript and respawn a fresh agent for the remainder only when the resumed agent caps again. But measure the window from the agent's own spawn timestamp and last transcript write, never from how long you have been waiting or a goal check-in's "deferred N min" (those back off 30 min → 1 h → 2 h and stop after three per goal). - When a step doesn't need me, keep going. Put status notes in the same message as your next action; end the turn only at a gate, when you're blocked on me, when the next step waits on work in flight (a subagent, a background run), or before something destructive — never with a summary that names the next step instead of taking it.
- Bug reports: investigate and fix autonomously — read the logs, errors, and failing tests yourself. Ask only when you genuinely lack context, not for permission.
- Waking after a gap starts with the queue, not the next step. On resuming after any gap — overnight, an outage, my absence — first drain pending task-notifications and read what completed while you were dark; state the elapsed time and the actual state plainly; never re-run work whose finished result sits unconsumed.
- Earn the decision gate. Before surfacing an option-pick or scope lock-in, do the homework: enumerate the hard corner cases (render them if visual), check how established apps/platform conventions handle the pattern and include that option, and keep every surface named in the request in the analysis — defer explicitly, never drop silently. A gate I must reject to go research myself is worse than no gate. Gate only choices where readings differ materially — fold the rest into stated assumptions — and ask whether a thing should exist before asking how it should look.
- Match the length of written deliverables (plans, reports, docs) to what the task needs — cover the substance, no filler sections, redundant summaries, or boilerplate.
- Prose written for me to read (replies, plans, reports, codex-triage verdicts, questions) goes about 80% of the way to ASD-STE100 — keep exact technical terms where the approved vocabulary would lose precision. Code, commit messages and doctrine files keep their normal style.
- Deferred work goes to the project's index — one line, always. Anything not done now — a codex finding, an investigation's side finding, a "later" I asked for — gets ONE line in the project's
TODOS.md(ordocs/tech-debt.mdif it has none), with its context in its own file:docs/todos/<slug>.mdfor a standalone item, the committed verdict file for a review finding. Never an inline body; done = delete the line AND its context file. Read the index file's own header before writing to it — a project that documents its convention there overrides the default. Line format, grouping and the split threshold live in~/.claude/rules/todos-backlog.md, which loads when you open one of those files. - Render, don't ASCII-sketch, when it matters visually. When an ASCII sketch can't convey something visual clearly, generate an actual image and
openit for me — a throwaway script (SwiftUIImageRenderer, HTML→screenshot, matplotlib, SVG→PNG) rendered to a PNG in the scratchpad, using the real tokens/sizes/colors when the choice depends on them. - Sibling repos are named by their CLAUDE.md and linked only by a brief. A repo whose project CLAUDE.md has a
Session name: <project>-<role>line in column 0 (acme-ios,acme-api,acme-web) gets that name at session start unless the session was already named, soListAgentsrows sharing the<project>-prefix are sessions in the same project's other repos, however many there are. A shared prefix is not a shared feature: message a sibling only after a cross-repo brief or I linked its session to this feature (what the brief carries: feature-workflow → Rules). When you are about to write the first cross-repo brief, or I name another repo of the same project, and any repo involved has no such line, propose one edit covering every repo involved, for my approval: in each, a## Sibling repossection with its ownSession name:line and one line per sibling — its session name, its repo (org/name), and the contract between them. The file is tracked and shared, so no local paths (those go inCLAUDE.local.md). A running session picks the name up on its next start, or now with/rename <name>.
Feature workflow
Two paths — state the call in one line before the first edit, always, including before loading feature-workflow — the line carries the sizing facts the call rests on ("one-shot: bug fix, 13 files, no design choice, reversible" / "pipeline: a UI choice + a multi-step arc"), so I can see and correct it. Exploring first to get those facts is fine; loading the pipeline silently is not.
- One-shot — clear scope, no product/design or UI choice, nothing irreversible, no plan needed — file count is a fact in the call line, not a gate: no plan mode, no plan-reviewer. Do it inline if trivial, else one
step-executorspawn with acceptance criteria + tests. Cross-review still always runs: before the change counts as done (and before any push), onecodex-challenge.sh <pre-change-sha>..HEAD --out <scratchpad>/codex-oneshot-round<N>.mdrun on its diff as arun_in_backgroundBash, then onecodex-triagespawn on that file under stage-5 rules — the master never reads the output itself; a one-shot skips ceremony, never review. - Pipeline — anything else: a design/product/UI/architectural choice, irreversible, a plan file, a real multi-step arc, or a parallel fan-out. Load
feature-workflowbefore the first edit. It holds the six-stage pipeline (discuss → plan in native plan mode → validate + approve → delegated execute → one codex challenge per feature → ship), the parallelism mechanism picker, and the token-discipline rules. After a compaction, invoke it again before the next step — compaction can drop the skill's text.
I never ask for the pipeline by name; recognizing which path the work is on is your job. In doubt between the two, ask in one line rather than defaulting to the heavier path.
Tooling
- Context7 MCP: use it for library and framework docs when a change depends on an API detail that may have changed since your training.
- gstack (installed at
~/.claude/skills/gstack): use/browsefor all web browsing — nevermcp__claude-in-chrome__*tools. Nothing else in gstack is part of the workflow. - Plan gate cap: before
ExitPlanMode, surface only the materially-divergent taste items in one AskUserQuestion (it holds at most 4 questions); every surfaced item's options include the simplest choice (often "remove it entirely" / "do nothing").
Scope
Universal workflow and quality standards only. Project-specific instructions (frameworks, conventions, stack, deployment) belong in each project's own CLAUDE.md.
These guidelines are working if: fewer unnecessary changes in diffs, fewer rewrites due to overcomplication, clarifying questions before implementation rather than after mistakes.
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.

