Detect violations of architectural decisions in the codebase. Checks module dependency direction rules, identifies boundary violations, and reports drift between documented decisions and actual code.
How this skill is triggered — by the user, by Claude, or both
Slash command
/principled-architecture:arch-driftThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Detect whether the codebase conforms to documented architectural decisions. Checks dependency direction rules, identifies module boundary violations, and reports drift with references to governing ADRs.
Detect whether the codebase conforms to documented architectural decisions. Checks dependency direction rules, identifies module boundary violations, and reports drift with references to governing ADRs.
/arch-drift [--module <path>] [--strict]
| Argument | Required | Description |
|---|---|---|
--module <path> | No | Scope analysis to a single module. Checks all modules if omitted. |
--strict | No | Exit non-zero on any error-severity violation. For CI use. |
Scan modules. Discover all modules:
bash ../arch-map/scripts/scan-modules.sh [--module <path>]
Read accepted ADRs. For each ADR in docs/decisions/ with status accepted:
Check dependency direction. For each module, run the boundary checker:
bash scripts/check-boundaries.sh --module <path> --type <type>
This scans source files for import statements and checks them against the dependency direction rules:
| Module Type | Can Depend On | Cannot Depend On |
|---|---|---|
app | lib, core | other app |
lib | core | app, lib* |
core | (none internal) | app, lib |
*Cross-lib dependencies are allowed if explicitly declared in the module's CLAUDE.md ## Dependencies section.
Classify findings. Each violation is classified by severity:
core importing from app)Reference governing ADRs. For each violation, identify which ADR established the rule being violated and include the reference in the report.
Report results. Output a structured report:
Architecture drift analysis:
Modules checked: 8
Violations found: 3
Errors: 1
Warnings: 2
ERROR: packages/core/src/utils.ts:15
Imports from packages/api (app) — core cannot depend on app
Governing ADR: ADR-014 (Heuristic Architecture Governance)
WARNING: packages/auth-lib/src/client.ts:42
Imports from packages/shared-lib (lib) — lib-to-lib not declared
Declare in CLAUDE.md ## Dependencies to allow
Strict mode. If --strict is specified and any error-severity violations exist, report failure. This enables CI integration.
scripts/check-boundaries.sh --- Scan source files for import violations against dependency direction rulesnpx claudepluginhub alexnodeland/principled --plugin principled-architectureValidates architectural layer boundaries and detects dependency violations using configurable constraint rules. Provides hard enforcement for pull request approval and refactoring.
Sweeps codebase architecture periodically by reading ADRs, mapping module/dependency graphs, surfacing 5-10 smells with severity, and generating refactor proposals for /refactor. Triggered by '/architecture-review'.
Enforces architectural rules (layer responsibilities, dependency direction, structure) when generating or reviewing code. Supports clean/hexagonal/onion/monolith architectures via loaded rule sets.