humansys/raise/rai-architecture-review
Claude Code and agent skill by humansys/raise
- community
Checking that the SKILL.md file is still in the repository.
Evaluate design proportionality using Beck's four rules. Use after implementation.
Install
npx vskill@latest install humansys/raise/rai-architecture-reviewSKILL.md
Architecture Review
Purpose
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?"
Mastery Levels (ShuHaRi)
- Shu: Apply all heuristics systematically, explain each finding
- Ha: Focus on highest-signal heuristics for the scope, skip low-risk areas
- Ri: Pattern-match to known anti-patterns, minimal ceremony
Context
| Condition | Action | |
|---|---|---|
After /rai-story-implement | Run with story scope | |
| After last story in epic | Run with epic scope | |
After /rai-bugfix-plan | Run with bugfix scope — input is analysis.md + archivos en puntos de cambio (no git diff: no hay código escrito aún) | |
| Accumulated complexity feels disproportionate | Run on-demand |
Inputs: Scope (story, epic, or bugfix), design doc, changed files from git diff (story/epic) or analysis.md + files at change points (bugfix).
Steps
Step 1: Load Design Context & Patterns
Before reviewing code, load what the design intended and what the codebase has learned:
- Code orientation: Load SA-ranked code symbols for the current branch:
``bash rai session context -s code_context -p . `` Returns ~20 symbols ranked by structural proximity to active work modules. Empty result is valid. Use these as starting points — not exhaustive scope.
- Read the design doc (
design.mdorscope.md) — what was the intended approach? - Query the knowledge graph for patterns in affected modules:
Use raise_graph_query MCP tool with cwd="{project_or_worktree_path}", query="patterns for {affected_modules}". If MCP tools are not available, fall back to: rai graph query "patterns for {affected_modules}" --types pattern
Use raise_pattern_query MCP tool with keywords="{module_keywords}", cwd="{project_or_worktree_path}". If MCP tools are not available, fall back to: rai graph query "{module_keywords}" --types pattern
- Load established patterns (PAT-E-*) — these are proven solutions. Deviations need justification.
JIT: For deeper code exploration beyond the orientation map, query the graph directly:```bashrai graph query "symbol_name" --types symbol --limit 10rai graph query "module_name" --module mod-raise-cli--sessionrai graph query "callers of function_name" --types symbol```Use--file path/to/file.pyto scope results to a specific file.
This context informs every subsequent step: you can't judge proportionality without knowing intent, and you can't catch regressions without knowing established patterns.
Step 2: Identify Scope and Changed Files
Detect the project language and filter by appropriate extensions:
- Check `.raise/manifest.yaml` for
project.languageorproject.project_type - Fallback: Scan extensions of changed files and pick the dominant language
Replace <extensions> with language-appropriate patterns (e.g., '*.py' '*.pyi' for Python, '*.ts' '*.tsx' for TypeScript, '*.cs' for C#).
Bugfix scope: No code has been written yet. Load work/bugs/{issue_key}/analysis.md, extract the files identified as change points, and read them. The question is: "Is the proposed fix approach proportional to the problem?"
Read every changed file and the design doc. You cannot judge proportionality without intent context.
Step 3: Necessity Audit (YAGNI — Beck Rule 4)
| # | 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.
Step 4: Proportionality Audit (KISS — Beck Rules 2+4)
| # | 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 |
Step 5: Duplication & Responsibility (Beck Rules 2-3)
| # | 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 |
Step 6: Agent-Authored Drift Audit
Check for agent-specific drift patterns at both story and epic scope. If $DRIFT_CATALOG is declared in manifest, reference it §1 for full definitions — do not copy inline. If absent, use the inline AG1–AG6 table below as the sole reference (tier-3: silent skip). If $DRIFT_HOTSPOTS output was printed above, note which changed modules (if any) match top-ranked entries.
| # | Heuristic | Signal | |
|---|---|---|---|
| AG1 | Authorization fan-out | Auth-related changes touching ≥3 downstream modules without a consolidating aggregator | |
| AG2 | Clone amplification | Duplicate logic blocks in ≥2 new locations relative to surrounding modules | |
| AG3 | Hallucinated-API residue | Symbol references that don't resolve; persistent across ≥2 commits | |
| AG4 | Context-window planning | Fan-out of modified set has orphan edges — modules touched but not reconciled | |
| AG5 | Vulnerability density | CWE-class patterns in agent-authored hunks (auth, injection, secrets) | |
| AG6 | Over-specification | Conditionals keyed on literal constants from prompt examples; re-implementation of existing capability |
"No agent-authored drift detected" is always valid — do not invent findings.
Migration integrity check — runs once for every Alembic configuration whose configured script_location/versions/ contains a changed migration. Preserve the changed-path → configuration association: hybrid repositories may require more than one check.
| Result | Action | |
|---|---|---|
| 0 migration files changed | Skip silently | |
| 1 head | ✓ Continue | |
| >1 heads | BLOCK — create merge migration before proceeding | |
| Changed migration has no applicable config | Record the warning in the review output; do not claim migration integrity was verified |
Step 7: Portfolio Impact Check
Using the modules already identified in Step 6 drift analysis, cross-reference against the portfolio cartridge to detect concurrent initiatives that may conflict.
For each touched module, run:
Extract the portfolio_impact field from the JSON output. Handle each case:
| Result | Action | |
|---|---|---|
change_mode: breaking initiative in same module | Add ## Portfolio Impact section to AR report with severity HIGH; list initiative key, module, and nature of conflict | |
change_mode: evolutionary initiative in same module | Mention as informative context in the AR report; do NOT block | |
| Command fails or returns no portfolio nodes | Print advisory: portfolio cartridge no disponible — run \rai portfolio cartridge generate\``; continue (fail-open, do NOT block the AR) | |
| No concurrent initiatives | Note: "No concurrent portfolio initiatives detected" |
Fail-open rule: A missing or unavailable portfolio cartridge must never block the AR. This check is informative, not a gate.
Step 8: Systemic Audit (Epic Scope Only)
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 |
Step 9: Lean Compliance Audit
Verify the implementation follows the lean principles established in design:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpackages/raise-cli/src/raise_cli/skills_base/rai-architecture-review/SKILL.md
Popularity
- Repository stars
- 71
- Repository forks
- 8
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/humansys/raise/rai-architecture-review)