AI coding agents (Claude Code, Codex, anything that reads AGENTS.md) obey architecture rules like dogma. So we put a Violate when: exit clause on every single rule — a rule without one does not ship. 21 rules, zero binaries, zero CI plugins. Our own bench on 10 small design tickets: 3/10 → 8/10 design-quality score, with an over-design probe proving the pack doesn't just trade one disease for another.
Repo: theBigGavin/arch-rule-packs
You have probably seen this exact commit in your own AI-assisted repo:
Here's the uncomfortable part: none of these are hallucinations. The agent is following your rules. Your AGENTS.md says "prefer composition over inheritance", "open for extension", "separate domain from infrastructure". The agent dutifully applies them, forever, at every scale — including scales where they cost 2 extra files per service and make the codebase 30% larger without removing a single coupling.
Every architecture rule is conditional, but almost nobody writes the condition. "Interfaces at vendor boundaries" is great advice — right up until you put an interface in front of Math.max() (not a joke; we have seen the equivalent in review).
When you give an LLM a rule without a condition, it optimizes for visibly obeying the rule, because that's what's checkable in its context window. The judgment call — does this rule apply here? — silently defaults to "yes", because "yes" produces visible artifacts (an interface, a layer, a factory) and "no" produces... nothing. Nothing looks like failure to a model trained to look like it did something.
Our pack ships each rule with two hard sections:
### R3 — Interfaces at vendor boundaries
**Apply:** HTTP clients, payment SDKs, model providers — anything with a
network or a vendor you can swap.
**Violate when:** the client has exactly one implementation AND no second
implementation is planned in this quarter. A concrete class is fine.
Delete the interface the day the second implementation appears.
Two properties make it work:
Violate when: is machine-checkable prose.
We ran our own dogfood bench (public in bench/): 10 small design tickets — each a one-paragraph task a coding agent would plausibly get — scored blind on design quality by a hidden check that evaluates the design, not the tests. Same model, same tickets, one arm with the pack in AGENTS.md, one without.
| Arm | Design-quality score |
|---|---|
| No pack | 3/10 |
| arch-rule-packs | 8/10 |
| Over-design probe (tickets that punish speculative abstraction) | passes in both arms |
We want to be straight with you about what this is and isn't:
curl -fsSL -o AGENTS.md https://raw.githubusercontent.com/theBigGavin/arch-rule-packs/main/AGENTS.md
Or clone it and pick rules: each file in rules/ is standalone. 21 rules, each with Apply: / Violate when:. MIT.
Repo: theBigGavin/arch-rule-packs — if you've watched your agent invent a factory for a singleton, the bench README has the 10 tickets; open a PR with your score on your model. We collect them.