claude-code-standards
The working rules, standards, agent roles and gate scripts behind how I build with Claude Code — rules that are enforced by exit codes, not by good intentions.

Purpose
Apply engineering practice to every change instead of once a quarter, keep agent cost low, and make the setup scale from no agents to a fourteen-role team.
The problem
An AI agent will cheerfully say it applied every practice. A coverage number can look fine because generated code inflated it, a gate can be skipped without anyone noticing, and a backup can exist without ever having been restored. Rules that only live in prose do not survive that.
What I built
- A short global rule file of 33 numbered rules and 24 numbered standards, with the rationale kept in a separate decision log so the always-loaded file stays small.
- A shared gate that runs the same steps locally and in CI: formatter, type check, build, tests, per-codebase coverage, secret scan, dependency audit, static analysis and a backward-compatibility scan. A step that did not run is reported as skipped and the result as incomplete, never green.
- Five operating modes, from no agents to a fan-out workflow, and 14 agent roles with a defined model tier each.
- A completeness-check protocol: every role closes its report with the command it ran, a mapping from each requested item to evidence and what it could not verify; missing evidence is sent back to the producer with a limit of two hand-backs.
- About 590 test functions for the gate scripts themselves, so the enforcement is tested too.
- Commit-time hooks that check guidance-file size and scan staged content for secrets and real project names, plus a plugin that exposes the modes as commands.
Features
- Five switchable operating modes, from no agents to a 14-role team with parallel fan-out.
- 14 role agents, each with an explicit model tier and tool limits.
- A shared gate that fails closed: a step that did not run is reported as skipped and the result as incomplete.
- Per-codebase coverage with an honest denominator, never averaged.
- A machine-checkable evidence block that every reporting role must close with.
- A hook that blocks destructive commands before they run.
- Plugin commands to apply the standards, audit a change and check production readiness.
- A live status board for long runs.
- Four written cases of what went wrong and which rule each one produced.
Stack
- Python
- Claude API
AI in this project
In the product
- The workflow itself is the AI use: it configures Claude Code and does not call a model API on its own.
- Fourteen role agents with a defined model tier (five Opus, eight Sonnet, one Haiku), tool limits and a report format.
- Five operating modes from no agents to a 14-role team; choosing the mode is the approval for that agent set.
- Layered review: a QA agent does the first pass, the orchestrator verifies critical findings, and every role closes with an evidence block (the command it ran, each requested item mapped to proof, what it could not verify). Missing evidence goes back to the producer, at most twice.
- A hook blocks force pushes, pushes to production branches, dropped tables and broad deletes before they run.
In how it was built
- 324 of 399 commits carry a Claude co-author trailer (Opus 5.5, Opus 5, Sonnet 5.5, Sonnet 5).
- The rules were written, and corrected, from four documented incidents: misreported coverage, false end-to-end failures, cost measurement and audit gaps.
Key flows
Steps
How a change reaches production
Step 1 of 5: Branch
Work starts on a branch off the development branch, one commit per task.
Step 2 of 5: Gate
The shared gate runs on every promotion; a skipped step makes the result incomplete.
Step 3 of 5: Evidence
Roles that others rely on attach the command they ran and what they could not verify; gaps go back to the producer.
Step 4 of 5: Promote
The assistant merges through the environments after a green gate; the final push to production stays with the human.
Step 5 of 5: Record
A new permanent rule is written to the rules or the decision log in the same turn.
Limitations
- A single-author setup in daily use; its effectiveness is self-reported, not independently measured.
- Cost figures are only partly measured, and several scripts have thinner test coverage than the rest.
- The repository ships no CI of its own; the gate is meant to be copied into each project.
- Many of the lessons come from client work that cannot be named, so a reader cannot re-verify them.
Want something like this?
Tell me about your project — I reply within two working days.
Start a project