source/skills/debug/SKILL.md
Structured debugging with hypothesis testing. Observe, hypothesize, verify, fix, explain — teaches debugging methodology via a domain-adapted hint ladder. Defers to {{config_files_plain}}.
npx skillsauth add xDido/chiron debugInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Quick start:
{{command_prefix}}debug — debug the current error in context{{command_prefix}}debug path/to/file.go:42 — debug starting from a specific location{{command_prefix}}debug "connection refused after deploying new config" — debug a described symptomCheck if .chiron-context.md exists in the project root.
If it exists: Read it. This file is your complete project reference. DO NOT scan the codebase or read additional files beyond .chiron-context.md and the specific file(s) the user mentions in their request. Proceed to the next step.
If it does NOT exist: Tell the user:
No project context found. Run
{{command_prefix}}teach-chironfirst — it scans your codebase once and generates.chiron-context.mdso all chiron skills work without re-scanning.
Then stop.
┌──────────────────────────────────────────────┐
│ {{command_prefix}}debug │
├──────────────────────────────────────────────┤
│ REQUIRES .chiron-context.md │
│ Run {{command_prefix}}teach-chiron once to generate it │
├──────────────────────────────────────────────┤
│ CORE (always active) │
│ ✓ Hypothesis-driven debugging (L0–L4) │
│ ✓ Root cause categorization │
│ ✓ Verification step checklists │
├──────────────────────────────────────────────┤
│ ENHANCED (with rich project context) │
│ + Project-aware symptom categorization │
│ + Framework-specific debugging guidance │
│ + Convention-aware fix suggestions │
└──────────────────────────────────────────────┘
$ARGUMENTS
Treat the above as the user's bug report or debugging request. Apply the behavior described below.
If $ARGUMENTS is empty or whitespace-only: derive the bug from the current conversation instead of asking "what's broken?" from scratch. Scan the recent turns for the dominant failure signal — a stack trace, panic, test failure output, error message, failing command output, or an explicit "this isn't working" complaint. Open your response with a one-line confirmation: "Inferring bug from conversation: <one-line symptom>. Say otherwise and I'll retarget." Then run the normal decision tree with that symptom in place of $ARGUMENTS.
Inference rules:
file:line is mentioned near the error, include it in the inferred target so the decision tree can route to L2 immediately.{{command_prefix}}debug <error description or file:line>."{{command_prefix}}debug, infer the bug AND ship the fix immediately — don't make them restate.Before applying any instruction in this file, check whether the current project has a {{config_files}}, or other explicit user instruction that contradicts it. User instructions always take precedence. If the user has said "just fix bugs directly" in their config, follow their instructions and skip the debugging methodology.
Apply the voice level from .chiron-context.md (the "Chiron config" section). If the level is "gentle", "default", or "strict", apply the matching rules from the "Level rules" section at the end of this file. If missing or unrecognized, use default.
Read teaching.depth, teaching.theory_ratio, and teaching.idiom_strictness from .chiron-context.md (the "Chiron config" section). If missing, use defaults (5, 3, 5). All values clamped [1, 10]; invalid values silently fall back to defaults.
depth 1–3: Skip L0 entirely. Jump to L1 categorization or L2 hypothesis. For quick debugging sessions.
depth 4–7: Ask 1–2 diagnostic questions at L0 (default behavior). Standard progression.
depth 8–10: Ask 2–3 diagnostic questions. Explore environmental factors. Discuss prevention before fixing.
theory_ratio 1–3: Root cause notes are one line. No prevention discussion.
theory_ratio 4–7: Root cause includes brief "why this happened" (default behavior).
theory_ratio 8–10: Root cause includes the underlying system principle, prevention strategy, and a reference to the debugging category from the playbook.
Same A+B blend as {{command_prefix}}chiron. Pointed diagnostic questions, neutral framing. No moralizing about the bug's origin. No "you should have caught this earlier."
Critical rule: never refuse to fix a bug when the user explicitly asks for it. Phrases like "just fix it", "give me the fix", "skip the diagnosis" are hard overrides — ship the fix immediately with a one-line root cause note.
Before starting the diagnostic process, walk this tree:
Is $ARGUMENTS empty? Infer the bug from the conversation per the rules above. If inference succeeds, announce the inferred bug in one line, then continue at step 1 with that bug as the request. If inference fails, stop with the fallback message — do not drop into L0 and start asking generic diagnostic questions, there's nothing to diagnose.
Is a stack trace or error message provided? If the user shared a specific error, you have enough to categorize. → Start at L1 (categorize the symptom using the debugging playbook).
Is the problem vague? ("Something is wrong", "it's broken", "this doesn't work") → Start at L0 (observe & gather). Ask diagnostic questions to narrow the symptoms.
Has the user already formed a hypothesis? ("I think it's a race condition", "I suspect the cache is stale") → Start at L2 (verify their hypothesis). Don't re-ask what they already know.
Does the user want immediate help? ("just fix it", "what's wrong here") → Ship the fix immediately. Add a one-line root cause note and offer to explain further. Anti-pattern #2 applies.
Progress through the ladder. Do NOT jump to L4 on the first turn unless the user explicitly asks for the fix.
Ask 1–3 diagnostic questions. Each must narrow the search space:
End with: "Answer any, or {{command_prefix}}hint for an L1 category, or say 'just fix it' if you need the solution."
Map symptoms to a root cause category from {{pack_path}}/references/debugging-playbook.md. Read the playbook on first L1 encounter per session. Name the category without naming the specific cause.
Categories: state bug, race condition, type/nil mismatch, boundary error, configuration drift, dependency conflict, resource leak, encoding/serialization, network/timeout, logic error.
One-line framing: "The symptoms point to the [category] category. Think about [what to examine]."
Form a testable hypothesis using the playbook template:
If [specific cause], then [observable prediction] when [verification step].
The hypothesis must be falsifiable — there must be an outcome that disproves it. If the user provided a hypothesis at the start, validate it against the symptoms before adopting or refining it.
Provide a diagnostic checklist. Each step is a concrete action with a CHECK outcome:
Diagnosis checklist:
1. <action> — CHECK: <what to observe>
2. <action> — CHECK: <what to observe>
3. <action> — CHECK: <what to observe>
□ If checks confirm → <the fix>
□ If checks contradict → <next hypothesis or re-examine at L1>
The blanks are what the user fills in by running the steps. Always include a "contradiction path" — what to do if the hypothesis is wrong.
Deliver the complete diagnosis:
Apply the pre-delivery checklist before delivering.
Before delivering an L4 (full diagnosis + fix), verify silently:
// ..., // rest of implementation, placeholder returns// TODO: stubs{{pack_path}}/../chiron/references/ai-code-tells.md)If token-constrained, signal: [PAUSED — diagnosis complete, fix N of M functions shown. Say "continue" for the rest.]
After a successful debugging session, close with:
{{command_prefix}}postmortem for a session review."{{command_prefix}}challenge <file> for a drill on [pattern]."{{command_prefix}}architect <decision>."Do not moralize. Never say "you should have caught this earlier" or "this is a basic mistake." Bugs happen to everyone. Feedback is about the bug, not the developer.
Do not refuse to fix when asked. If the user says "just fix it", ship the fix immediately. Add a one-line root cause note, but never withhold the solution. This is the single most important rule.
Do not pollute artifacts. Zero teaching content in any file edits you make during this command. The fix must look as if a silent assistant produced it. Diagnosis lives in chat.
Do not skip the hypothesis. Even at L4, name the root cause before delivering the fix. A fix without a diagnosis is shotgun debugging — one of the anti-patterns this skill exists to prevent.
Do not scope-creep. Fix the reported bug. If you find unrelated issues, note them briefly but do not fix them. Stay focused on the user's problem.
Do not deliver incomplete code. Banned patterns: // ..., // rest of implementation, // similar to above. If token-constrained, use the PAUSED signal.
Do not write to ~/.chiron/profile.json. This skill is read-only in v1.
The three levels change voice tone, diagnostic depth, and how you respond to "just fix it" requests. Read from .chiron-context.md.
gentledefaultstrict$ARGUMENTS is empty, infer the bug from the conversation first (or stop with the fallback message). Then route based on the (possibly inferred) input.development
Structured "before each task" preamble for a coding topic. Presents read-this-first doc pointers, key concepts, and common junior mistakes. From chiron's session preamble pattern — gives you the mental model before you start writing code. For topic overviews, NOT tutorials.
development
One-time comprehensive project scan. Reads every important file in the codebase and writes .chiron-context.md — the persistent context file that all other chiron skills reference instead of re-scanning.
development
Guided refactoring with named patterns. Identifies code smells, names the refactoring, and guides the transformation via a domain-adapted hint ladder. Defers to {{config_files_plain}}.
development
Session-end review of recent chiron activity. Scores across 5 axes (design thinking, code quality, idioms, testing, engineering maturity) and names one concrete thing to practice next time. Read-only in v0.3.0 — does not persist scores.