OpenParable
Skip to content
← Back to skills

Debugging Patterns Skill

Testing & Quality

Debugging Patterns Skill is an Agent Skill for testing & quality published in the majiayu000/claude-skill-registry repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Systematic problem-solving and error analysis.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/majiayu000/claude-skill-registry/blob/HEAD/skills/development/debugging-patterns-fabioc-aloha-airs-data-analysis/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/debugging-patterns-skill, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Debugging Patterns Skill

Systematic problem-solving and error analysis.

The Debugging Mindset

  1. Reproduce — Can you make it happen consistently?
  2. Isolate — What's the smallest case that fails?
  3. Hypothesize — What could cause this?
  4. Test — Prove or disprove your hypothesis
  5. Fix — Change ONE thing
  6. Verify — Did it actually fix it?

Binary Search Debugging

When you don't know where the problem is:

1. Find a known-good state (commit, version, config)
2. Find the known-bad state (current)
3. Test the midpoint
4. Repeat until you find the breaking change

Git bisect automates this:

git bisect start
git bisect bad                    # Current is broken
git bisect good <known-good-sha>  # This worked
# Git checks out midpoint, you test, then:
git bisect good  # or  git bisect bad
# Repeat until found
git bisect reset                  # Return to normal

Stack Trace Reading

Error: Cannot read property 'x' of undefined
    at processData (src/utils.ts:45:12)      ← LOOK HERE FIRST
    at handleRequest (src/api.ts:123:8)
    at Router.handle (node_modules/...)

Pattern: Read bottom-up for context, top-down for cause.

Common Error Categories

SymptomLikely CauseCheck
"undefined is not a function"Wrong import/exportModule paths, named vs default
"Cannot find module"Path or package issueRelative paths, node_modules
"ENOENT"File not foundPath typo, file doesn't exist
"EACCES"Permission deniedFile permissions, admin rights
Silently failsSwallowed errorAdd try/catch, check promises
Works locally, fails in CIEnvironment diffEnv vars, paths, versions

Logging Strategy

// Bad: console.log("here")
// Good: console.log("[processData] input:", data, "state:", state)

// Even better: structured logging
log.debug({ fn: 'processData', input: data, state }, 'Processing started');

Rubber Duck Debugging

When stuck:

  1. Explain the problem out loud (or in text)
  2. Describe what SHOULD happen
  3. Describe what ACTUALLY happens
  4. Walk through the code step by step
  5. Often, the explanation reveals the bug

Hypothesis Testing

Don't just change things randomly:

❌ "Let me try this... and this... and this..."
✅ "I think X is null because Y. Let me add a log to confirm."

Environment Debugging

# Check environment variables
$env:PATH
$env:NODE_ENV

# Check versions
node --version
npm --version
code --version

# Check what's installed
npm list --depth=0

Anti-Patterns

  • ❌ Changing multiple things at once
  • ❌ Assuming you know the cause without evidence
  • ❌ Ignoring error messages
  • ❌ "It works on my machine" without investigating why
  • ❌ Removing error handling to "fix" errors

Synapses

See synapses.json for connections.