Cc debugging

From ryanthedev/code-foundations · View interactive version

Cc debugging is an AI agent skill from the GitHub repository ryanthedev/code-foundations. Applies Code Complete's scientific debugging method: STABILIZE → LOCATE → HYPOTHESIZE → EXPERIMENT → FIX → TEST → SEARCH. For active bug investigation, not QA process design or test coverage planning (use cc-quality-practices).

How to use this skill

Skill file

cc-debugging

Most debugging time goes to finding and understanding the defect; the fix is usually obvious once you understand it. Every action tests a hypothesis — no guessing, no random changes.

First action on any bug: run the failing test or repro and read its actual output. Do this before reading the source in depth and before editing anything — the observed failure, not the code you infer it from, is what you debug. If the usual runner is unavailable (e.g. no pytest), fall back to a runnable form (python3 -c, a direct script) and capture that output now, not after a fix.

Scientific Debugging Method

STABILIZE → LOCATE → HYPOTHESIZE → EXPERIMENT → FIX → TEST → SEARCH

Step 1: STABILIZE

Get a reliable reproduction — you cannot debug what you cannot reproduce.

Precondition on editing: the first tool action of the session is running the failing test or repro, and its output is captured, BEFORE any Edit to implementation code. The order is run-test → then edit, never edit-then-test. If the standard runner is missing, run the repro another way (python3 -c, a direct script) and capture that — the missing runner does not excuse skipping the observed failure.

Step 2: LOCATE

Narrow the suspicious region before forming a hypothesis.

Step 3: HYPOTHESIZE

Form a specific, testable hypothesis — not "the bug is somewhere in module X."

Step 4: EXPERIMENT

Design a test that will disprove the hypothesis, not confirm it.

Step 5: FIX

Fix the root cause, not the symptom.

If the defect sits in untested legacy code, get it under test before fixing: Skill(code-foundations:welc-legacy-code). If the fix needs structural refactoring, separate it from the fix: Skill(code-foundations:cc-refactoring-guidance).

Step 6: TEST

Verify the fix actually works — about half of bug fixes are wrong the first time (Yourdon 1986b).

Step 7: SEARCH

Defects cluster — if this bug existed, similar ones likely exist nearby.

Precondition on completing: before reporting the fix complete, a search for the same defect pattern (grep/Glob) has been run and its result recorded.


Common Defects Quick Check

Rule these out before deep investigation:

When quick checks fail and the systematic method stalls, the brute-force techniques (full code review, isolate in a harness, rewrite the section) and the full defect catalog are in Read(${CLAUDE_SKILL_DIR}/checklists.md).


Confessional debugging

Explain the problem out loud, to a person or a rubber duck. Articulation frequently reveals the bug before the listener responds.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.