glawson6/jaiclaw/python-debugpy

Claude Code and agent skill by glawson6/jaiclaw

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Python debugging with pdb, debugpy, and remote attach

Install

npx vskill@latest install glawson6/jaiclaw/python-debugpy

SKILL.md

The same SKILL.md was published earlier as glawson6/jaiclaw/python-debugpy.

Python Debugging

Debug Python applications using pdb (built-in), debugpy (VS Code protocol), and remote attach workflows. Covers breakpoints, post-mortem debugging, and profiling.

pdb — Built-in Debugger

Launching
bash
# Run script under pdb
python3 -m pdb script.py
# Post-mortem on crash
python3 -c "
import mymodule
try:
mymodule.run()
except Exception:
import pdb; pdb.post_mortem()
"
Inline Breakpoints
python
# Insert in source code (Python 3.7+)
breakpoint()
# Or explicitly
import pdb; pdb.set_trace()
Key Commands
CommandAction
n / nextStep over
s / stepStep into
c / continueContinue execution
r / returnContinue until function returns
l / listShow source around current line
llShow full source of current function
p exprPrint expression value
pp exprPretty-print expression value
w / wherePrint stack trace
u / upMove up one frame
d / downMove down one frame
b file:lineSet breakpoint
cl numClear breakpoint
commands numSet commands to run at breakpoint
interactStart interactive interpreter in current frame
Conditional Breakpoints
python
# Break only when condition is true
import pdb; pdb.set_trace() if len(items) > 100 else None
# In pdb prompt:
# b 42, x > 10 # break at line 42 when x > 10

debugpy — Remote Debugging

Install
bash
pip install debugpy
Launch Modes
bash
# Listen for attach (pauses until client connects)
python3 -m debugpy --listen 0.0.0.0:5678 --wait-for-client script.py
# Listen without waiting
python3 -m debugpy --listen 5678 script.py
# Attach to running process by PID
python3 -m debugpy --listen 5678 --pid 12345
Programmatic Setup
python
import debugpy
# Start debug server
debugpy.listen(("0.0.0.0", 5678))
print("Waiting for debugger attach...")
debugpy.wait_for_client()
debugpy.breakpoint()
# Now run your code
main()
Remote Attach via DAP

Connect any DAP-compatible client to the debug server:

json
{
"type": "debugpy",
"request": "attach",
"connect": { "host": "localhost", "port": 5678 },
"pathMappings": [
{ "localRoot": "${workspaceFolder}", "remoteRoot": "/app" }
]
}

Profiling

cProfile
bash
# Profile script and sort by cumulative time
python3 -m cProfile -s cumulative script.py
# Save profile data
python3 -m cProfile -o profile.stats script.py
# Analyze saved profile
python3 -c "
import pstats
p = pstats.Stats('profile.stats')
p.sort_stats('cumulative')
p.print_stats(20)
"
line_profiler
bash
pip install line_profiler
# Decorate functions with @profile, then:
kernprof -l -v script.py
memory_profiler
bash
pip install memory_profiler
# Decorate functions with @profile, then:
python3 -m memory_profiler script.py

Common Patterns

Debug Django
bash
# Django with debugpy
python3 -m debugpy --listen 5678 manage.py runserver --noreload
Debug pytest
bash
# Drop into pdb on failure
python3 -m pytest --pdb
# Drop into pdb on first failure then quit
python3 -m pytest -x --pdb
# Use debugpy with pytest
python3 -m debugpy --listen 5678 -m pytest tests/
Debug in Docker
dockerfile
# Expose debug port
EXPOSE 5678
CMD ["python3", "-m", "debugpy", "--listen", "0.0.0.0:5678", "app.py"]

Rules

  1. Use `breakpoint()` over import pdb; pdb.set_trace() for Python 3.7+.
  2. Use `--wait-for-client` when you need to debug startup code.
  3. Use `--noreload` with Django to avoid debugger disconnects on file changes.
  4. Profile first — use cProfile before reaching for a debugger on performance issues.
  5. Check `PYTHONBREAKPOINT` env var — it controls what breakpoint() calls.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/glawson6/jaiclaw/python-debugpy/badge)](https://verified-skill.com/skills/glawson6/jaiclaw/python-debugpy)

Something wrong with this skill or its page? Tell us.