workflows/workflows/agent-environment-setup/platforms/antigravity/skills/systematic-debugging/SKILL.md
Systematic debugging methodology covering root cause analysis, bisection, logging strategies, debugger workflows, and post-mortem documentation. Use when diagnosing complex or elusive bugs.
npx skillsauth add cubetiq/cubis-foundry 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.
Provide a disciplined, evidence-based framework for diagnosing and resolving software defects. This skill replaces ad-hoc "change and pray" debugging with a structured process that converges on root causes efficiently, documents findings for the team, and prevents recurrence through post-mortem analysis.
Reproduce the defect reliably before investigating -- Write down exact steps, inputs, and environment conditions that trigger the bug. Without a reliable reproduction, you cannot verify that a fix actually works.
Collect and preserve all available evidence -- Gather logs, stack traces, error messages, screenshots, and metrics from the time of the failure. Evidence degrades over time as logs rotate and state changes.
Form a falsifiable hypothesis -- State a specific, testable explanation for the bug (e.g., "The null pointer occurs because the cache returns stale entries after TTL expiry"). Vague hypotheses like "something is wrong with caching" cannot be tested.
Use bisection to narrow the search space -- Apply git bisect or manual binary search to identify the exact commit, configuration change, or input that introduced the defect. Bisection converges in O(log n) steps instead of linear scanning.
Add strategic logging at boundaries -- Insert log statements at function entry/exit, external calls, and decision points. Strategic logging reveals the actual execution path without the overhead of stepping through every line.
Use a debugger for state inspection, not navigation -- Set breakpoints at the suspected failure point and inspect variable state. Stepping through large codebases line-by-line is slow; jump directly to where the evidence points.
Verify each hypothesis with a controlled experiment -- Change one variable at a time and observe the result. Changing multiple things simultaneously makes it impossible to determine which change was effective.
Trace data flow end-to-end -- Follow the input from its origin through every transformation to the point of failure. Data corruption bugs often originate far upstream from where they manifest.
Check environmental differences systematically -- Compare OS versions, library versions, configuration files, environment variables, and network topology between working and broken environments. "Works on my machine" bugs are almost always environmental.
Apply the Five Whys to reach root cause -- Ask "why" iteratively until you reach a systemic cause, not just the proximate trigger. Fixing symptoms without addressing root causes guarantees recurrence.
Write a regression test before applying the fix -- Create a test that fails with the current code and passes with the fix. The regression test proves the fix is correct and prevents the bug from returning.
Review the fix for secondary effects -- Check that the fix does not break other functionality, introduce new edge cases, or degrade performance. Fixes under pressure often create new bugs.
Search for similar patterns in the codebase -- After identifying the root cause, search for the same pattern elsewhere. If the bug exists in one place, it likely exists in analogous code.
Document the investigation in a post-mortem -- Record the timeline, root cause, fix, impact, and prevention measures. Post-mortems convert individual debugging knowledge into organizational learning.
Identify and implement prevention measures -- Add linting rules, type constraints, monitoring alerts, or architectural guards that make the bug class impossible or immediately detectable. Prevention is cheaper than repeated debugging.
Update runbooks and monitoring -- Add the failure signature to monitoring dashboards and update operational runbooks with diagnosis steps. The next occurrence should be detected automatically and diagnosed in minutes, not hours.
## Debugging Report
### Defect Summary
- **Title:** <concise description>
- **Severity:** Critical / High / Medium / Low
- **Environment:** <where it occurs>
- **Reproduction Rate:** Always / Intermittent (<percentage>)
### Reproduction Steps
1. <exact step>
2. <exact step>
3. **Expected:** <what should happen>
4. **Actual:** <what happens instead>
### Investigation Timeline
| Step | Action | Finding |
|------|--------|---------|
| 1 | ... | ... |
| 2 | ... | ... |
### Root Cause Analysis (Five Whys)
1. **Why** did <symptom> occur? Because <reason>.
2. **Why** did <reason> occur? Because <deeper reason>.
3. **Why** did <deeper reason> occur? Because <root cause>.
### Fix
- **Commit:** <hash>
- **Change:** <description>
- **Regression Test:** <test name>
### Prevention Measures
| Measure | Type | Status |
|---------------------|----------------|-------------|
| ... | Lint rule / Monitor / Guard | Implemented / TODO |
### Post-Mortem
- **Impact:** <users affected, duration>
- **Detection:** <how it was found>
- **Resolution Time:** <from detection to fix>
- **Lessons Learned:** <1-3 takeaways>
| Topic | File | Load When |
|----------------------|-----------------------------------------|-------------------------------------------------|
| Root Cause Analysis | references/root-cause-analysis.md | Applying Five Whys and fault tree analysis |
| Bisection | references/bisection.md | Using git bisect and binary search strategies |
| Logging Strategies | references/logging-strategies.md | Adding diagnostic logging without noise |
| Debugger Workflows | references/debugger-workflows.md | Using breakpoints, watches, and stepping |
| Post-Mortem | references/post-mortem.md | Writing incident post-mortems and prevention |
tools
Use when investigating latest vendor behavior, comparing tools or platforms, verifying claims beyond the repo, or gathering external evidence before implementation.
documentation
Use when designing database schemas, normalization strategies, indexing plans, query optimization, and migration workflows for relational, document, or hybrid data stores.
development
Use when writing, reviewing, or refactoring modern C#/.NET code, including minimal APIs, records, async streams, pattern matching, DI lifetimes, and memory-efficient performance tuning.
development
Use when conducting code reviews, building review checklists, calibrating review depth, providing structured feedback, or establishing team review practices. Covers review methodology, feedback patterns, automated checks, and batch review strategies.