legacy-spec-agentlisted
Install: claude install-skill HoonStyle/legacy-spec-agent
# Legacy Spec Agent
Reconstruct a **grounded specification** from code that has no usable documentation, then keep that spec honest by detecting **drift** when the code changes.
The premise is deliberate: in real legacy systems the spec is missing but **the code is always there.** So this skill never asks for a spec as input — it mines one out of the source, and every claim it emits must be backed by a `file:line` citation. Anything it cannot ground in code is quarantined as *unverified*, never presented as fact.
> Guiding rule — **no ungrounded sentence ships.** A reconstructed rule without a code citation is a guess, and a guess in a spec is worse than a blank. This mirrors "Fact First": evidence gates every line.
---
## Two modes
Decide which mode you are in before doing anything else.
- **Mode A — Reverse-Spec** (default, first run on a repo): produce a grounded artifact profile from scratch. The default `standard` profile emits the complete documentation set; use `core` only when the user explicitly requests it.
- **Mode B — Drift-Check** (a prior `SPEC.md` from this skill already exists): re-verify each existing claim's citation against the *current* code and emit `DRIFT_REPORT.md`, appending to `audit_log.jsonl`.
If a `SPEC.md` produced by this skill exists in the target output location, default to Mode B and say so; otherwise Mode A.
---
## Workflow (Mode A)
Run the phases in order. Each phase maps to a role documented in `references/agent-roles.md` — read