architectural-diagnosislisted
Install: claude install-skill adnanmokhtar/refract
# Skill: architectural-diagnosis
## Purpose
Produce a project-wide architectural picture **before any optimisation fix lands**. Scoped at the module/layer level (NOT statement level). Surfaces the foundation issues whose fix cascades through dozens of tactical findings — so /optimize can apply them first and save 10× the work that scan-then-patch would burn.
This is the first skill /optimize dispatches. Output is consumed by /optimize Phase 1 (Apply foundations).
## When to use
- Dispatched by `/optimize` Phase 0 — every run starts here.
- NOT dispatched by `/setup-project --refine`. Its Phase 2.8 invokes the learning pack's `extract-architecture-deeply` instead — that skill maps the layer/import graph and traces request lifecycles as extraction substrate, whereas this one grades the graph against layer rules and emits foundation findings with cascade estimates. Extraction there, diagnosis here; for a standalone snapshot use `/optimize --diagnose-only`.
- Standalone diagnostic: `/optimize --diagnose-only` (writes the artifact, no fixes).
- NOT for per-feature work — /add-feature / /fix-bug have their own scope.
## Inputs (precise contract)
| Input | Source | Required |
|---|---|---|
| Codebase root | Orchestrator | YES |
| `PROJECT_KIND` | `_extracted-codebase.md § Gold standards` | YES (sets layer rules + stack-specific detectors) |
| Layer definition | `ai/architecture.md` OR `_extracted-idioms.md § Layers` | YES (without it, layer-violation detector skips with WARN)