Architecture review

From athola/claude-night-market · View interactive version

Architecture review is an AI agent skill from the GitHub repository athola/claude-night-market. Assesses architecture decisions, ADR compliance, and coupling. Use when evaluating design changes or validating structural decisions before merging.

How to use this skill

Skill file

Testing

Run pytest plugins/pensive/tests/skills/test_architecture_review.py to verify review logic.

Architecture Review Workflow

Architecture assessment against ADRs and design principles.

Quick Start

/architecture-review

When To Use

When NOT To Use

skills

skills

Progressive Loading

Load modules based on review scope:

Load all modules for full reviews. For focused reviews, load only relevant modules.

Required Progress Items

  1. arch-review:context-established: Repository, branch, motivation.
  2. arch-review:adr-audit: ADR verification and new ADR needs.
  3. arch-review:interaction-mapping: Module coupling analysis.
  4. arch-review:invariant-check: Invariant conflict detection and 3-option analysis.
  5. arch-review:principle-checks: LoD, security, performance.
  6. arch-review:ceremony-audit: Mapping layers that never diverge.
  7. arch-review:risks-actions: Recommendation and follow-ups.
  8. arch-review:findings-verified

Workflow

Step 1: Establish Context (`arch-review:context-established`)

Confirm repository and branch:

pwd
git status -sb

Document:

Step 2: ADR Audit (`arch-review:adr-audit`)

Load: modules/adr-audit.md

Step 3: Interaction Mapping (`arch-review:interaction-mapping`)

Load: modules/coupling-analysis.md

Step 3.5: Invariant Conflict Detection (`arch-review:invariant-check`)

Before checking principles, identify whether the changes

conflict with existing design invariants. This is the

highest-judgment step in architecture review: models

get this wrong more often than any other call.

Identify existing invariants:

  1. Scan ADRs for recorded decisions still in "accepted"

status

  1. Check module boundaries (are imports crossing layers

that previously didn't?)

  1. Check data flow direction (does data now flow in a

new direction?)

  1. Check API contracts (are public interfaces changing

shape?)

  1. Check structural patterns (is a new pattern being

introduced alongside an existing one?)

# Detect boundary crossings in changed files
git diff --name-only | while read f; do
  head -20 "$f" 2>/dev/null | rg "^(import|from|use |require)" || true
done

When a conflict is detected:

Do NOT recommend a resolution. Present the three options

and escalate to human judgment:

| Option | When Right | When Wrong |

|--------|------------|------------|

| Preserve invariant (reject feature) | Invariant simplifies many things; feature is marginal | Feature is genuinely needed and invariant is stale |

| Layer on top (add inelegantly) | Feature is needed; invariant still valuable; imperfection is OK | Layering creates a maintenance trap that will compound |

| Revise invariant (change the design) | Genuine new learning invalidates the original reasoning | You're "cleaning up" a decision you don't fully understand |

Output format:

### Invariant Conflicts

[I1] **[Invariant name]** — [what decision it represents]
- **Location**: file.py:42
- **Anchor**: `verbatim source text at line 42`
- **Conflict**: [what change clashes]
- **Options**: Preserve / Layer / Revise
- **Recommendation**: ESCALATE TO HUMAN
- **Risk if wrong**: [what compounds]

Why this matters: Bad invariant decisions compound.

After a few wrong calls the codebase becomes

unsalvageable. This is a judgment problem rather than a

context problem: the agent should report it and leave the decision to a

human.

Step 4: Principle Checks (`arch-review:principle-checks`)

Load: modules/principle-checks.md

Step 4.5: Ceremony Audit (`arch-review:ceremony-audit`)

Load: modules/ceremony-audit.md

Coupling analysis (Step 3) finds boundaries that leak. This step finds the

opposite failure: boundaries that cost something and separate nothing.

Each finding must name the need the ceremony serves today. If no current

need can be named, the ceremony is the finding.

Do not flag mappers at an IO boundary. They are load-bearing even when

they look like passthroughs, because they stop future internal fields from

escaping. See the counter-signal in the module.

Step 5: Risks and Actions (`arch-review:risks-actions`)

Summarize using imbue:diff-analysis/modules/risk-assessment-framework:

List follow-ups with owners and dates.

Provide recommendation:

Architecture Principles Checklist

Coupling

Cohesion

Layering

Invariants

Evolution

Verify Findings Are Grounded (`arch-review:findings-verified`)

Write findings to .review/findings.json, run the citation verifier

(Skill(imbue:review-core) Step 5), and drop or label UNVERIFIED any

the verifier rejects.

Exit Criteria

invariant conflicts surfaced, principle checks run, risks and actions

documented.

confirmed by citation_verifier.py (exit 0), or unverified findings

were dropped or labeled UNVERIFIED.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.