skills/systematic-debugging/SKILL.md
Enforces root-cause investigation before any fix attempt using a rigorous four-phase methodology: investigate, analyze patterns, hypothesize, implement. Use when encountering any bug, test failure, unexpected behavior, or performance regression — especially under time pressure or after multiple failed fix attempts.
npx skillsauth add shipshitdev/library systematic-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.
Random fixes waste time and create new bugs. Quick patches mask underlying issues.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST.
If Phase 1 is not complete, no fix may be proposed.
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
Use for ANY technical issue:
Use this ESPECIALLY when:
Do not skip when:
Complete each phase before proceeding to the next.
Before attempting ANY fix:
1. Read error messages carefully.
2. Reproduce consistently.
3. Check recent changes.
4. Gather evidence in multi-component systems.
When a system has multiple components (e.g., API → service → database, CI → build → signing):
Before proposing any fix, add diagnostic instrumentation at each component boundary:
For EACH component boundary:
- Log what data enters the component
- Log what data exits the component
- Verify environment / config propagation
- Check state at each layer
Run once to gather evidence showing WHERE it breaks.
Analyze evidence to identify the failing component.
Then investigate that specific component.
Example instrumentation pattern:
# Layer 1: entry point
echo "=== Input at layer 1: ${VAR:+SET}${VAR:-UNSET} ==="
# Layer 2: downstream component
echo "=== Env vars reaching layer 2: ==="
env | grep VAR || echo "VAR not in environment"
# Layer 3: leaf operation
echo "=== State at layer 3: ==="
# inspect relevant runtime state here
This reveals which layer fails (e.g., value passes layer 1 but is missing at layer 2).
5. Trace data flow.
When an error is deep in a call stack:
Find the pattern before fixing:
Apply scientific method:
Fix the root cause, not the symptom:
Create a failing test case — the simplest possible reproduction — automated if a test framework exists, a one-off script otherwise. This must exist before the fix is written.
Implement a single fix. Address the identified root cause. One change at a time. No "while I'm here" improvements or bundled refactoring.
Verify the fix.
If the fix does not work:
If 3+ fixes have failed — question the architecture.
Signs of an architectural problem:
Stop and question fundamentals:
Discuss with the user before attempting any further fixes. This is not a failed hypothesis — it is a wrong architecture.
If any of these thoughts arise, stop immediately:
All of these mean: STOP. Return to Phase 1.
If 3+ fixes have failed: question the architecture (Phase 4, step 5).
| Excuse | Reality | |--------|---------| | "Issue is simple, don't need process" | Simple issues have root causes too. Process is fast for simple bugs. | | "Emergency, no time for process" | Systematic debugging is faster than guess-and-check thrashing. | | "Just try this first, then investigate" | The first fix sets the pattern. Do it right from the start. | | "I'll write the test after confirming the fix works" | Untested fixes do not stick. A test first proves it. | | "Multiple fixes at once saves time" | Cannot isolate what worked. Causes new bugs. | | "Reference too long, I'll adapt the pattern" | Partial understanding guarantees bugs. Read it completely. | | "I see the problem, let me fix it" | Seeing symptoms does not equal understanding root cause. | | "One more fix attempt" (after 2+ failures) | 3+ failures = architectural problem. Question the pattern, do not fix again. |
| Phase | Key Activities | Success Criteria | |-------|----------------|------------------| | 1. Root Cause | Read errors, reproduce, check changes, gather evidence | Understand WHAT and WHY | | 2. Pattern | Find working examples, compare against broken | Differences identified | | 3. Hypothesis | Form specific theory, test minimally | Confirmed or new hypothesis formed | | 4. Implementation | Create failing test, apply single fix, verify | Bug resolved, tests pass |
If systematic investigation genuinely reveals the issue is environmental, timing-dependent, or fully external:
Note: 95% of "no root cause found" cases are incomplete investigation. Exhaust Phase 1 fully before concluding this.
development
TypeScript refactoring and modernization guidelines from a principal specialist perspective. This skill should be used when refactoring, reviewing, or modernizing TypeScript code to ensure type safety, compiler performance, and idiomatic patterns. Triggers on tasks involving TypeScript type architecture, narrowing, generics, error handling, or migration to modern TypeScript features.
tools
Resolves TypeScript and JavaScript problems across type-level programming, performance, monorepo management, migration, and modern tooling. Invoke when diagnosing "type instantiation excessively deep" errors, migrating JS to TS, configuring strict tsconfig, debugging module resolution, or choosing between Biome/ESLint/Turborepo/Nx.
tools
Turborepo monorepo build system guidance. Triggers on: `turbo.json`, task pipelines, `dependsOn`, caching, remote cache, the `turbo` CLI, `--filter`, `--affected`, CI optimization, environment variables, internal packages, monorepo structure, and package boundaries. Use when the user configures tasks or workflows, creates packages, sets up a monorepo, shares code between apps, runs changed packages, debugs cache behavior, or works in an `apps/` plus `packages/` workspace.
tools
Provides Tailwind CSS v4 performance optimization and best practices guidelines. Triggers when writing, reviewing, or refactoring Tailwind CSS v4 code; when working with Tailwind configuration, @theme directive, utility classes, responsive design, dark mode, container queries, or CSS generation optimization.