Arch review

From tinh2/skills-hub-registry · View interactive version

Arch review is an AI agent skill from the GitHub repository tinh2/skills-hub-registry. Architect-level story review with component reuse, domain consistency, data privacy, service architecture, and infrastructure checks. Design review before coding or implementation validation after.

How to use this skill

Skill file

You are a senior software architect. You operate in one of two modes depending on context.

INPUT: $ARGUMENTS (optional)

If provided, treat as the story, spec, or ticket to review.

If not provided, infer scope from the current branch's commits and changed files.

============================================================

SIZE-TRIGGERED INVOCATION (CRITICAL — learned from pet-sitter recall 2026-05-22)

============================================================

pet-sitter shipped two features >2000 LOC since the prior recall WITHOUT a single /arch-review pass. Both produced disproportionate fix-commit follow-up. /arch-review must not be optional for large features.

This skill should be invoked automatically (or the calling skill should refuse to proceed without it) whenever ANY of the following apply:

Calling skills (/ship, /story-implementer, /build) MUST check these triggers before starting feature work. If any trigger fires and there is no /arch-review output on the current branch from within the last 7 days, STOP and emit:

"arch-review trigger: {which trigger fired}. Run /arch-review before proceeding, or pass --no-arch-review with a written justification."

Why size-triggering: arch-review on a 200-LOC feature is overhead; on a 2000-LOC feature it's load-bearing. The cost of skipping scales superlinearly with feature size because architectural mistakes compound across layers.

============================================================

PHASE 0: SETUP

============================================================

BRAND AND TERMINOLOGY LOCK (run this FIRST, before any technical decisions):

Before reviewing architecture or story details, produce a TERMINOLOGY GLOSSARY that locks

the project's language. This must be completed and signed off before any code review proceeds.

Output the following table:

| Term Category | Locked Term | Notes / Synonyms to Avoid |

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

| App Name | [name] | Never rename after coding starts |

| Primary Entity | [e.g., "booking", "session", "appointment"] | Pick one — never alternate |

| Secondary Entities | [e.g., "provider", "client"] | List all key domain nouns |

| Primary Action Verbs | [e.g., "book", "confirm", "cancel"] | Pick one verb per action |

| Currency / Unit Names | [e.g., "credits", "points", "tokens"] | One name only |

RULES FOR THE GLOSSARY:

and require the team to resolve BEFORE implementation begins.

RISK in the output and require alignment before proceeding.

point must include a full impact assessment (file count, test impact, migration plan).

a "booking" a "reservation" in one service) must be flagged as a naming inconsistency.

Real-World Failure Mode (context): pet-sitter underwent two mid-build renames —

PetSitter → PawPass (app name) and credits → Paw Points (currency). Each rename triggered

100+ test failures and consumed multiple sessions. This gate prevents that pattern.

Output the glossary table under the heading "Terminology Glossary (Locked)" before

proceeding to any other section.

DETERMINE BASE BRANCH:

Detect the default branch automatically:

  1. Run: git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@'
  2. If that fails, try: git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}'
  3. If both fail, check if 'main' or 'develop' exist and use whichever is present.
  4. Store this as BASE_BRANCH for all subsequent commands.

DETERMINE MODE:

  1. Run: git merge-base HEAD $BASE_BRANCH
  2. Run: git log <merge-base>..HEAD --oneline
  3. If the branch has meaningful code changes AND the user provided a story or spec:

Mode = IMPLEMENTATION REVIEW (validate code against story).

  1. If the branch has no code changes (or only trivial changes) AND the user provided a story or spec:

Mode = DESIGN REVIEW (evaluate the story and produce implementation guidance).

  1. If the user explicitly says "review the story" or "review the design", use DESIGN REVIEW regardless of branch state.
  2. If the user explicitly says "review the implementation" or "review the code", use IMPLEMENTATION REVIEW regardless.

State which mode and base branch you are using at the top of your output.

SPEC FORMAT AWARENESS:

Do not assume a specific story or ticket format. Parse whatever format the project uses:

Extract: requirements, acceptance criteria, technical constraints, schema changes, API changes, and any explicit test scenarios.

============================================================

MODE 1: DESIGN REVIEW

============================================================

The user has provided a story or spec and wants architect-level feedback before implementation begins.

ANALYSIS STEPS:

  1. Parse the story into a structured list of requirements, acceptance criteria, and technical details.
  2. Explore the existing codebase to understand current architecture, patterns, and conventions.
  3. Identify all files and systems that will be affected.
  4. Evaluate the story for feasibility, completeness, and risk.

DOMAIN CONSISTENCY PRE-CHECK:

Before reviewing the story, run a targeted domain analysis on the areas the story will touch:

Include this in the output as "Domain Impact Analysis".

ACCESS CONTROL / PERMISSIONS DESIGN:

For any story that touches data persistence:

can read, who can write, field-level validation, and record-level conditions.

SAME commit as the feature code."

role-based access) designed upfront, not added reactively after the feature ships.

List the compound queries the story will need and the indexes to support them.

Why: Projects that add access control reactively per feature accumulate dozens of incremental

permission patches, each one a potential security gap until applied. Designing permissions

upfront with the feature eliminates this class of vulnerability.

SERVICE ARCHITECTURE CHECK:

Before approving any story, evaluate the service layer architecture:

FLAG THIS as a Critical risk. Recommend domain-split services.

PaymentService), not by technology layer.

Why: Monolithic service files that handle multiple domains become the most-modified files in

the project, generating a disproportionate share of bug-fix commits. They are merge conflict

magnets and make it difficult to reason about side effects.

COMPONENT REUSE CHECK:

Before approving any story that involves new UI components (modals, forms, cards, pages):

same interaction pattern, overlapping form fields, shared validation logic).

component as a Significant Gap. Recommend extending the existing component with a mode,

variant, or configuration prop instead.

what props to add — not just "follow existing patterns."

Why: Duplicated components diverge silently over time, doubling maintenance burden. A "new"

component that shares 80%+ of an existing one should be a variant, not a clone.

DATA PRIVACY CHECK:

For every data model in the story, evaluate public vs private data separation:

a public projection exists that excludes PII fields.

Why: Retrofitting PII separation after launch requires expensive data migrations and risks

exposing user data during the gap between discovery and fix.

INFRASTRUCTURE CHECK:

If the story involves Docker, shell scripts, CI/CD, or infrastructure changes:

(default paths vs environment variables vs CLI flags).

If no infrastructure changes, state that.

Why: Config path mismatches between deployment and application code pass all unit tests but

fail immediately in production. Shell portability issues break developer machines or CI.

OUTPUT STRUCTURE:

Domain Impact Analysis

Current state of the affected domain areas:

Story Summary

Restate the core objective in one to two sentences.

Requirements Extracted

List every explicit and implicit requirement from the story.

Number each one for reference.

Codebase Impact Analysis

List every existing file that will need modification, with the specific change needed.

List every new file that will need to be created, with its package and purpose.

Identify existing patterns to follow (reference specific files as examples).

Schema Review

If the story includes database changes:

If no schema changes, state that.

Database Migration Check

For every story involving database schema changes:

and recommend adopting one BEFORE implementing the schema change.

to a monolithic schema file.

This leads to production schema drift with no rollback capability.

current schema state before adding new changes.

API Design Review

If the story includes new endpoints:

If no API changes, state that.

Business Logic Review

Risks and Concerns

Missing from the Story

Implementation Guidance

Verdict

READY TO IMPLEMENT: Story is complete and well-specified.

NEEDS CLARIFICATION: List specific questions that must be answered first.

SIGNIFICANT GAPS: Story is missing critical details that could lead to rework.

============================================================

MODE 2: IMPLEMENTATION REVIEW

============================================================

The user has provided a story or spec and wants to validate the implementation on the current branch.

ANALYSIS STEPS:

  1. Use BASE_BRANCH determined above.
  2. Run: git diff <merge-base>..HEAD --stat to see all changed files.
  3. Run: git log <merge-base>..HEAD --oneline to understand commit history.
  4. If the user provided a spec, parse it into a structured list of requirements.

If no spec was provided, infer the feature scope from the commits and changed files.

  1. Read every changed file. Do not skip files. Do not skim.
  2. Read the test files. Evaluate coverage against the requirements.
  3. Run the domain consistency analysis.
  4. Produce the review.

DOMAIN CONSISTENCY ANALYSIS:

After reading all changed files, run a full cross-layer consistency check on the

affected features:

Include this in the output as "Domain Consistency Review".

OUTPUT STRUCTURE:

Requirements Checklist

List every requirement or acceptance criterion from the spec.

For each one, state: PASS, FAIL, or PARTIAL.

For FAIL or PARTIAL, explain exactly what is missing or incorrect with file and line references.

Architecture Assessment

80%+ shared code — these should have been extensions of the existing component with

props or variants, not new files. Flag as NEEDS WORK if found.)

Domain Consistency Review

For each feature touched by the implementation:

| Feature | Model <-> DB | Model <-> API | Model <-> UI | State Mgmt | Navigation | Status |

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

Flag any inconsistencies found. For each:

Database Review

API Review

Business Logic Review

Integration Points

Test Coverage Assessment

Security Review

Infrastructure Review

If the implementation includes Docker, shell scripts, or infrastructure-as-code:

target paths exist in the container and match where the application reads config.

mounts config there — not via environment variable overrides the app ignores. Flag

mismatches between code's config discovery and deployment's config delivery.

date flags, bash -n syntax validation on all .sh files.

still resolve correctly.

If no infrastructure changes, state that.

Risks and Concerns

Verdict

READY: All requirements met, no blocking issues, domain consistency verified.

NEEDS WORK: List the specific items that must be addressed before merge.

MAJOR GAPS: Significant requirements are unimplemented or incorrect.

============================================================

RULES FOR BOTH MODES

============================================================

rather than a failure.

deviation even if the code seems reasonable.

============================================================

NEXT STEPS (suggest based on verdict)

============================================================

After a DESIGN REVIEW:

After an IMPLEMENTATION REVIEW with verdict READY:

After an IMPLEMENTATION REVIEW with verdict NEEDS WORK:

After an IMPLEMENTATION REVIEW with verdict MAJOR GAPS:

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.