feat(#232): adopter handbooks consumed by Rex during code review#233
Conversation
Introduces a `handbooks/` directory at the ops fork root for
adopter-authored coding standards that Rex consults during PR review,
layered on top of the framework's generic rules in `.claude/rules/`.
Discovery is by path-convention (no YAML frontmatter); enforcement
defaults to advisory with explicit blocking opt-in via the literal
`ENFORCEMENT: blocking` marker phrase at the top of a file.
Components:
- handbooks/README.md — index + discovery rules + advisory/blocking
convention + authoring guidance + the four sample-handbook table
- handbooks/architecture/clean-architecture-layers.md — DDD layering
(advisory, always-load)
- handbooks/architecture/migration-safety.md — schema-migration
backwards-compat rule (BLOCKING, always-load) — demonstrates the
enforcement opt-in shape
- handbooks/language/typescript/strict-mode.md — TS strict-mode + no
bare `any` (advisory, loads on **/*.{ts,tsx} diff match)
- handbooks/general/commit-message-quality.md — commit-message WHY-
not-WHAT discipline (advisory, always-load)
- .claude/agents/code-reviewer.md — new § 8 "Adopter Handbooks":
discovery (path-convention), enforcement (advisory vs blocking
marker), what-to-surface, Handbook Findings section in the review
output template, new Rules entry #9 codifying the layer
- CLAUDE.md — Quick Reference + framework integration table updated
to surface handbooks/ alongside .claude/rules/
Decision rationale: docs/agdr/AgDR-0020-adopter-handbooks-for-rex.md
captures all five load-bearing decisions (scope, discovery,
format, sample-scaffold-per-feature, enforcement default) with
options-considered tables.
Closes #232
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
atlas-apex
left a comment
There was a problem hiding this comment.
Code Review: PR #233
Commit: 0ea3bdfb308a6a7d2c651dc767485f66791edac1
Summary
Introduces a handbooks/ layer at the ops fork root for adopter-authored coding standards consumed by Rex (the code-reviewer agent), layered on top of the framework's generic .claude/rules/. Discovery is by path-convention (no YAML frontmatter); enforcement defaults to advisory, with explicit opt-in to blocking via the literal phrase ENFORCEMENT: blocking at the top of a handbook file. Ships 4 sample handbooks demonstrating each shape, updates Rex's agent definition with a new § 8, and updates CLAUDE.md in two places.
Checklist Results
- Architecture & Design: Pass
- Code Quality: Pass
- Testing: Pass (docs-only PR; testing is the author's "Reviewer can spot-check…" steps in the PR body)
- Security: Pass (no executable code paths introduced)
- Performance: Pass (Rex's per-PR token cost is bounded by diff-match for
language/<lang>/) - PR Description & Glossary: Pass
- Technical Decisions (AgDR): Pass — AgDR-0020 linked, covers all 5 load-bearing decisions
- Adopter Handbooks: N/A (this PR introduces the layer; doesn't apply retroactively)
Verification of asks
-
AgDR-0020 quality: Pass. All five decisions (A scope, B discovery, C format, D sample-scaffold, E enforcement) are present with
## Options Consideredtables and 3 options each. Chosen option called out with bold + rationale paragraph. Consequences section honestly discusses v1 trade-offs (no per-project layering, no/handbookskill, magic-string marker risk, Rex's prompt growth bound). -
Path-convention consistency across three sources: Pass. All three describe the same convention —
handbooks/architecture/*.mdalways-load,handbooks/general/*.mdalways-load,handbooks/language/<lang>/*.mddiff-matched by extension. Wording and examples align. -
Blocking marker spec consistency: Pass.
handbooks/README.md§ "Enforcement" specifiesENFORCEMENT: blockingat the top of the file. Rex agent doc § 8 cites the same literal phrase. The blocking sample (handbooks/architecture/migration-safety.md) hasENFORCEMENT: blockingas its actual first line (verified). -
Sample handbooks are real, not boilerplate: Pass. Each of the 4 has a concrete "What Rex flags" trigger list (e.g. migration-safety enumerates
DROP COLUMN,RENAME COLUMN, narrowingALTER COLUMN, etc.; strict-mode listsanywithout justification,@ts-ignore, unsafeasnarrowing) AND a "What's NOT a violation" false-positive guard (e.g. type-only cross-layer imports,unknown, additive migrations, revert commits). No platitudes — each entry is actionable in code review. -
Rex agent doc structural integrity: Pass. Section ordering verified —
### 1.through### 7. Technical Decisions (AgDR)then### 8. Adopter Handbooks. Output Format ordering:### Issues Found(line 322) →### Handbook Findings(line 325) →### Suggestions(line 328) →### Verdict(line 331). New Rules entry #9 sits after #8 and adds a non-conflicting handbook-layer rule. -
CLAUDE.md updated in two places: Pass. Framework integration table at line 188 (peer to Rules row) and Quick Reference at line 271 (peer to
Rules (modular, framework-wide)). Both surfacehandbooks/as a peer to.claude/rules/. -
PR body has Summary, Testing, Glossary: Pass. All three present. Glossary covers handbook, path-convention discovery,
ENFORCEMENT: blockingmarker, advisory/blocking handbooks, Handbook Findings section, diff-matched language handbook, sample handbooks — 8 entries covering the new vocabulary. -
Commit message: Pass.
feat(#232): adopter handbooks consumed by Rex during code reviewmatchestype(#NN): description. Body explains components and decision artefact.Closes #232present. Co-Authored-By line present.
Issues Found
None.
Suggestions (non-blocking)
handbooks/README.md§ "If you need a fourth bucket…" tells adopters to update Rex's discovery logic in the agent file. Since the agent doc § 8 already specifies the unknown-directory fallback ("Default to always-load if you don't recognise the directory; flag in your review that the directory convention is undocumented"), the README sentence under-promises the framework's actual behaviour. Tightening this in a follow-up would let adopters add new buckets without touching agent prose.- The
CLAUDE.mdRules row was updated to "10 modular rule files" listing "plan mode" as a new entry, but no plan-mode rule file appears in this PR's diff. If this is leftover from a sibling PR, leave it; if accidentally introduced here, it's the only meta-inconsistency I noticed. - Consider mentioning in
handbooks/README.mdthat the<other>directory unknown-bucket fallback is documented in the agent file, so adopters know the framework won't silently drop their new directory.
Verdict
APPROVED
The handbooks layer is well-scoped, consistently specified across all three sources, and the four sample handbooks are substantive enough to ship as defaults without embarrassment. The advisory-first / blocking-opt-in default is the right call for adopter onboarding. AgDR-0020 captures the design rationale honestly, including the v1 trade-offs.
I cannot self-approve via --approve (own PR), so this comes through as a --comment review with the APPROVED verdict explicit above. Per the agent spec, I will write the Rex approval marker for the merge gate.
Reviewed by Rex (Code Reviewer Agent)
Reviewed commit: 0ea3bdfb308a6a7d2c651dc767485f66791edac1
Rex flagged the count mismatch in his review of #233. There are actually 11 rule files in .claude/rules/ (the previous list also omitted leak-protection). One-line fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three handbook samples tripped markdownlint: - migration-safety.md: list-inside-blockquote needs a blank `>` line before the list (MD032) - commit-message-quality.md: two adjacent blockquotes joined with `>` instead of a blank line (MD028) - strict-mode.md: same fix for three adjacent sample-finding blockquotes (MD028 x2) Pure formatting fix. No content change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
atlas-apex
left a comment
There was a problem hiding this comment.
Re-review: PR #233 (follow-up commits)
Commit: 0005960aa789dcb0aec01cb36590a6dfaf1536de
Verification
cc85e4e— CLAUDE.md rule count corrected from 10 → 11; alphabetised list now includesleak protection. Addresses my prior non-blocking suggestion. One-line content fix, no scope creep.0005960— Pure formatting fix (MD028/MD032) across 3 handbook samples: blank>line inserted between adjacent blockquotes / before list-in-blockquote. Zero content change verified.
CI
All three checks SUCCESS at HEAD: markdownlint-cli2, lychee, Verify Ticket ID.
Verdict
APPROVED — original verdict still applies. None of the load-bearing decisions (handbook scope, discovery, format, samples, enforcement) changed. Approval marker refreshed for new HEAD.
Reviewed by Rex (Code Reviewer Agent)
Reviewed commit: 0005960aa789dcb0aec01cb36590a6dfaf1536de
* feat(#232): adopter handbooks consumed by Rex during code review Introduces a `handbooks/` directory at the ops fork root for adopter-authored coding standards that Rex consults during PR review, layered on top of the framework's generic rules in `.claude/rules/`. Discovery is by path-convention (no YAML frontmatter); enforcement defaults to advisory with explicit blocking opt-in via the literal `ENFORCEMENT: blocking` marker phrase at the top of a file. Components: - handbooks/README.md — index + discovery rules + advisory/blocking convention + authoring guidance + the four sample-handbook table - handbooks/architecture/clean-architecture-layers.md — DDD layering (advisory, always-load) - handbooks/architecture/migration-safety.md — schema-migration backwards-compat rule (BLOCKING, always-load) — demonstrates the enforcement opt-in shape - handbooks/language/typescript/strict-mode.md — TS strict-mode + no bare `any` (advisory, loads on **/*.{ts,tsx} diff match) - handbooks/general/commit-message-quality.md — commit-message WHY- not-WHAT discipline (advisory, always-load) - .claude/agents/code-reviewer.md — new § 8 "Adopter Handbooks": discovery (path-convention), enforcement (advisory vs blocking marker), what-to-surface, Handbook Findings section in the review output template, new Rules entry #9 codifying the layer - CLAUDE.md — Quick Reference + framework integration table updated to surface handbooks/ alongside .claude/rules/ Decision rationale: docs/agdr/AgDR-0020-adopter-handbooks-for-rex.md captures all five load-bearing decisions (scope, discovery, format, sample-scaffold-per-feature, enforcement default) with options-considered tables. Closes #232 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(#232): correct rule-file count in CLAUDE.md (10 → 11) Rex flagged the count mismatch in his review of #233. There are actually 11 rule files in .claude/rules/ (the previous list also omitted leak-protection). One-line fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(#232): markdownlint MD028/MD032 in handbook samples Three handbook samples tripped markdownlint: - migration-safety.md: list-inside-blockquote needs a blank `>` line before the list (MD032) - commit-message-quality.md: two adjacent blockquotes joined with `>` instead of a blank line (MD028) - strict-mode.md: same fix for three adjacent sample-finding blockquotes (MD028 x2) Pure formatting fix. No content change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: me2resh <ahmed.abdelaliem@gmail.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
handbooks/directory at the ops fork root for adopter-authored coding standards consumed by Rex during PR review, layered on top of the framework's generic rules in.claude/rules/handbooks/architecture/*.md+handbooks/general/*.mdalways-load;handbooks/language/<lang>/*.mdloads only when the PR diff includes files matching<lang>'s extensionsENFORCEMENT: blockingat the top of a handbook file.claude/agents/code-reviewer.md) gains § 8 "Adopter Handbooks" with discovery rules, advisory/blocking convention, what-to-surface, and a### Handbook Findingssection in the review output templateCLAUDE.mdQuick Reference and framework integration table updated to surfacehandbooks/next to.claude/rules/Why this matters
Before this PR, adopter coding standards lived in three places: ad-hoc Slack messages, wiki pages nobody re-reads, and inline PR comments that disappear with the PR. Rex enforced framework-wide rules but had no way to know about your team's patterns ("never use floats for currency", "all DB queries go through the repository layer", "Tailwind utility class order is alphabetised").
This PR closes that gap. Adopters drop a markdown file under
handbooks/, Rex picks it up automatically on the next review, and the standard becomes enforced in CI rather than enforced by tribal memory. No code change needed to teach Rex a new rule — adopter authors a handbook, commits, done.The four shapes (architecture/always-load, architecture/blocking, language/diff-matched, general/always-load) are the four shapes that cover most company coding standards. Per AgDR-0020, the design intentionally trades flexibility (no per-project layering, no YAML frontmatter, no per-feature scaffold) for adopter ergonomics — a one-file-and-done shape that authors can write without learning a schema.
Testing
handbooks/.claude/agents/code-reviewer.md§ 8 — verify the path globs match the conventions described inhandbooks/README.mdENFORCEMENT: blockingat the top ofhandbooks/architecture/migration-safety.md) is the literal phrase Rex's prompt instructs him to look for**/*.tsfile in any registered project, confirm Rex's review comment cites both framework rules AND the typescript-strict-mode handbook; open another PR touching only**/*.pyfiles (no Python handbooks shipped yet), confirm Rex skips the typescript handbookGlossary
handbooks/containing an adopter-authored coding standard. Consumed by Rex (the code-reviewer agent) during PR review alongside the framework's generic rules in.claude/rules/.applies_to:glob to maintain. The directory IS the targeting metadata.architecture/andgeneral/always-load;language/<lang>/loads on diff match.ENFORCEMENT: blockingmarkernit:/suggestion:comments. Verdict unaffected — APPROVED / COMMENT still valid.⛔ Handbook (blocking):. Verdict becomes REQUEST CHANGES.### Handbook Findingssection in Rex's review output, between### Issues Foundand### Suggestions. Groups violations by handbook, severity (blocking first), then file:line. Omitted when no handbooks loaded.handbooks/language/<lang>/that Rex loads only when the PR diff includes files of<lang>'s extensions. Keeps Rex's per-PR token cost bounded — Python-only PRs don't pay the TS handbook cost.🤖 Generated with Claude Code