Systematic debugging with hypothesis testing. Persistent across sessions.
Conducts systematic debugging sessions by spawning subagents to test hypotheses and track findings persistently.
npx claudepluginhub sienklogic/towlineThis skill is limited to using the following tools:
templates/continuation-prompt.md.tmpltemplates/initial-investigation-prompt.md.tmplYou are running the debug skill. Your job is to run a structured, hypothesis-driven debugging session that persists across conversations. You track every hypothesis, test, and finding in a debug file so work is never lost.
This skill spawns Task(subagent_type: "dev:towline-debugger") for investigation work.
Reference: skills/shared/context-budget.md for the universal orchestrator rules.
Additionally for this skill:
Debug systematically, not randomly. Every investigation step must have a hypothesis, a test, and a recorded result. No "let me just try this" — every action has a reason and is documented.
Load depth profile: Run node ${CLAUDE_PLUGIN_ROOT}/scripts/towline-tools.js config resolve-depth to get debug.max_hypothesis_rounds. If the command fails (no config.json or CLI error), default to 5 rounds. Initialize a round counter at 0. This counter increments each time a continuation debugger is spawned.
Scan .planning/debug/ for existing debug files:
.planning/debug/
{NNN}-{slug}.md # Each debug session is a file
Read each file's frontmatter to check status:
status: active — session is in progressstatus: resolved — session is completestatus: stale — session was abandonedIf active sessions found:
Use the debug-session-select pattern from skills/shared/gate-prompts.md:
question: "Found active debug sessions. Which would you like?"
Generate options dynamically from active sessions:
Handle responses:
If no active sessions found:
If $ARGUMENTS is provided and descriptive:
If $ARGUMENTS is empty or minimal:
Symptom gathering questions (ask as plain text — these are freeform, do NOT use AskUserQuestion):
Optional follow-ups (ask if relevant):
.planning/debug/ for existing filesCreate .planning/debug/{NNN}-{slug}.md:
---
id: "{NNN}"
title: "{issue title}"
status: active
created: "{ISO date}"
updated: "{ISO date}"
severity: "{critical|high|medium|low}"
category: "{runtime|build|test|config|integration|unknown}"
---
# Debug Session: {title}
## Symptoms
**Expected:** {expected behavior}
**Actual:** {actual behavior}
**Reproduction:** {steps}
**Onset:** {when it started}
**Scope:** {affected areas}
## Environment
- OS: {detected or reported}
- Runtime: {node version, python version, etc.}
- Relevant config: {any config that matters}
## Investigation Log
### Round 1 (automated)
{This section is filled by towline-debugger}
## Hypotheses
| # | Hypothesis | Status | Evidence |
|---|-----------|--------|----------|
| 1 | {hypothesis} | {testing/confirmed/rejected} | {evidence} |
## Root Cause
{Filled when found}
## Fix Applied
{Filled when fixed}
## Timeline
- {ISO date}: Session created
Display to the user: ◐ Spawning debugger...
Spawn Task(subagent_type: "dev:towline-debugger") with the prompt template.
Read skills/debug/templates/initial-investigation-prompt.md.tmpl for the spawn prompt. Fill in the {NNN}, {slug}, and symptom placeholders with values from the debug file created above.
Resuming debug session #{NNN}: {title}
Last state:
- Hypotheses tested: {N}
- Confirmed: {list or "none yet"}
- Rejected: {list}
- Current lead: {most promising hypothesis}
Continuing investigation...
Display to the user: ◐ Spawning debugger (resuming session #{NNN})...
Spawn Task(subagent_type: "dev:towline-debugger") with the continuation prompt template.
Read skills/debug/templates/continuation-prompt.md.tmpl for the spawn prompt. Fill in the {NNN}, {slug}, and {paste investigation log...} placeholders with data from the debug file.
The debugger returns one of four outcomes:
Root cause identified: {cause}
Fix applied: {description}
Commit: {hash}
Actions:
status: resolved━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
TOWLINE ► BUG RESOLVED ✓
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
**Session #{NNN}:** {title}
**Root cause:** {cause}
**Fix:** {description}
**Commit:** {hash}
───────────────────────────────────────────────────────────────
## ▶ Next Up
**Continue your workflow** — the bug is fixed
`/dev:status`
<sub>`/clear` first → fresh context window</sub>
───────────────────────────────────────────────────────────────
**Also available:**
- `/dev:continue` — execute next logical step
- `/dev:review {N}` — verify the current phase
───────────────────────────────────────────────────────────────
Used when the debugger was invoked with find_root_cause_only or when the fix is too complex for auto-application.
Root cause identified: {cause}
Suggested fix: {approach}
Actions:
status: resolved───────────────────────────────────────────────────────────────
## ▶ Next Up
**Apply the fix** — root cause identified, fix needed
`/dev:quick {fix description}`
<sub>`/clear` first → fresh context window</sub>
───────────────────────────────────────────────────────────────
**Also available:**
- `/dev:plan` — for complex fixes that need planning
- `/dev:status` — see project status
───────────────────────────────────────────────────────────────
The debugger found something but needs user input or more investigation.
Investigation progress:
- Tested: {hypotheses tested}
- Found: {key finding}
- Need: {what's needed to continue}
Actions:
skills/shared/gate-prompts.md:
question: "Investigation has reached a checkpoint. How should we proceed?"Handle responses:
◐ Spawning debugger (continuing investigation)... and spawn another Task(subagent_type: "dev:towline-debugger") with updated context from the debug fileThe debugger exhausted its hypotheses without finding the root cause.
Investigation exhausted:
- Tested: {all hypotheses}
- Rejected: {list}
- Remaining unknowns: {list}
Actions:
The towline-debugger agent follows this protocol internally:
1. OBSERVE: Read error messages, logs, code around the failure point
2. HYPOTHESIZE: "The most likely cause is X because Y"
3. PREDICT: "If X is the cause, then test Z should show W"
4. TEST: Execute test Z
5. EVALUATE:
- Result matches prediction → hypothesis supported → investigate deeper
- Result contradicts → hypothesis rejected → try next hypothesis
- Result is unexpected → new information → form new hypothesis
| Technique | When to Use |
|---|---|
| Stack trace analysis | Error with stack trace available |
| Code path tracing | Logic error, wrong behavior |
| Log injection | Need to see runtime values |
| Binary search | Know it worked before, need to find when it broke |
| Isolation | Complex system, need to narrow scope |
| Comparison | Works in one case, fails in another |
| Dependency audit | Recent dependency changes |
| Config diff | Works in one environment, not another |
| Quality | Description | Action |
|---|---|---|
| Strong | Directly proves/disproves hypothesis | Record and move on |
| Moderate | Suggests but doesn't prove | Record, seek corroboration |
| Weak | Tangentially related | Note but don't base decisions on it |
| Misleading | Red herring | Record as eliminated, explain why |
The maximum number of investigation rounds is controlled by the depth profile's debug.max_hypothesis_rounds setting:
quick: 3 rounds (fast, surface-level investigation)standard: 5 rounds (default)comprehensive: 10 rounds (deep investigation)The orchestrator tracks the round count. Before spawning each continuation debugger (Step 3 "CHECKPOINT" -> "Continue"), increment the round counter. If the counter reaches the limit:
Use AskUserQuestion: question: "Reached {N}-round hypothesis limit. How should we proceed?" header: "Debug Limit" options: - label: "Extend" description: "Allow {N} more rounds (doubles the limit)" - label: "Wrap up" description: "Record findings so far and close the session" - label: "Escalate" description: "Save context for manual debugging"
stale, record all findings, suggest next stepsactive → resolved (root cause found and fixed)
active → stale (abandoned — no updates for 7+ days)
active → active (resumed after pause)
When scanning for active sessions, check the updated date. If more than 7 days old:
stale in statusOld resolved debug files can accumulate. They serve as a knowledge base for similar issues. Do NOT auto-delete them.
Update STATE.md Debug Sessions section (create if needed):
### Debug Sessions
| # | Issue | Status | Root Cause |
|---|-------|--------|------------|
| 001 | Login timeout | resolved | DB connection pool exhausted |
| 002 | CSS not loading | active | investigating |
Reference: skills/shared/commit-planning-docs.md for the standard commit pattern.
If planning.commit_docs: true in config.json:
docs(planning): open debug session {NNN} - {slug}docs(planning): resolve debug session {NNN} - {root cause summary}fix({scope}): {description}If the towline-debugger Task() fails or returns an error, display:
╔══════════════════════════════════════════════════════════════╗
║ ERROR ║
╚══════════════════════════════════════════════════════════════╝
Debugger agent failed for session #{NNN}.
**To fix:**
- Check the debug file at `.planning/debug/{NNN}-{slug}.md` for partial findings
- Re-run with `/dev:debug` to resume the session
- If the issue persists, try a fresh session with different symptom details
debug.max_hypothesis_rounds limit without user confirmation (default: 5 for standard mode)Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.