Activation Contract
Use this skill to scan a whole repo (global) or given paths/modules (targeted) for technical debt, meaning complexity with a nameable symptom (references/02-complexity-model.md), in code, tests, and architecture/docs/infra, and prioritize it. Not for latent bugs (bug-scan), test strength (mutation-test), security (api-security-scan), dependency upgrades (update-dependencies), or applying refactors (refactor).
Hard Rules
- NEVER modify production code, tests, or config; NEVER apply fixes.
remediationis one line of direction, not a patch. - ALWAYS open with one option prompt before any work: mode, categories, and output format (
chat|markdown); never infer any of them from the prompt. - Every finding needs a
symptom, acause,file:line, and measured evidence:evidence.method(command or files read) andevidence.result(number, count, or quoted fact). No opinion-only findings; discard findings with no present symptom and count them indiscarded. - Author only
scores(integers 1-5 perreferences/06-prioritization-evidence.md);priority = impact × frequency × reach / effortandseverityare derived byreconcile.py, never written by hand. - Previous reports are leads, never evidence: re-measure every inherited finding in scope.
docs/tech-debt/{YYYY-MM-DD}.jsonis the only artifact; never write a ledger or a rendered file.- Delegate reconnaissance and measurement to read-only subagents with
assets/recon-subagent.mdandassets/measure-subagent.md, at most 3 concurrent; they return facts, scoring and severity stay with you. - ALWAYS state what was not reviewed.
- ALWAYS run
python3 assets/reconcile.py --report <report.json>, thenpython3 assets/validate_report.py --file <report.json>; fix everyERROR:until exit 0. Never overwrite an existing report.
Decision Gates
| Condition | Action |
|---|---|
| Selector not answered | Ask: mode + categories + output format; require an answer first |
| Global chosen | Read the previous report, rank modules by churn × complexity, go deep |
| Targeted chosen | Record paths, read overlapping reports, assess only those paths |
| No previous report | First scan; set baseline to none and say so |
| No git history | Score frequency 3 and state it in evidence.result |
| Generated, vendored, or legacy | List under not reviewed unless the user included it |
Execution Steps
- Ask the selector (
references/01-scan-modes.md): mode, categories (code,tests,architecture-docs-infra), output format; targeted also needs paths. - Load history (
references/07-baseline-history.md): baseline fromdocs/tech-debt/*.json; re-measure its open findings in scope. - Run one recon subagent (
assets/recon-subagent.md): module map, churn percentiles, tooling, test command. - Run one measurement subagent per chosen category (
assets/measure-subagent.md), loading only its signals reference (references/03-code-debt.md,references/04-test-debt.md, orreferences/05-architecture-docs-infra.md). - Classify each candidate (symptom, cause) and score it; drop those with no symptom or evidence.
- Take
requested_byfromgit config user.name(ask if empty), then write the report fromassets/tech-debt-report.template.jsontodocs/tech-debt/{YYYY-MM-DD}.json(suffix-2,-3if it exists). - Reconcile:
python3 assets/reconcile.py --report <report.json>. - Validate:
python3 assets/validate_report.py --file <report.json>; fix everyERROR:until exit 0. - Present the view in the chosen format:
chatthe concise summary;markdownpastespython3 assets/render_report.py --json <report.json>stdout. Never both, never a file.
Output Contract
Return the report JSON path, the transition summary (new · persists · fixed · regressed · not re-checked), the open counts by severity, the top items by priority (quick wins first), and the view in the chosen format. For top architecture items, suggest module-design. Only the JSON is written; it follows assets/tech-debt-report.schema.json and the view follows assets/tech-debt-report.md.
References
references/01-scan-modes.md— selector, global vs targeted, hotspot map, output formatreferences/02-complexity-model.md— complexity, symptoms, causes, co-changereferences/03-code-debt.md— complexity, duplication, coupling, dead code, markersreferences/04-test-debt.md— coverage gaps, flaky or brittle tests, slow suitesreferences/05-architecture-docs-infra.md— layering, docs drift, CI/build/configreferences/06-prioritization-evidence.md— scores, formula, bands, evidencereferences/07-baseline-history.md— baseline lookup, ids, delta, transitionsassets/recon-subagent.md— reconnaissance subagent promptassets/measure-subagent.md— measurement subagent promptassets/tech-debt-report.template.json— canonical report templateassets/tech-debt-report.schema.json— report schemaassets/tech-debt-report.md— chat markdown view formatassets/reconcile.py— derive priority/severity, assign ids, compute deltaassets/render_report.py— render report JSON to chat markdownassets/validate_report.py— report validator (structure, scores, counters, evidence)
