Agent Rules
Encode the working conventions in checked-in project instructions.
Write them generalized to the project at hand (its actual domains,
scripts, and stack), never with another app's specifics.
Use the host's native instruction format:
- In Claude Code, write one file per concern under
.claude/rules/.
- In Codex, create or update the root
AGENTS.md, preserving existing
instructions and adding one ## section per applicable concern.
Each rule's full template lives in rules/; the index below
only routes. For every rule whose "applies" condition the project meets,
read its template file, then write the generalized rule from it.
Some rules gate on a skill being installed. The installed-check —
inline this wording into each generated rule that uses it, so the rule
stands alone in the target repo: the skill counts as installed when it
appears in the available-skills list in any scope — global, project, or
plugin — possibly namespaced (e.g. mattpocock-skills:tdd);
a name match under any namespace counts, and the list beats guessing
filesystem paths.
The rules:
testing.md (every project) — test-first via
tdd, happy/negative grouping, domain-folder layout, coverage as a
discovery tool.
migrations.md (only when the project has a
DB) — local dev pushes, deployed environments migrate; the migration
lands in the same commit as the schema change.
design-system.md (frontend projects
only) — /impeccable as the quality bar, atomic-design granularity
vocabulary, content/state extremes, motion, theming, responsive
matrix.
voice.md (projects with client-visible copy) —
one copy table per surface, vocabulary from the domain doc, and a guard
test that renders every entry and refuses the banned list.
round-trips.md (projects that read over a
network) — count a flow's round trips: independent reads go out
together, batchable reads go through the batcher, and a read that waits
carries its reason.
guarded-state.md (projects with state a
person must not be moved out of freely — a request in flight, an unsaved
edit, a flow mid-way) — the guard belongs to the state, not to the control
that first enforced it: a new control inherits nothing, the second call
site means the guard is in the wrong place, and the invariant is pinned
once per control that can violate it.
intent-before-mechanism.md (every
project) — names, structure, and tests state the chosen behavior; mechanics
serve that decision.
code-review.md (every project) — run the
code-review skill and fix findings before every commit.
coding-standard-updates.md (every
project) — a root CODING_STANDARDS.md seeded from the project's own
conventions, plus the gate it changes through: propose first, five-point
test (general · expression-not-decision · machine-can't-judge ·
outlives-implementation · refusable), every entry stands on its own (no
ADR pointers), entries migrate out, written with writing-for-agents.
subagent-model-tiering.md
(every project) — model tiering (cheap / mid / heavy-hitter) by role,
heavy tier opt-in, advisory escalation, spawner-as-reviewer, parallel
execution safety.
improve-the-territory.md (every
project) — existing code is precedent, not gospel; leave touched
patterns better than found.
agent-summaries.md (every project) —
reports to a human are debriefs, not changelogs: outcome first, in
ASD-STE100 Simplified Technical English with the project's ubiquitous
language, effects over internals, "done" / "needs you" / "caveats"
kept separate.
When installing these rules, if a skill in
skill.deps.json isn't installed, prompt the user to
run its install command first.
Done when every applicable rule exists in the host's native checked-in
instruction location, written from its template and generalized to this
project, every skill-gated rule carries the installed-check wording inline,
and CODING_STANDARDS.md exists at the root with its header and every seeded
section approved by the human.
1---2name: agent-rules3description: Encode checked-in agent conventions by concern — testing, migrations, design system, voice, round trips, guarded state, intent before mechanism, code review, coding standards, subagent model tiering, improve-the-territory, and agent summaries — generalized to the project at hand in the host's native instruction format. Use when the user says "setup agent rules", "encode the agent rules", or invokes setup-tooling.4---56# Agent Rules78Encode the working conventions in checked-in project instructions.9Write them generalized to the project at hand (its actual domains,10scripts, and stack), never with another app's specifics.1112Use the host's native instruction format:1314- In Claude Code, write one file per concern under `.claude/rules/`.15- In Codex, create or update the root `AGENTS.md`, preserving existing16 instructions and adding one `##` section per applicable concern.1718Each rule's full template lives in [`rules/`](rules/); the index below19only routes. For every rule whose "applies" condition the project meets,20read its template file, then write the generalized rule from it.2122Some rules gate on a skill being installed. The **installed-check** —23inline this wording into each generated rule that uses it, so the rule24stands alone in the target repo: *the skill counts as installed when it25appears in the available-skills list in any scope — global, project, or26plugin — possibly namespaced (e.g. `mattpocock-skills:tdd`);27a name match under any namespace counts, and the list beats guessing28filesystem paths.*2930The rules:3132- [`testing.md`](./rules/testing.md) (every project) — test-first via33 `tdd`, happy/negative grouping, domain-folder layout, coverage as a34 discovery tool.35- [`migrations.md`](./rules/migrations.md) (only when the project has a36 DB) — local dev pushes, deployed environments migrate; the migration37 lands in the same commit as the schema change.38- [`design-system.md`](./rules/design-system.md) (frontend projects39 only) — `/impeccable` as the quality bar, atomic-design granularity40 vocabulary, content/state extremes, motion, theming, responsive41 matrix.42- [`voice.md`](./rules/voice.md) (projects with client-visible copy) —43 one copy table per surface, vocabulary from the domain doc, and a guard44 test that renders every entry and refuses the banned list.45- [`round-trips.md`](./rules/round-trips.md) (projects that read over a46 network) — count a flow's round trips: independent reads go out47 together, batchable reads go through the batcher, and a read that waits48 carries its reason.49- [`guarded-state.md`](./rules/guarded-state.md) (projects with state a50 person must not be moved out of freely — a request in flight, an unsaved51 edit, a flow mid-way) — the guard belongs to the state, not to the control52 that first enforced it: a new control inherits nothing, the second call53 site means the guard is in the wrong place, and the invariant is pinned54 once per control that can violate it.55- [`intent-before-mechanism.md`](./rules/intent-before-mechanism.md) (every56 project) — names, structure, and tests state the chosen behavior; mechanics57 serve that decision.58- [`code-review.md`](./rules/code-review.md) (every project) — run the59 `code-review` skill and fix findings before every commit.60- [`coding-standard-updates.md`](./rules/coding-standard-updates.md) (every61 project) — a root `CODING_STANDARDS.md` seeded from the project's own62 conventions, plus the gate it changes through: propose first, five-point63 test (general · expression-not-decision · machine-can't-judge ·64 outlives-implementation · refusable), every entry stands on its own (no65 ADR pointers), entries migrate out, written with `writing-for-agents`.66- [`subagent-model-tiering.md`](./rules/subagent-model-tiering.md)67 (every project) — model tiering (cheap / mid / heavy-hitter) by role,68 heavy tier opt-in, advisory escalation, spawner-as-reviewer, parallel69 execution safety.70- [`improve-the-territory.md`](./rules/improve-the-territory.md) (every71 project) — existing code is precedent, not gospel; leave touched72 patterns better than found.73- [`agent-summaries.md`](./rules/agent-summaries.md) (every project) —74 reports to a human are debriefs, not changelogs: outcome first, in75 ASD-STE100 Simplified Technical English with the project's ubiquitous76 language, effects over internals, "done" / "needs you" / "caveats"77 kept separate.7879When installing these rules, if a skill in80[skill.deps.json](./skill.deps.json) isn't installed, prompt the user to81run its install command first.8283Done when every applicable rule exists in the host's native checked-in84instruction location, written from its template and generalized to this85project, every skill-gated rule carries the installed-check wording inline,86and `CODING_STANDARDS.md` exists at the root with its header and every seeded87section approved by the human.