一键导入
rai-architecture-review
Evaluate design proportionality using Beck's four rules. Use after implementation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Evaluate design proportionality using Beck's four rules. Use after implementation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Interactive adapter setup for Jira and Confluence. Detects available backends, discovers projects/spaces, generates validated YAML config. 3-4 questions max.
Root cause analysis using the method best suited to the bug. Phase 3 of bugfix pipeline.
Push branch, create MR, verify artifacts complete. Phase 7 of bugfix pipeline.
Execute fix tasks with TDD and all validation gates. Phase 5 of bugfix pipeline.
Decompose fix into atomic TDD tasks. Phase 4 of bugfix pipeline.
Retrospective, pattern extraction, and process improvement. Phase 6 of bugfix pipeline.
| name | rai-architecture-review |
| description | Evaluate design proportionality using Beck's four rules. Use after implementation. |
| allowed-tools | ["Read","Grep","Glob"] |
| license | MIT |
| metadata | {"raise.work_cycle":"story, epic","raise.frequency":"on-demand","raise.prerequisites":"story-implement (story scope), last story complete (epic scope)","raise.version":"1.0.0","raise.visibility":"public"} |
Evaluate whether code is necessary and proportional using Beck's four rules of simple design. Core question: "Could we achieve the same outcome with less?"
| Condition | Action |
|---|---|
After /rai-story-implement | Run with story scope |
| After last story in epic | Run with epic scope |
| Accumulated complexity feels disproportionate | Run on-demand |
Inputs: Scope (story or epic), design doc, changed files from git diff.
Before reviewing code, load what the design intended and what the codebase has learned:
design.md or scope.md) — what was the intended approach?rai graph query "patterns for {affected_modules}" --types pattern
rai pattern list --context "{module_keywords}"
This context informs every subsequent step: you can't judge proportionality without knowing intent, and you can't catch regressions without knowing established patterns.
Detect the project language and filter by appropriate extensions:
.raise/manifest.yaml for project.language or project.project_type# Story scope: files changed vs parent branch
git diff --name-only $(git merge-base HEAD <parent-branch>)..HEAD -- '<extensions>'
# Epic scope: all files changed vs development branch
git diff --name-only $(git merge-base HEAD <dev-branch>)..HEAD -- '<extensions>'
Replace <extensions> with language-appropriate patterns (e.g., '*.py' '*.pyi' for Python, '*.ts' '*.tsx' for TypeScript, '*.cs' for C#).
Read every changed file and the design doc. You cannot judge proportionality without intent context.
| # | Heuristic | Red Flag |
|---|---|---|
| H1 | Single Implementation | Protocol/ABC with exactly one concrete implementation, no documented consumer |
| H2 | Wrapper Without Logic | Class delegates all work without adding behavior |
| H3 | Unused Parameters | Parameters accepted but never used in function body |
| H4 | Test-Only Consumers | Public function/class used exclusively by test code |
| H5 | Dead Exports | Public API includes names no consumer imports (e.g., __all__ in Python, export in TS, public in C#) |
When a heuristic triggers, check: "Does the design doc justify this?" If yes, note as Observation.
| # | Heuristic | Red Flag |
|---|---|---|
| H6 | Indirection Depth | >2 layers of delegation for a simple operation |
| H7 | Abstraction-to-LOC Ratio | More scaffolding than logic |
| H8 | Configuration Over Convention | Configurable with only one valid value in practice |
| # | Heuristic | Red Flag |
|---|---|---|
| H9 | Semantic Duplication | Same concept expressed differently in multiple places |
| H10 | Pattern Duplication | Same structural problem solved differently across modules |
| H11 | Change Reason Count | Module changes for >1 unrelated reason |
| H12 | Import Fan-In | File imports from 5+ distinct packages for one function |
Skip for story scope. Cross-module heuristics:
| # | Heuristic | Red Flag |
|---|---|---|
| H13 | Orphaned Abstractions | Protocol from early story still has ≤1 implementor at epic end |
| H14 | Coupling Direction | Stable core imports from volatile/new module |
| H15 | Cyclic Dependencies | Circular import paths between modules |
| H16 | Shotgun Surgery | One logical change touches 5+ files across 3+ directories |
Verify the implementation follows the lean principles established in design:
| # | Check | Red Flag |
|---|---|---|
| L1 | MVP delivered | Implementation exceeds what design specified — gold-plating |
| L2 | Design followed | Implementation diverges from design without documented ADR |
| L3 | Pattern compliance | Known patterns (PAT-E-*) exist for this problem but weren't used |
| L4 | No speculative code | Features built for hypothetical future requirements (YAGNI) |
| L5 | Simplest approach | A simpler implementation would achieve the same outcome (KISS) |
For each L-finding: cite the pattern or design decision that was violated.
## Architecture Review: {id} (scope: {story|epic})
### Critical (fix before merge)
### Recommended (simplify before next cycle)
### Questions (require human judgment)
### Observations (patterns noted)
### Verdict
- [ ] PASS / PASS WITH QUESTIONS / SIMPLIFY
Every finding: specific file:line, heuristic ID, proportionality concern, concrete simplification.
| Item | Destination |
|---|---|
| Review findings | Presented inline, saved if requested |
| Verdict | PASS, PASS WITH QUESTIONS, or SIMPLIFY |
| Next | /rai-story-review (story) or /rai-epic-close (epic) |
work/research/architecture-review//rai-quality-review (correctness), /rai-story-review (retrospective)