
Code Review
Run an automatic pre-review gate so non-trivial diffs are tied to ADRs and specs before your agent executes a full code review.
Overview
ADR Gate is an agent skill most often used in Ship (also Operate) that enforces Architecture Decision Record and spec linkage before non-trivial code review proceeds.
Install
npx skills add https://github.com/alinaqi/claude-bootstrap --skill code-reviewWhat is this skill?
- 5-step gate protocol from changed-files detection through review with ADR context
- Trivial-change bypass for README, lockfiles, snapshots, comment-only, and patch dependency bumps
- Bash-oriented trivial-file pattern detection before the gate applies
- Discovers linked ADRs and specs or reverse-engineers an ADR draft for the user
- Runs automatically before every /code-review invocation (user-invocable: false)
- Explicit trivial vs non-trivial change classification in Step 1
Adoption & trust: 614 installs on skills.sh; 691 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You are about to run a code review on a meaningful diff without any linked ADR or spec explaining the architectural intent.
Who is it for?
Solo builders using /code-review who already write or want lightweight ADRs and need the agent to stop and link context on structural changes.
Skip if: Repos where every change is intentionally undocumented, or diffs that are exclusively trivial hygiene with no API or routing impact.
When should I use this skill?
Automatically before every /code-review invocation
What do I get? / Deliverables
Review runs with discovered or draft ADR and spec context injected, or trivial changes skip the gate and go straight to review.
- ADR and spec context injected into review
- Proposed ADR draft when no linkage exists
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Code review is a Ship-phase habit; this skill is the enforced checkpoint immediately before review engines run on real product changes. It sits in review because its only job is to classify diffs, discover or draft ADRs, and inject that context into the review pass—not to author features or deploy.
Where it fits
Gate classifies a new API route file as non-trivial, finds an ADR, and passes it into the review prompt.
Dependency lockfile-only PR is marked trivial and skips ADR discovery.
Post-incident fix touches routing; gate drafts a proposed ADR before review approves the patch.
Mid-sprint refactor without a written ADR triggers reverse-engineered draft for you to accept before merge review.
How it compares
Use as a mandatory pre-flight gate instead of asking the model to review a raw git diff with no decision history.
Common Questions / FAQ
Who is ADR Gate for?
Indie and solo developers who invoke automated code review and want architectural decisions attached before critique on non-trivial patches.
When should I use ADR Gate?
Automatically before /code-review on Ship when files change beyond README, locks, or test-only tweaks; also in Operate when reviewing production hotfixes that alter APIs or structure.
Is ADR Gate safe to install?
It orchestrates local classification and context discovery around your repo; review the Security Audits panel on this Prism page before enabling it in CI or shared workflows.
SKILL.md
READMESKILL.md - Code Review
# ADR Gate — Pre-Review Spec Enforcement Every code review must have architectural context. This gate runs before review engines and ensures changes are linked to ADRs (Architecture Decision Records) and specs. --- ## Gate Protocol Before any review engine runs, execute this sequence: ``` Changed files detected | v [1. Classify change scope] | v Trivial? ──YES──> Skip gate, proceed to review | NO v [2. Discover linked ADRs + specs] | v Found? ──YES──> Inject into review context | NO v [3. Reverse-engineer ADR draft] | v [4. Present draft to user OR auto-tag as "proposed"] | v [5. Proceed to review with ADR context] ``` --- ## Step 1: Classify Change Scope Exempt trivial changes from ADR requirements: ### Trivial (Skip Gate) - Typo fixes, comment edits, whitespace - Dependency version bumps (patch/minor) - Test-only changes that don't alter behavior - Config value changes (not structural) - Changelog/README updates ### Detection ```bash # If ALL changed files match trivial patterns, skip gate TRIVIAL_PATTERNS="CHANGELOG|README|\.lock$|\.md$|__snapshots__|\.test\.|\.spec\." ``` ### Non-Trivial (Gate Applies) - New files or deleted files - Changes to API routes, models, schemas - Security-related files (auth, crypto, permissions) - Architecture changes (new services, new patterns) - Database migrations --- ## Step 2: Discover ADRs + Specs Search in order — stop when context is sufficient: ### 2a. Check `docs/adr/` directory ```bash # List existing ADRs ls docs/adr/*.md 2>/dev/null # Search ADR content for references to changed files/modules grep -rl "module_name\|feature_name" docs/adr/ 2>/dev/null ``` ### 2b. Query iCPG (if indexed) ``` search_graph(name_pattern="*", label="ReasonNode") ``` Match ReasonNodes to changed file paths. If iCPG is not available, skip — this step is optional. ### 2c. Check `_project_specs/` ```bash # Search specs for references to the changed area grep -rl "feature_name\|module_name" _project_specs/ 2>/dev/null ``` ### 2d. Check git history for decision context ```bash # Get commit messages that explain WHY for changed files git log --oneline -10 -- <changed_files> git log --grep="decision\|chose\|instead of\|trade-off" -5 ``` ### 2e. Check issue tracker references ```bash # Look for ticket references in recent commits git log --oneline -20 | grep -oE "(#[0-9]+|[A-Z]+-[0-9]+)" # Check PR description if in PR context gh pr view --json body -q .body 2>/dev/null ``` ### Discovery Output Produce an ADR context block: ```markdown ## ADR Context for Review ### Linked ADRs - ADR-0003: Use Zustand for state management (accepted) - ADR-0007: Atomic file writes for editor (accepted) ### Linked Specs - _project_specs/phase-08-editor.md - GitHub Issue #25: In-browser file editor ### Relevant Decisions (from git history) - "Chose atomic write via temp+rename over direct write" (commit abc123) ### Coverage - 3/5 changed files have ADR linkage - 2 files have no documented decision context ``` --- ## Step 3: Reverse-Engineer ADR Draft When ADRs are missing for non-trivial changes, draft one: ### Input Sources 1. `git log --follow -5 <file>` — commit messages for intent 2. `git diff` — what actually changed 3. File content — module structure, imports, patterns 4. PR description (if available) ### Draft Template ```markdown # NNNN - [Auto-generated title from change description] **Status:** proposed **Date:** [today] **Spec:** [discovered spec or "none — needs linking"] **Deciders:** [git author] ## Context [Extracted from commit messages and PR description] ## Decision [Inferred from the code changes — what pattern/library/approach was chosen] ## Consequences [Inferred trade-