python-debugpy — Claude Code skill: what it does, how to install
Guides interactive Python debugging with pdb and debugpy remote attach. Useful for tracking down broken tests, state mutations, and headless processes.
npx skills add openclaw/openclaw --skill python-debugpy -a claude-codeWhat python-debugpy does
The skill selects debugger strategies to reach the bad frame. For local code it suggests breakpoint(), while python3 -m pdb -c continue catches unhandled exceptions without modifying source files. It reproduces bugs with the smallest test command. Parallel test workers must be disabled because interactive stdin breaks in worker pools.
For headless services or running PIDs, it attaches via debugpy bound to 127.0.0.1:5678. The environment requires python3. On Linux, failed PID attachment is a clear reason to check container privileges and ptrace rather than swapping targets.
What it helps with
- catch unhandled exceptions with
python3 -m pdb -c continue - attach to a running Python process by PID using
debugpy - inspect local variables and call stacks in failing tests
- clean up leftover breakpoints before commit using
rg
Example prompts for the agent
- Debug the failing script.py using pdb without editing the source code.
- Launch module worker with debugpy and wait for client on port 5678.
- Search for leftover breakpoint() and debugpy calls before committing.
How to install python-debugpy
1Skills CLI (Vercel)
npx skills add openclaw/openclaw --skill python-debugpy -a claude-code2Manually: put the files in place
~/.claude/skills/python-debugpy/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/python-debugpy/
1Skills CLI (Vercel)
npx skills add openclaw/openclaw --skill python-debugpy -a codex2Manually: put the files in place
.agents/skills/python-debugpy/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add openclaw/openclaw --skill python-debugpy -a cursor2Manually: put the files in place
.cursor/skills/python-debugpy/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install openclaw/openclaw python-debugpy2Manually: put the files in place
.github/skills/python-debugpy/SKILL.md1Skills CLI (Vercel)
npx skills add openclaw/openclaw --skill python-debugpy -a gemini-cli2Platform CLI
gemini skills install https://github.com/openclaw/openclaw --path skills/python-debugpyManually: put the files in place
.devin/skills/python-debugpy/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add openclaw/openclaw --skill python-debugpy -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set48
The whole set →Similar
Questions about python-debugpy
How to install python-debugpy in Claude Code?
Run npx skills add openclaw/openclaw --skill python-debugpy -a claude-code in your terminal.
What does python-debugpy do?
It guides interactive Python debugging workflows, selecting between breakpoint(), standard pdb, post-mortem traces, and debugpy sessions.
What prerequisites are required?
The skill requires python3. For headless debugging or PID attachment, debugpy must be installed inside the active Python environment.
Source text
SKILL.md · MIT
---
name: python-debugpy
description: Debug Python with pdb, breakpoint(), post-mortem inspection, and debugpy remote attach.
metadata: { "openclaw": { "requires": { "bins": ["python3"] } } }
---
# Python Debugpy
Use when Python code needs interactive debugging: hidden locals, confusing state mutation, failing tests, subprocesses, long-running services, or remote/headless attach.
Pick the smallest debugger that reaches the bad frame.
## Choose
- `breakpoint()`: local code, source edits ok, fastest path.
- `python3 -m pdb`: no source edit, launch from the beginning.
- `python3 -m pdb -c continue`: stop at an unhandled exception.
- `debugpy`: remote/headless process, DAP client, already-running PID, or service startup race.
## Commands
```bash
python3 -m pdb path/to/script.py arg1
python3 -m pdb -c continue path/to/script.py
python3 -c "import debugpy" || python3 -m pip install debugpy
python3 -m debugpy --listen 127.0.0.1:5678 --wait-for-client path/to/script.py
python3 -m debugpy --listen 127.0.0.1:5678 --wait-for-client -m package.module
python3 -m debugpy --listen 127.0.0.1:5678 --pid <pid>
```
For source-edit attach:
```py
import debugpy
debugpy.listen(("127.0.0.1", 5678))
debugpy.wait_for_client()
debugpy.breakpoint()
```
For post-mortem:
```py
import pdb, sys
try:
run()
except Exception:
pdb.post_mortem(sys.exc_info()[2])
raise
```
## pdb
- Flow: `n`, `s`, `r`, `c`, `q`.
- Stack/source: `w`, `u`, `d`, `a`, `l`, `ll`.
- Values: `p expr`, `pp expr`, `display expr`.
- Breakpoints: `b file.py:42`, `b func`, `b file.py:42, condition`, `cl <num>`.
- Mutate/evaluate: `!statement`; full REPL: `interact`.
## Rules
- Reproduce with the smallest command/test first.
- Disable parallel test workers for pdb; interactive stdin usually breaks inside worker pools.
- Keep `debugpy` in the active env; do not add it as a project dependency unless the project already wants it.
- Bind debug servers to `127.0.0.1`; do not expose `0.0.0.0` unless isolated or tunnelled.
- Use unique ports for parallel sessions.
- `debugpy --pid` injects into a running process; confirm the target pid before attaching.
- If PID attach fails on Linux, check ptrace/container privileges before changing the target.
- Cleanup before commit: `rg -n 'breakpoint\\(|pdb\\.set_trace|debugpy\\.' --type py`.
- Rerun the normal project test/gate without the debugger.
- `PYTHONBREAKPOINT=0` disables `breakpoint()`.
- If a process is stuck after debugger detach, confirm it is not still paused at a breakpoint.
© openclaw · MIT · openclaw/openclaw