skills/arch-review/SKILL.md
Use this skill whenever the user asks for an architectural review of existing code — checking clean architecture boundaries, dependency direction, transaction boundaries, business logic leakage, circuit breaker presence, and value-object/primitive discipline in a Java + Spring Boot + Modulith codebase. ALWAYS trigger on: "review architecture", "arch review", "clean architecture check", "is this well structured", "check module boundaries", "check dependencies", "dependency direction", "domain leakage", "does this follow clean architecture", "check the hexagonal", "ports and adapters check". Implicit triggers: user shows a controller with business logic inline, user shows an entity exposed directly from a REST response, user mentions "this feels messy", user asks about coupling between modules, user wants to know if a refactor is worthwhile. Complements `code-audit` (which is breadth-first code quality) by being a focused architectural-invariants check. Stack: Java 25 + Spring Boot 4 + Spring Modulith 2.x + Spring Data JDBC/JPA. Produces a findings report with severity, affected files, proposed fixes, and a dependency direction graph. Uses ArchUnit assertions where possible for machine-checkable invariants, otherwise file-by-file analysis. Can run in "report-only" mode (default) or "fix-plan" mode (generates a ticket-breakdown handoff for remediation).
npx skillsauth add OmexIT/claude-skills-pack arch-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Reviews a Java module against clean architecture, hexagonal, and DDD invariants. Produces a findings report with severity and concrete fix suggestions.
This skill is read-only — it produces a findings report, never inline fixes. It sits at a specific point in the superpowers workflow.
Before invoking this skill: nothing. Reviewers analyze existing work and don't need brainstorming or planning upfront.
Invoke this skill (arch-review) to audit a Java module against clean architecture invariants. Produces findings with severity ratings (CRITICAL/HIGH/MEDIUM/LOW) and affected file paths.
After findings are produced — for each CRITICAL or HIGH finding, route through the fix workflow:
api-first for controller/service/DTO restructuringtemporal-workflow for saga/orchestration extractionfintech-ledger for money-code restructuringHard rule: this skill NEVER produces inline fixes in the same invocation. It produces findings. Fixes happen in a separate pass through the code-generator workflow. If the user asks "just fix it", refuse and route them through the plan → fix → review chain.
/arch-review $ARGUMENTS
Accepts:
/arch-review payment/arch-review com.company.paymentConfirm scope:
🏛️ ARCH REVIEW SCOPE
Module: payment
Package: com.payserflow.payment
Files: <n> Java files
Layers: domain, application, infrastructure, api
Mode: report-only | fix-plan
api / presentation
│
▼
application (services, use cases)
│
▼
domain (aggregates, value objects, events)
▲
│
infrastructure (repos, clients, adapters)
Rules:
domain imports NOTHING from application, infrastructure, api, or Springapplication imports from domain only (and Spring for @Service, @Transactional)infrastructure imports domain and application ports; never referenced the other wayapi imports application only; never touches domain or infrastructure directly@Transactional only on service methods (application layer), never on repositories or controllers@Transactional(readOnly = true)@Transactional on private methods (Spring can't proxy them)this. bypasses the proxy — flag it@RestController@CircuitBreaker or equivalentMoney value object (not BigDecimal)Email value object (not String)PhoneNumber value objectTenantId value objectPaymentId, UserId) — not raw Long / StringPrimitives are allowed at the infrastructure boundary (DB columns, HTTP payloads) — domain should see value objects.
ApplicationEventPublisher or Spring Modulith's DomainEvents@ApplicationModuleListener for cross-module, @EventListener for in-moduleIf Spring Modulith is present, ensure:
@ApplicationModule declares allowed dependenciesApplicationModules.verify() is in a test — failing build on violationpackage-info.java documents module purpose and portsfind <package> -name "*.java" | head -200
grep -l "@RestController" <package> | wc -l
grep -l "@Service" <package> | wc -l
grep -l "@Repository" <package> | wc -l
@AnalyzeClasses(packages = "com.payserflow.payment")
class PaymentArchTest {
@ArchTest
static final ArchRule domain_does_not_depend_on_application =
classes().that().resideInAPackage("..domain..")
.should().onlyDependOnClassesThat().resideInAnyPackage(
"..domain..", "java..", "org.slf4j..");
@ArchTest
static final ArchRule controllers_only_in_api_package =
classes().that().areAnnotatedWith(RestController.class)
.should().resideInAPackage("..api..");
@ArchTest
static final ArchRule repositories_only_in_infrastructure =
classes().that().areAssignableTo(CrudRepository.class)
.should().resideInAPackage("..infrastructure..");
@ArchTest
static final ArchRule services_are_annotated_with_service =
classes().that().haveSimpleNameEndingWith("Service")
.and().resideInAPackage("..application..")
.should().beAnnotatedWith(Service.class);
@ArchTest
static final ArchRule no_cyclic_module_dependencies =
slices().matching("com.payserflow.(*)..").should().beFreeOfCycles();
}
If ArchUnit isn't in the project, propose adding it. Otherwise perform file-by-file grep analysis.
For each file, check:
domain file import Spring annotations?)for (...) loops processing domain objects?)Entity directly?)@ControllerAdvice?)# Architectural Review — <module>
Reviewer: arch-review skill
Date: <timestamp>
Mode: report-only | fix-plan
## Summary
Total findings: <n>
🔴 CRITICAL: <n> (must fix before merge)
🟠 HIGH: <n> (should fix this sprint)
🟡 MEDIUM: <n> (track as tech debt)
🟢 LOW: <n> (style/cleanup)
## CRITICAL findings
### [CRIT-001] domain layer imports Spring
**Rule**: 1.1 Dependency Direction
**File**: src/main/java/com/payserflow/payment/domain/Payment.java:5
**Issue**: `import org.springframework.stereotype.Component;`
**Why it matters**: domain must be framework-agnostic; coupling to Spring prevents unit-testing domain in isolation
**Fix**: Remove the `@Component` annotation; move any Spring-managed lifecycle into `application` or `infrastructure`.
### [CRIT-002] controller contains business logic
**Rule**: 1.3 No Business Logic in Controllers
**File**: src/main/java/com/payserflow/payment/api/PaymentController.java:45-78
**Issue**: Controller loops over payments, aggregates totals by currency, and applies fee discount logic inline.
**Fix**: Extract to `PaymentSummaryService.computeSummary(criteria)` in the application layer; controller calls once and maps the result.
## HIGH findings
### [HIGH-001] external HTTP call without circuit breaker
**Rule**: 1.5 Circuit Breakers on External Calls
**File**: src/main/java/com/payserflow/payment/infrastructure/PaymentGatewayClient.java:32
**Issue**: `restClient.post().retrieve()` has no `@CircuitBreaker` annotation; a gateway outage would cascade.
**Fix**: Add `@CircuitBreaker(name = "payment-gateway", fallbackMethod = "fallbackCharge")` and implement `fallbackCharge(...)` returning a `PaymentDeclinedResult`.
... etc ...
## Dependency Graph
api ──► application ──► domain ◄── infrastructure
└─► application (VIOLATION: CRIT-003)
## Recommendations
1. Add ArchUnit to the build so these invariants are enforced on every CI run
2. Extract `PaymentSummaryService` (addresses CRIT-002)
3. Wrap all gateway clients in circuit breakers (addresses HIGH-001..005)
4. Migrate `BigDecimal amount` to `Money` value object across the payment module (addresses MED-001..008)
If invoked with --fix-plan, produce an ordered ticket breakdown:
## Remediation Tickets
### Ticket 1: Remove Spring imports from domain layer
**Severity**: CRITICAL
**Effort**: 1 day
**Files**: <n>
**Dependencies**: none
**Done when**: domain package has zero `org.springframework.*` imports; ArchUnit rule passes
### Ticket 2: Introduce ArchUnit build verification
**Severity**: HIGH
**Effort**: 2 days
**Dependencies**: Ticket 1
**Done when**: `./gradlew test` runs `PaymentArchTest` and fails on regression
...
produces:
- type: "arch-review"
format: "markdown"
path: "claudedocs/<module>-arch-review-<timestamp>.md"
- type: "tickets"
format: "markdown"
path: "claudedocs/<module>-arch-fix-plan-<timestamp>.md" # only in fix-plan mode
- type: "code"
format: "java"
paths: ["src/test/java/.../<Module>ArchTest.java"] # suggested ArchUnit test
handoff: "Write claudedocs/handoff-arch-review-<timestamp>.yaml — suggest: ticket-breakdown, tech-debt-assessment"
| Pattern | Detection | Severity |
|---|---|---|
| Spring imports in domain/ | grep org.springframework | CRITICAL |
| JPA/JDBC imports in domain/ | grep jakarta.persistence / org.springframework.data | CRITICAL |
| Controller returning entities | grep for return <entity> in @RestController classes | HIGH |
| @Transactional on private methods | grep private.*@Transactional | HIGH |
| @Transactional on controllers | grep @Transactional in api package | CRITICAL |
| Missing circuit breaker on RestClient / WebClient | grep for HTTP calls without @CircuitBreaker | HIGH |
| this.otherMethod() in service when other method is @Transactional | static analysis | HIGH |
| BigDecimal amount in method signature (domain layer) | grep | MEDIUM |
| Raw Long id / String id in domain | grep | MEDIUM |
| catch (Exception e) in services | grep | MEDIUM |
| Static method call into another module | grep cross-module static calls | HIGH |
| Repository called directly from controller | grep @Autowired.*Repository in api package | CRITICAL |
| File | When |
|---|---|
| references/archunit-setup.md | How to add ArchUnit to Gradle/Maven |
| references/clean-architecture-patterns.md | Deep dive on each invariant with good/bad examples |
tools
Use this skill to verify a completed implementation through live testing — API calls, database state checks, and UI automation with Playwright. Triggers include: "test the implementation", "verify this works", "run API tests", "check the database", "test the UI", "end-to-end verify", "smoke test", "sanity check the implementation", "manually test", or any time an implementation needs post-build validation beyond unit tests. Also triggered automatically by spec-to-impl during the integration review phase. Use this when you want real evidence the system works — not just that tests compile. Can consume a pre-generated e2e/test-plan.yaml from spec-to-impl for fully automated test execution.
development
--- name: ux-review description: Evaluate a UI/UX design or implementation using heuristic analysis, accessibility audit, and cognitive walkthrough. Triggers: "UX review", "usability review", "heuristic evaluation", "accessibility audit", "is this usable". argument-hint: "[feature / screen / URL / mockup]" effort: high --- # UX review ## What I'll do Evaluate a design or implementation for usability, accessibility, and user experience quality using established heuristic frameworks. ## Inputs
development
--- name: user-flow description: Map user journeys through a feature or product, identifying key paths, decision points, friction, error states, and edge cases. Triggers: "user flow", "user journey", "flow diagram", "happy path", "user path". argument-hint: "[feature / user goal]" effort: medium --- # User flow ## What I'll do Map the complete user journey for a feature — from entry point through completion — including happy paths, error states, edge cases, and decision points. > **user-flow
development
Use this skill to produce complete UI/UX design artifacts from a specification document or panel analysis. Triggers include: "design the UI for this spec", "create wireframes", "design this panel", "UX design from spec", "generate component specs", "design tokens", "create the UI design for", "design system for", "wireframe this feature", "design a UI", "create a design system", "design this component", "design the layout", "create a style guide", "design a screen", "UI/UX review", "typography system", "color system", "spacing system", "design this feature", "design the dashboard", "design the onboarding", "create a component library", "design review", "audit the design", "improve the UI", "redesign this", "design system documentation", "create design guidelines", "responsive design", "mobile design", "dark mode design", "design the brand", or any time a spec/panel analysis document needs to be transformed into actionable UI/UX deliverables before implementation. Also triggers for standalone design system creation, component design, design reviews, dark mode/responsive variants, and developer handoff — even before code is involved. Orchestrates a multi-agent design team (UX Lead, UI Designer, Component Architect, Accessibility Reviewer, Design System Engineer, Design Reviewer) in parallel waves. Outputs feed directly into spec-to-impl's FE agent and figma-to-code.