Skip to content
Back to skills

517 Debug Session

ASecurity

Combined debugging workflow: activates caveman mode, maps the relevant code area, builds a trusted feedback loop, runs falsifiable diagnosis, uses language-specific debugging tools, and ends with cleanup plus handoff. Use when starting a debugging or investigation session.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 29, 2026
developmentjavascripttypescriptpythonrustgojavaswiftbashnodetesting

Works with

  • cli
  • api

Security analysis

A96/100
  • mediumUses curl or wget to download content

Pro scans all 3 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add winlem2024/workbuddy-skills --skill 517-debug-session --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 517 Debug Session?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 517 Debug Session
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/winlem2024-517-debug-session/badge)](https://www.skillsdirectory.com/skills/winlem2024-517-debug-session)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: debug-session
description: Combined debugging workflow: activates caveman mode, maps the relevant code area, builds a trusted feedback loop, runs falsifiable diagnosis, uses language-specific debugging tools, and ends with cleanup plus handoff. Use when starting a debugging or investigation session.
---

Run the following sequence.

## Design principle

This skill is the debugging commander, not a reference note. Follow the workflow order strictly. Use the command toolbox only inside the relevant phase, especially Instrument and Feedback Loop. Do not run random commands before reproduction and hypotheses are clear.

## Step 1 — Caveman mode on

Switch to caveman communication for this session: drop all filler, articles, and pleasantries. Keep full technical accuracy. Stay in caveman mode until the user says "stop caveman" or "normal mode".

## Step 2 — Zoom out

Go up a layer of abstraction. Give a map of all relevant modules and callers in the area related to the current problem, using the project's domain glossary vocabulary. If no CONTEXT.md exists, infer domain terms from the codebase.

When relevant, identify:
- Entry point
- Caller chain
- Data shape
- State transition
- External dependency
- Test seam
- Owner boundary

## Step 3 — Diagnose

Run the full diagnosis discipline.

### Phase 1 — Build a feedback loop first

Try in order:
1. Failing test at the relevant seam
2. curl/HTTP script against dev server
3. CLI invocation diffing stdout against known-good snapshot
4. Headless browser script
5. Throwaway harness with mocked deps
6. Property/fuzz loop for intermittent failures
7. Bisection harness if bug appeared between two known states
8. Replay a captured trace — save a real request/payload/event log, replay it through the code path in isolation
9. Differential loop — run the same input through old-vs-new version (or two configs) and diff outputs

Once you have a loop, sharpen it: make it faster (cache setup, narrow scope), more deterministic (pin time, seed RNG, freeze network), and assert on the specific symptom — not "didn't crash". A 2-second deterministic loop beats a 30-second flaky one.

Do not proceed to Phase 2 without a loop you believe in.

**If you genuinely cannot build a loop: STOP.** Say so explicitly, list what you tried, and ask the user for environment access, a captured artifact (HAR/log/core dump), or permission to add temporary instrumentation. Do NOT proceed to Phase 3 and hypothesise without a loop.

### Phase 2 — Reproduce

Confirm the loop produces the exact failure the user described. Wrong bug = wrong fix.

Document:
- Exact steps
- Input data
- Environment
- Expected result
- Actual result
- Whether failure is deterministic or intermittent

### Phase 3 — Hypothesise

Generate 3–5 ranked falsifiable hypotheses before testing any. Show ranked list to user before proceeding.

Format every hypothesis as:

> If X is the cause, then changing Y will make the bug disappear.

### Phase 4 — Instrument

One variable at a time. Tag all debug logs `[DEBUG-xxxx]` for easy cleanup. Prefer debugger/REPL over log spam. For perf regressions: measure first, fix second.

Use the command toolbox below only when it matches the current hypothesis.

#### JavaScript / TypeScript

```bash
# Node.js debugger
node --inspect-brk app.js
# Chrome DevTools: chrome://inspect

# Console debugging
console.log(JSON.stringify(obj, null, 2))
console.trace("Call stack here")
console.time("perf"); /* code */ console.timeEnd("perf")

# Memory leaks
node --expose-gc --max-old-space-size=4096 app.js
```

#### Python

```bash
# Built-in debugger
python -m pdb script.py

# Breakpoint in code
breakpoint()

# Verbose tracing
python -X tracemalloc script.py

# Profile
python -m cProfile -s cumulative script.py
```

#### Swift

```bash
# LLDB debugging
lldb ./MyApp
(lldb) breakpoint set --name main
(lldb) run
(lldb) po myVariable

# Xcode: Product -> Profile (Instruments)
```

#### CSS / layout

```css
* { outline: 1px solid red !important; }
.debug { background: rgba(255,0,0,0.1) !important; }
```

#### Network

```bash
# HTTP debugging
curl -v https://api.example.com/endpoint
curl -w "@curl-format.txt" -o /dev/null -s https://example.com

# DNS
dig example.com
nslookup example.com

# Ports
lsof -i :3000
netstat -tlnp
```

#### Git bisection

```bash
git bisect start
git bisect bad
git bisect good abc1234
# Test checked-out commit, then mark it:
git bisect good
# or:
git bisect bad
git bisect reset
```

#### Quick diagnostic commands

```bash
# What's using this port?
lsof -i :PORT

# What's this process doing?
ps aux | grep PROCESS

# Watch file changes
fswatch -r ./src

# Disk space
df -h

# System resource usage
top -l 1 | head -10
```

#### Common error patterns

| Error | Likely cause | First check |
|-------|--------------|-------------|
| `Cannot read property of undefined` | Missing null check or wrong data shape | Validate input shape and caller contract |
| `ENOENT` | File or directory does not exist | Check path, working directory, and creation step |
| `CORS error` | Backend missing CORS headers | Check allowed origins and middleware order |
| `Module not found` | Missing dependency or wrong import path | Check package install and path alias config |
| `Hydration mismatch` | Server/client rendered different HTML | Check client-only state and deterministic rendering |
| `Segmentation fault` | Memory corruption or invalid pointer | Check array bounds, pointer validity, native dependency |
| `Connection refused` | Service not running on expected port | Check process, port, host, container mapping |
| `Permission denied` | File or network permission issue | Check ownership, chmod, sandbox, firewall |

### Phase 5 — Fix + regression test

Write the regression test before the fix, but only at a correct seam. If no correct seam exists, that is the finding; note it.

Apply the minimal correct fix. Do not refactor while debugging unless refactor is required to expose the correct seam.

### Phase 6 — Cleanup

Before declaring done, confirm every box:

- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)
- [ ] Regression test passes (or absence of a correct seam is documented)
- [ ] All `[DEBUG-...]` instrumentation removed — verify with `grep -r "\[DEBUG-"`
- [ ] Throwaway prototypes/harnesses deleted (or moved to a clearly-marked debug location)
- [ ] Winning hypothesis stated in the commit message or handoff note

## Step 4 — Handoff when session ends

When the user signals they are done or the session is wrapping up, generate a handoff document summarising:
- What was reported
- What was reproduced
- Winning hypothesis
- What was fixed
- Regression coverage
- What is still open
- What the next session should focus on

Save the handoff document to the OS temp directory.

Files in this skill

  • SKILL.md6.7 KB
  • _meta.json106 B
  • _skillhub_meta.json680 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.