skills/knowledge/debugging/SKILL.md
Systematic debugging methodology for finding and fixing bugs through root cause analysis. Use when the user encounters a bug, test failure, flaky behavior, production error, performance degradation, or integration failure. Covers the reproduce-investigate-hypothesize-fix-prevent workflow, evidence-based diagnosis, bug category strategies (logic errors, race conditions, memory leaks, integration failures), and post-mortem documentation.
npx skillsauth add krzysztofsurdy/code-virtuoso debuggingInstall 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.
Systematic methodology for finding and fixing bugs. Prioritizes root cause analysis over symptom treatment, evidence over intuition, and prevention over recurrence.
No fix without root cause. Never apply a fix until you can explain WHY the bug exists, not just WHERE it manifests. Symptom-level fixes create new bugs.
Establish a reliable reproduction before investigating.
Output: Documented reproduction steps, minimal test case
If you cannot reproduce: Document what you tried, check environment differences, add instrumentation and wait for next occurrence. Do not proceed to Phase 2 on guesswork — unreproducible bugs get logged, not "fixed."
Gather evidence systematically. Do NOT form hypotheses yet — this phase is about observation, not explanation.
git log --since="2 weeks ago", git bisect)Production vs development debugging:
Output: Evidence log (what you found, where, timestamps), affected component map
Form competing hypotheses ranked by evidence strength.
Example hypothesis table:
| # | Hypothesis | Category | Evidence | Testability | Test Plan | |---|---|---|---|---|---| | 1 | Cache returns stale data after update | State | Log shows old value 2s after write | Easy | Bypass cache and compare | | 2 | Race condition between two workers | Race condition | Intermittent, high load correlation | Medium | Add locking, stress test | | 3 | Upstream API returns unexpected format | Integration | No evidence yet | Easy | Log raw response |
Output: Ranked hypothesis list with evidence and test plan
Validate one hypothesis at a time. Single-variable changes only.
Red flags (return to Phase 2 immediately):
Output: Confirmed root cause with evidence chain
Implement the fix at the source, not at the symptom.
Fix principles:
Output: Fix with regression test, clean test suite
Ensure this class of bug cannot recur.
Output: Prevention measures, post-mortem (if significant)
Different bug types need different investigation approaches. See bug categories reference for the full guide.
| Category | First Move | Key Technique | |---|---|---| | Logic error | Read the code, trace conditions | Rubber duck walkthrough, truth tables | | Data issue | Inspect actual vs expected data at each boundary | Boundary logging, data flow trace | | State/race condition | Add timestamps to all state mutations | Sequence diagram, concurrency analysis | | Integration failure | Check API contract compliance | Request/response logging, contract tests | | Performance | Profile before guessing | Profiler, flame graphs, query analysis | | Environment | Compare working vs broken env | Differential analysis, config audit | | Intermittent/flaky | Increase observability first | Statistical logging, stress testing |
Stop debugging and escalate when:
Escalate to:
| Situation | Escalate To | |---|---| | Design or architecture issues | Architect | | Cannot reproduce, need more info | QA team | | Scope, priority, or trade-off questions | PM / Product Owner | | Dependency or infrastructure issues | Platform / DevOps team | | Security implications discovered | Security team immediately |
This debugging workflow connects to broader team processes:
| Phase | Team Integration | |---|---| | Reproduce | QA provides bug reports with reproduction steps; request more detail if insufficient | | Investigate | Architect can help map component dependencies and blast radius | | Fix | Code review by a peer before merge — a second pair of eyes catches fix-induced regressions | | Prevent | Post-mortem shared with the team; action items tracked in the backlog |
When using other code-virtuoso skills:
| Situation | Recommended Skill |
|---|---|
| Bug fix reveals design problems | Install design-patterns-virtuoso from krzysztofsurdy/code-virtuoso |
| Fix involves refactoring | Install refactoring-virtuoso from krzysztofsurdy/code-virtuoso |
| SOLID violation is root cause | Install solid-virtuoso from krzysztofsurdy/code-virtuoso |
| PR for the fix | Use pr-message-writer from krzysztofsurdy/code-virtuoso |
Before marking a bug fix done:
No fix without root cause. This is the iron law. If you cannot explain why the bug exists, you are not done investigating.
Reproduce first. Do not investigate what you cannot reproduce. If reproduction fails, add observability and wait.
Single-variable testing. Change one thing at a time during hypothesis testing. Changing multiple variables makes results uninterpretable.
Evidence over intuition. Log your evidence. "I think it might be X" is not a hypothesis — "Log line Y shows value Z when it should show W" is.
Test before and after. A fix without a regression test is a fix that will break again.
Escalate without ego. Knowing when to stop and ask for help is a skill, not a weakness. See the escalation criteria above.
Document for the next person. The next person debugging this area might be you in six months. Leave the codebase more observable than you found it.
Never debug production by modifying production. Read-only investigation. Fixes go through the normal deployment pipeline.
Scope discipline. Fix the bug. Only the bug. Other improvements are separate tickets.
Share what you learn. Every significant bug is a learning opportunity for the team. Post-mortems are not blame — they are institutional memory.
development
Spawn and coordinate a pre-composed agent team from a team definition file. Reads team files from teams/, resolves agents and skills, picks the best spawning mode (peer or sequential), and runs the workflow. Use when the user asks to run a team, dispatch a development team, start a feature delivery, or coordinate multiple agents for a multi-phase task.
development
Pre-composed agent team library. Use when the user asks which teams are available, what a team does, when to pick one team over another, or to browse multi-agent compositions. Catalogs ready-to-run teams (development team, review squad, war room) with their purpose, agent roster, workflow type, and when to use each. The actual dispatching is handled by the dispatching-agent-teams skill.
tools
Ecosystem discovery advisor. Use when the user asks 'what skill should I use', 'what agent should I delegate to', 'which team fits this task', or when onboarding to available skills, agents, and teams. Scans ALL installed skills at runtime -- not limited to any single plugin or vendor. Triggers: 'which skill', 'which agent', 'what do I use for', 'orient me', 'what tools do I have'.
tools
Interactive tool to scaffold a complete Claude Code plugin -- plugin.json manifest, skills, agents, hooks, MCP servers, LSP servers, and an optional marketplace.json catalog entry. Use when the user asks to create a plugin, build a Claude Code plugin, scaffold a plugin marketplace, convert an existing .claude/ configuration into a plugin, or package skills and agents for distribution. Runs a guided questionnaire, writes all required files to disk, and prints test instructions.