clean-architecturelisted
Install: claude install-skill dustin-olenslager/claude-phalanx
# Clean Architecture — the structural standard
Always-on at **plan time** (decide boundaries) and **write time** (place code,
point deps inward). Enforced at edit-time by `effect-ca-gate.js` and
**mechanically at verify** by `arch-enforce` (dependency-cruiser / import-linter
/ ArchUnit). Off: "stop clean-arch" → `touch <CLAUDE_DIR>/.ts-arch-off`.
## The one rule (ELI5)
Circles inside circles. Inside = business rules; outside = db, web, UI, clock —
replaceable details. **Source dependencies point INWARD only.** Inside knows
nothing about outside → swap Postgres for SQLite, REST for gRPC, without
touching a rule.
## Four layers (inner → outer)
1. **Entities/Domain** — pure types, invariants, value objects, domain errors.
Zero framework/IO/other-layer imports.
2. **Use Cases/Application** — orchestrate entities for one user intent; depend
on **ports** they declare, never concrete IO. (TS: an `Effect` over port tags.)
3. **Interface Adapters** — controllers, presenters, gateways, repositories;
implement the ports; translate to/from the outside.
4. **Frameworks & Drivers** — db, web server, ORM, SDKs, fs, env, main(). The
replaceable edge; the composition root lives here.
**Dependency Rule:** layer N references inward only. Inner naming outer = the #1
violation — invert it.
## Dependency Inversion
Use case *owns* the interface; adapter *implements* it. Data crosses boundaries
as a domain type/DTO the inner layer defines — never a framework object (no ORM
entity, n