/draft:debugfrom draft
Guides structured debugging sessions: reproduce, isolate, diagnose, and fix bugs using systematic investigation. Useful for ad-hoc bugs or draft tracks.
Ships in draft. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are conducting a structured debugging session following systematic investigation methodology.
First resolve the bundled helpers:
# Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
# is not exported into skill Bash). See core/shared/tool-resolver.md.
DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$(cat ~/.cache/draft/plugin-root 2>/dev/null)}/scripts/tools"
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
[ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
When draft/graph/schema.yaml exists, this skill must follow the graph-first lookup contract in core/shared/graph-query.md §Mandatory Lookup Contract. During Steps 3–4 (Isolate, Diagnose):
"$DRAFT_TOOLS/graph-arch.sh" --repo . before tracing data flow."$DRAFT_TOOLS/graph-callers.sh" --repo . --symbol <fn> to enumerate call sites of suspect functions — not grep."$DRAFT_TOOLS/graph-impact.sh" --repo . --file <path> to size the blast radius before proposing a fix."$DRAFT_TOOLS/hotspot-rank.sh" --repo . to know whether the file is high-fanIn (any fix needs extra caution).Filesystem grep is reserved for source-text scans (literal error strings, stack-trace symbols when the graph misses). Use the fallback sentence on graph miss.
See shared red flags — applies to all code-touching skills.
Skill-specific:
No fixes without root cause investigation first.
Before starting, capture the current git state:
git branch --show-current # Current branch name
git rev-parse --short HEAD # Current commit hash
Store this for the debug report header. The session is scoped to this specific branch/commit.
ls draft/ 2>/dev/null
Debug can run standalone (without draft context) or within a draft track. If draft/ exists, load context for richer investigation.
Read and follow the base procedure in core/shared/draft-context-loading.md.
Key context for debugging:
.ai-context.md — Module boundaries, data flows, invariants (crucial for tracing)tech-stack.md — Language-specific debugging tools and techniquesguardrails.md — Known anti-patterns that may be causing the issuedraft/graph/ (MANDATORY when present) — Query "$DRAFT_TOOLS/graph-arch.sh" --repo . for dependency/module context and "$DRAFT_TOOLS/hotspot-rank.sh" --repo . for complexity awareness. Use "$DRAFT_TOOLS/graph-callers.sh" --repo . --symbol <fn> to find all callers, and "$DRAFT_TOOLS/graph-impact.sh" --repo . --file <path> to size blast radius before any fix. See core/shared/graph-query.md.Check for arguments:
/draft:debug — Interactive: ask what's broken/draft:debug <description> — Start with the described problem/draft:debug track <id> — Debug within a specific track context (load spec.md, plan.md)/draft:debug <JIRA-KEY> — Pull context from Jira ticket via MCPIf a Jira ticket is provided:
get_issue(), get_issue_description(), get_issue_comments()curl/wget to fetch any URLs mentioned (dashboards, error pages, API responses)ssh to access log locations on remote nodes (if paths like /home/log/, node IPs mentioned)Goal: Confirm the bug exists and establish reproduction steps.
intermittent in the hypothesis logunreproduced and the final report must mark the root cause as unconfirmed pending repro.Reference core/agents/debugger.md Phase 1 for detailed investigation techniques.
Goal: Narrow the failure to a specific code path.
Trace data flow — Follow data from input to failure point, documenting each hop with file:line references
Trace control flow — Map the execution path, identify where it diverges from expected behavior
Differential analysis — Compare working vs failing cases:
| Aspect | Working Case | Failing Case | Difference |
|---|
Check boundaries — Reference .ai-context.md module boundaries to scope the investigation
Reference core/agents/debugger.md Phase 2 for language-specific debugging techniques.
Goal: Confirm root cause with evidence.
Ground-truth gate (per hypothesis): Before forming hypothesis N, open and Read the file at the file:line you are about to cite. Quote the relevant lines in the hypothesis log. A hypothesis written from graph metadata or recollection is a Ground-Truth Red Flag G4 violation — it produces hypothesis loops on assumptions rather than evidence.
file:line because [evidence quoted from Read]"| # | Hypothesis (cite + quote) | Test | Prediction | Actual | Result |
|---|---|---|---|---|---|
| 1 | [description with path:line and quoted line] | [test] | [expected] | [actual] | Confirmed/Rejected |
If hypothesis fails: Return to Step 3 with updated understanding. After 3 failed cycles, escalate (see Error Handling). Do not increase confidence on a rejected hypothesis just because alternatives are running out — that's how anchoring bias produces wrong root causes.
Reference core/agents/debugger.md Phase 3 and core/agents/rca.md for 5 Whys analysis.
Goal: Fix the root cause with minimal change.
STOP. Before writing any test:
ASK: "Root cause confirmed: [summary]. Want me to write a regression test for this fix? [Y/n]"
MANDATORY: Include YAML frontmatter with git metadata. Follow core/shared/git-report-metadata.md.
Include the report header table immediately after frontmatter:
| Field | Value |
|-------|-------|
| **Branch** | `{LOCAL_BRANCH}` → `{REMOTE/BRANCH}` |
| **Commit** | `{SHORT_SHA}` — {COMMIT_MESSAGE} |
| **Generated** | {ISO_TIMESTAMP} |
| **Synced To** | `{FULL_SHA}` |
Save to:
draft/tracks/<id>/debug-report.mddraft/debug-report-<timestamp>.md with symlink debug-report-latest.mdTIMESTAMP=$(date +%Y-%m-%dT%H%M)
# Example: draft/debug-report-2026-03-15T1430.md
ln -sf debug-report-${TIMESTAMP}.md draft/debug-report-latest.md
Before printing the debug report, internally verify and report:
grep/find run, name the concept it searched for.If draft/graph/schema.yaml does not exist, set Graph files queried: NONE and use justification graph data unavailable.
Emit the canonical footer from core/shared/graph-usage-report.md §Canonical footer. The lint hook scripts/tools/check-graph-usage-report.sh validates the section on save.
/draft:new-track (bug tracks — Offer tier), /draft:implement (blocked tasks — Offer tier)core/agents/rca.md) for 5 Whys and blast radius analysis/draft:new-track spec.md (reproduction and root cause sections via Detect+Auto-Feed)/draft:regression to find the exact commit that introduced this bug"/draft:new-track to create a bug fix track from these findings"core/shared/jira-sync.mdIf cannot reproduce: Gather more context — check environment differences, ask for additional logs, check if the issue is environment-specific.
If no draft context: Run standalone with generic debugging methodology. Recommend /draft:init for richer context.
After 3 failed hypothesis cycles: Document all findings, list what's been eliminated, escalate — consider architectural review or external input.
If MCP unavailable for Jira: Skip Jira context gathering, proceed with available information.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub drafthq/draft --plugin draft33 skills in this plugin
/adrCreate and manage Architecture Decision Records. Documents significant technical decisions with context, alternatives, and consequences. Also supports evaluate (assess proposals) and design (system design) modes./assist-reviewReviewing someone else's PR for handoff/sign-off. Isolates structural changes from trivial edits, flags HLD/LLD drift and guardrail violations, points the reviewer at what to scrutinize. Use when prepping to review another engineer's work — NOT for first-pass self-review (use review / quick-review)./bughuntPerforms an exhaustive 14-dimension bug hunt across the codebase using Draft context (architecture, tech-stack, product) for false-positive elimination. Generates a severity-ranked report with code evidence, data flow traces, and suggested fixes. Optionally writes regression tests. Use when the user asks to find bugs, audit code for defects, scan for vulnerabilities, or says 'hunt bugs', 'find bugs', or 'code audit'./changeHandle mid-track requirement changes. Analyzes impact on completed and pending tasks, proposes amendments to spec.md and plan.md before applying./coverageCompute code coverage for active track or module. Targets 95%+ coverage with report and justification for uncovered lines. Complements TDD workflow./decomposeDecompose project or track into modules with dependency mapping. Project scope updates architecture.md and derives .ai-context.md. Track scope generates hld.md (always) and lld.md (when --lld or High-complexity module triggers it) — design-mandated artifacts that drive implement, deploy-checklist, and upload sign-off.Other plugins' skills for the same job