Debug
Required Reading
- skill: ts-principles
- Read
ts-principles/SKILL.md.
- Read every linked principle detail document before debugging.
Role
Debug is a repair judge.
It turns a concrete symptom into a causal explanation and an
architecture-aligned fix. It rejects patches that hide the symptom without
fixing the owner of the defect.
The judge may edit code. It may dispatch reviewers after its fix when the
change has meaningful risk, touches shared contracts, changes behavior across
boundaries, or the user asks for review.
Sub-Agent Selection
Use this section when this skill spawns sub-agent reviewers.
- Choose the first available entry for the reviewer role.
- If the harness cannot set provider, model line, and reasoning separately,
choose the closest available model and record what actually ran.
- When spawning more than one reviewer, use different provider and model-line
pairs when model availability permits.
Review Worker
| Priority |
Provider |
Model line |
Reasoning |
| 1 |
Anthropic |
fable latest |
high |
| 2 |
OpenAI |
astra latest |
high |
| 3 |
OpenRouter |
glm latest |
xhigh |
| 4 |
Anthropic |
opus latest |
high |
| 5 |
OpenAI |
sol latest |
high |
| 6 |
OpenRouter |
gemini flash latest |
high |
| 7 |
OpenRouter |
deepseek v4 pro latest |
high |
| 8 |
Cursor |
composer |
high |
Workflow
- FRAME_SYMPTOM
- REPRODUCE
- TRACE_CAUSE
- CHOOSE_REMEDY
- APPLY_FIX
- VERIFY
- REVIEW_IF_NEEDED
- HANDOFF
FRAME_SYMPTOM
- Capture the exact error, command, input, environment, and expected behavior
when available.
- Name the repository root and check the starting worktree state before edits.
- Treat supplied logs, stack traces, screenshots, and failing commands as
evidence, not as the full cause.
REPRODUCE
- Reproduce the failure locally when possible.
- Use the smallest command that shows the symptom.
- If reproduction is unavailable, state why and continue with weaker confidence.
TRACE_CAUSE
- Identify the failing boundary: command, tool, API, module, data contract,
runtime state, dependency, environment, or external service.
- Inspect nearby architecture, existing patterns, and source-owned contracts
before choosing a remedy.
- Explain the causal chain before editing code.
- Fix the owner of the defect, not the nearest caller that can mask it.
CHOOSE_REMEDY
Before editing, classify the remedy:
causal fix: changes the code or contract that owns the defect.
boundary adaptation: handles a real external contract at the edge.
containment: mitigates an upstream or environmental defect.
workaround: hides the symptom without fixing ownership.
Apply causal fix or boundary adaptation.
Apply containment only when the cause is outside the repo or cannot be fixed
now. Record the reason and removal condition.
Do not apply workaround.
Treat these as suspect until proven necessary:
- build-tool wrappers
- broad catches or swallowed errors
- loosened types
- skipped tests or changed snapshots
- sleeps, retries, and timing changes
- broad fallback paths
- special cases far from the owning boundary
APPLY_FIX
- Keep the fix scoped to the owner of the defect.
- Prefer deleting wrong code, correcting contracts, or moving logic to the right
boundary over adding wrappers, flags, or fallbacks.
- Add or update tests when the changed behavior needs proof.
- Before finishing the fix, check whether the causal explanation, boundary
adaptation, containment, invariant, failure mode, or contract needs docs where
a future maintainer will look.
- Add
/** ... */, a short why-comment, or source-owned docs when code cannot
carry the reason. Do not add comments that restate the code.
- Preserve unrelated user changes.
VERIFY
- Re-run the reproduction command.
- Run the smallest additional check that proves the fix changed behavior for
the right reason.
- If a required check cannot run after the obvious fix, stop and surface the
failure.
REVIEW_IF_NEEDED
Dispatch reviewers when the fix touches auth, persistence, public APIs,
migrations, shared tooling, build behavior, dependency resolution, concurrency,
or cross-module contracts.
Choose reviewers from the Review Worker list.
Reviewer prompts must include:
- the original symptom
- the causal explanation
- the debug-owned diff
- verification run
- assigned provider, model line, and reasoning level
- suspected risk areas
Reviewers must look for false fixes, hidden workarounds, contract drift,
overbroad changes, missing tests, and behavior masked by tooling changes.
HANDOFF
Report:
- Symptom and reproduction status.
- Root cause and owning boundary.
- Remedy classification.
- Fix applied.
- Verification run and result.
- Review result, open risks, or deviations.
1---2name: ts-debug3description: Debug. Only explicitly triggered by user.4---56# Debug78## Required Reading910- skill: ts-principles11 - Read `ts-principles/SKILL.md`.12 - Read every linked principle detail document before debugging.1314## Role1516Debug is a repair judge.1718It turns a concrete symptom into a causal explanation and an19architecture-aligned fix. It rejects patches that hide the symptom without20fixing the owner of the defect.2122The judge may edit code. It may dispatch reviewers after its fix when the23change has meaningful risk, touches shared contracts, changes behavior across24boundaries, or the user asks for review.2526## Sub-Agent Selection2728Use this section when this skill spawns sub-agent reviewers.2930- Choose the first available entry for the reviewer role.31- If the harness cannot set provider, model line, and reasoning separately,32 choose the closest available model and record what actually ran.33- When spawning more than one reviewer, use different provider and model-line34 pairs when model availability permits.3536### Review Worker3738| Priority | Provider | Model line | Reasoning |39| --- | --- | --- | --- |40| 1 | Anthropic | `fable` latest | `high` |41| 2 | OpenAI | `astra` latest | `high` |42| 3 | OpenRouter | `glm` latest | `xhigh` |43| 4 | Anthropic | `opus` latest | `high` |44| 5 | OpenAI | `sol` latest | `high` |45| 6 | OpenRouter | `gemini flash` latest | `high` |46| 7 | OpenRouter | `deepseek v4 pro` latest | `high` |47| 8 | Cursor | `composer` | `high` |4849## Workflow50511. FRAME_SYMPTOM522. REPRODUCE533. TRACE_CAUSE544. CHOOSE_REMEDY555. APPLY_FIX566. VERIFY577. REVIEW_IF_NEEDED588. HANDOFF5960### FRAME_SYMPTOM6162- Capture the exact error, command, input, environment, and expected behavior63 when available.64- Name the repository root and check the starting worktree state before edits.65- Treat supplied logs, stack traces, screenshots, and failing commands as66 evidence, not as the full cause.6768### REPRODUCE6970- Reproduce the failure locally when possible.71- Use the smallest command that shows the symptom.72- If reproduction is unavailable, state why and continue with weaker confidence.7374### TRACE_CAUSE7576- Identify the failing boundary: command, tool, API, module, data contract,77 runtime state, dependency, environment, or external service.78- Inspect nearby architecture, existing patterns, and source-owned contracts79 before choosing a remedy.80- Explain the causal chain before editing code.81- Fix the owner of the defect, not the nearest caller that can mask it.8283### CHOOSE_REMEDY8485Before editing, classify the remedy:8687- `causal fix`: changes the code or contract that owns the defect.88- `boundary adaptation`: handles a real external contract at the edge.89- `containment`: mitigates an upstream or environmental defect.90- `workaround`: hides the symptom without fixing ownership.9192Apply `causal fix` or `boundary adaptation`.9394Apply `containment` only when the cause is outside the repo or cannot be fixed95now. Record the reason and removal condition.9697Do not apply `workaround`.9899Treat these as suspect until proven necessary:100101- build-tool wrappers102- broad catches or swallowed errors103- loosened types104- skipped tests or changed snapshots105- sleeps, retries, and timing changes106- broad fallback paths107- special cases far from the owning boundary108109### APPLY_FIX110111- Keep the fix scoped to the owner of the defect.112- Prefer deleting wrong code, correcting contracts, or moving logic to the right113 boundary over adding wrappers, flags, or fallbacks.114- Add or update tests when the changed behavior needs proof.115- Before finishing the fix, check whether the causal explanation, boundary116 adaptation, containment, invariant, failure mode, or contract needs docs where117 a future maintainer will look.118- Add `/** ... */`, a short why-comment, or source-owned docs when code cannot119 carry the reason. Do not add comments that restate the code.120- Preserve unrelated user changes.121122### VERIFY123124- Re-run the reproduction command.125- Run the smallest additional check that proves the fix changed behavior for126 the right reason.127- If a required check cannot run after the obvious fix, stop and surface the128 failure.129130### REVIEW_IF_NEEDED131132Dispatch reviewers when the fix touches auth, persistence, public APIs,133migrations, shared tooling, build behavior, dependency resolution, concurrency,134or cross-module contracts.135136Choose reviewers from the `Review Worker` list.137138Reviewer prompts must include:139140- the original symptom141- the causal explanation142- the debug-owned diff143- verification run144- assigned provider, model line, and reasoning level145- suspected risk areas146147Reviewers must look for false fixes, hidden workarounds, contract drift,148overbroad changes, missing tests, and behavior masked by tooling changes.149150### HANDOFF151152Report:153154- Symptom and reproduction status.155- Root cause and owning boundary.156- Remedy classification.157- Fix applied.158- Verification run and result.159- Review result, open risks, or deviations.