一键导入
debt-triage
EM-PM conversation to review and prioritize the technical debt backlog. Triggers on demand or when open item count exceeds 20.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
EM-PM conversation to review and prioritize the technical debt backlog. Triggers on demand or when open item count exceeds 20.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | debt-triage |
| description | EM-PM conversation to review and prioritize the technical debt backlog. Triggers on demand or when open item count exceeds 20. |
| version | 1.0.0 |
Review the debt backlog, verify items are still relevant, re-prioritize based on current state, close resolved items, and present recommendations to the PM.
Announce at start: "I'm using the coordinator:debt-triage skill to review the debt backlog."
This is an EM-PM conversation, not a dispatched agent. The EM reads the backlog, applies judgment, and presents recommendations.
Before reading the backlog, check tasks/out-of-scope/*.md (if the directory exists — skip silently if absent). For each file present, note the concept and rejection reason. During triage, when any incoming item or discussion overlaps a known rejection, surface it:
"This is similar to
tasks/out-of-scope/<concept>.md— we rejected this because [reason]. Still feel the same?"
The maintainer can:
state/debt-backlog/ entries via bin/query-records.js --type debt (each entry is an individual YAML file with severity, status, and related frontmatter fields per docs/wiki/debt-backlog-schema.md — identity key is the filename <date>-<slug>.yaml — no id: field)Also read state/bug-backlog/*.yaml via bin/query-records.js --type bug (each entry is a YAML file with severity, status, etc. as frontmatter — identity key is the filename <date>-<slug>.yaml — no id: field).
Before dispatching any Haiku verification agents, do a quick staleness pre-check on the full item list.
For each item in state/debt-backlog/, note its cited file path and the date it was logged (created field in frontmatter). Items where git log --since="<finding-date>" -- <file-path> shows relevant commits are candidates for already-fixed status and should be confirmed first.
This pre-check prevents dispatching agents to verify debt that has already been resolved. In one measured run, 11 of 20 backlog items were already fixed before dispatch — the same failure mode applies to debt backlogs that drift behind active development.
Why pre-dispatch rather than during Step 2: Step 2 Haiku agents do the full per-line verification; this pre-check is the EM's own lightweight scan (date + git log) that prunes obviously-stale items before agent dispatch, reducing cost.
When evaluating whether a debt item or proposed enhancement is worth acting on, the debt-triage analyst may apply two concrete structural probes:
Deletion test. Imagine deleting the module, class, or abstraction in question. If complexity vanishes (callers simplify, the code reads more directly), the abstraction was a pass-through — it was not earning its keep. If complexity reappears across N callers (each must now handle what the module was hiding), the abstraction was load-bearing. Use this as a single-sentence verdict: "Deletion test: complexity would [vanish / reappear at N callers]."
One-adapter / two-adapter rule. One adapter is a hypothetical seam. Two adapters is a real seam that pays its abstraction cost. A single adapter wrapping one concrete implementation is usually premature — the deletion test confirms this. Two independent adapters in production justify the interface.
These probes apply when evaluating YAGNI calls, scope-change proposals, and deepening candidates. Pair any deletion-test finding with the convergence rule (≥2 independent agents before acting on a "shallow module" verdict) — single-agent subjective verdicts have elevated false-positive rates.
Also read state/improvement-queue/ entries via bin/query-records.js --type improvement
/learn-lessons local run." Do NOT pull these into the debt triage path; flag them for the EM to route at the end of this session.state/debt-backlog/ entries. These are candidates for migration to state/debt-backlog/ at Step 6b.Present the classification summary to the PM before proceeding:
"Improvement queue: N entries total — M universal (flagged for lessons-outbox routing), K project-specific (flowing into triage)."
If the queue is absent or empty, note this and proceed without block.
Doctrine refs: CLAUDE.md § Improvement Queue (admission rule + routing contract); docs/wiki/lessons-outbox-schema.md (universal entry routing schema).
Dispatch Haiku agents to verify each open item against the current code. This is mechanical read-and-confirm work — no judgment needed. Group items by system for efficient dispatch (one Haiku per system).
Each Haiku agent receives a list of items for its system and:
git log --since="<finding-date>" -- <file-path>
still-open / already-fixed / partially-addressedThe coordinator then categorizes:
already-fixed: mark as no-longer-applicablestill-open: item remains openpartially-addressed: update the description based on Haiku's reportWhy Haiku: 12 of 16 items in the 2026-03-19 triage were already fixed. Haiku verification costs minutes; dispatching Sonnet executors on ghost debt costs significantly more.
Based on current state:
Before grouping items, query the completion log for historical nature: tech-debt entries to surface which areas have consumed significant effort recently versus which have been avoided:
query-completions.sh --where "nature=tech-debt" --since "90d" --sort "-loe.tshirt" --format markdown-list
Interpret the output with two lenses:
nature: tech-debt completions may reflect avoidance. Flag these for PM attention: "We have carried this debt for N days without touching it — is that intentional?"Present a one-paragraph hot-zone summary to the PM before the Step 4 grouping. Example framing:
"The completion log shows three XL tech-debt sessions in
src/indexer/over the last 90 days — that area is festering. Two open backlog items cite it; I'm escalating both.src/cache/has two open items but no recent debt sessions — possible avoidance."
Zero-row rendering: If the query returns no results (fresh repo or no tech-debt completions logged yet), render: (no tech-debt completions logged in last 90d — hot-zone analysis unavailable) and proceed without escalating.
Group remaining items by system for efficient batch execution:
## Triage Results
### Closed (no longer applicable): N items
| ID | Reason |
|----|--------|
### Recommended for immediate action: N items
| ID | System | Severity | Description | Effort |
|----|--------|----------|-------------|--------|
### Can defer: N items
| ID | System | Severity | Reason to defer |
|----|--------|----------|----------------|
### Needs PM decision (YAGNI/scope): N items
| ID | System | Description | Question |
|----|--------|-------------|----------|
Present the triage results and ask for:
After PM decisions:
Close resolved items: for each item to close, stamp status: closed, closed_at: <ISO date>, and closed_by: <commit-sha> in the entry's YAML frontmatter, then archive it:
# For each closed entry:
mkdir -p archive/debt-backlog/<YYYY-MM>
git mv state/debt-backlog/<id>.yaml archive/debt-backlog/<YYYY-MM>/<id>.yaml
# After all archive moves, clean up an empty source dir if it becomes empty:
rmdir state/debt-backlog/ 2>/dev/null || true
Update priorities per PM direction (edit severity field in the relevant YAML files)
Remove items PM declares YAGNI (archive via git mv as above, with status: closed and a closed_by referencing PM decision)
For any item rejected with a load-bearing reason (scope conflict, doctrine conflict, cost-benefit rejection, architectural veto): write tasks/out-of-scope/<concept>.md using the template below. One file per concept, not per item — if a matching file already exists, append a new entry under "Prior requests" instead of creating a duplicate. Bugs do NOT go to .out-of-scope/ — only enhancement rejections. Create the directory on first use; never scaffold it empty.
# Out of scope: <concept>
**First raised:** YYYY-MM-DD
**Status:** Rejected (open to reconsideration)
## What was proposed
[One sentence describing the enhancement.]
## Why we rejected it
[Load-bearing reason. Cost, scope, doctrine conflict, etc.]
## Prior requests
- YYYY-MM-DD: [Brief description of how this came up]
## What would change our minds
[Conditions under which this should be reconsidered. Optional but useful.]
Commit:
git add archive/debt-backlog/ state/debt-backlog/ tasks/out-of-scope/
git commit -m "debt-triage: reviewed N items, closed M, N remain open"
After the Step 6 commit, migrate any project-specific entries identified in Step 1d from state/improvement-queue/ into state/debt-backlog/:
coordinator-queue-append --schema debt-backlog (mechanical capture using the CLI — do not manually author YAML). The CLI writes a new state/debt-backlog/<id>.yaml file.status: closed, closed_at: <ISO date>, and closed_by: <migrated-to-debt-backlog> in its frontmatter, then archive via git mv:
mkdir -p archive/improvement-queue/<YYYY-MM>
git mv state/improvement-queue/<source-id>.yaml archive/improvement-queue/<YYYY-MM>/<source-id>.yaml
rmdir state/improvement-queue/ 2>/dev/null || true
git add state/debt-backlog/
git commit -m "debt-triage: migrate N improvement-queue entries to debt-backlog"
git add archive/improvement-queue/ state/improvement-queue/
git commit -m "debt-triage: archive migrated improvement-queue entries"
state/debt-backlog/ — they stay in state/improvement-queue/ until the EM routes them via /learn-lessons local run (see docs/wiki/lessons-outbox-schema.md). Only project-specific entries migrate.If no project-specific entries were identified in Step 1d, skip this step entirely.
Rotational arch audit — scores systems, audits top-priority, packages spinoff candidates. Never edits code; updates Last-targeted-audit clock.
Use for new feature requests, vague/ambiguous requirements, or multi-subsystem decomposition before plan mode.
Systematic codebase bug hunt — find and fix all AI-fixable bugs in-session, defer blocked ones to backlog
Night-shift code health review — queries completion entries for today's surfaces, dispatches reviewer, applies findings, updates health tracking.
Run a Codex code review as a second-opinion gate. Returns structured result with findings or graceful skip. Used by /bug-sweep --codex-verify and /workweek-complete Step 7.4.
Cleans up branch sprawl. Triggers: consolidate branches, clean up branches, stale branches, merge all branches.