python-debugpy
Was er macht
Dieser Skill hilft deinem Agenten, Fehler in Python-Programmen zu finden, indem der Code angehalten und Werte geprüft werden. Er ist für Entwickler gedacht, deren print-Ausgaben das Problem nicht zeigen.
Wann du ihn nutzt
- ✓Wenn ein Python-Test fehlschlägt und der Traceback nicht zeigt, warum ein Wert falsch ist.
- ✓Wenn du durch eine Funktion schrittweise gehen willst und zusiehst, wie sich Daten während des Laufs ändern.
- ✓Wenn ein lange laufender Python-Prozess sich falsch verhält und du ihn nicht neu starten kannst.
Link zum Skill
https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/software-development/python-debugpy/SKILL.mdKopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.
So nutzt du ihn
Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.
Fertige Nachricht zum Einfügen
Für Claude Code, Codex oder Cursor: Führe den Befehl in deinem Projektordner aus, dann wird der Skill installiert.
Lade die SKILL.md herunter und lege sie in den Skills-Ordner deines Agenten.
Beispielanfrage an deine KI
“Meine Python-Funktion gibt die falsche Liste zurück, und print-Ausgaben helfen nicht. Kannst du mit mir Schritt für Schritt durchgehen?”
5 neue Skills pro Woche. 1 Minute Lesezeit.
So funktioniert es
Der Skill nutzt den eingebauten Python-Debugger pdb, den du über einen Haltepunkt im Code oder durch Starten des Skripts unter pdb aufrufst. Für laufende Prozesse nutzt er das Werkzeug debugpy, um sich remote anzuhängen.
Technischer Inhalt (originale SKILL.md)
Originaltext des Autors, auf Englisch, direkt von GitHub.
Python Debugger (pdb + debugpy)
Overview
Three tools, picked by situation:
| Tool | When |
|---|---|
breakpoint() + pdb |
Local, interactive, simplest. Add breakpoint() in the source, run normally, get a REPL at that line. |
python -m pdb |
Launch an existing script under pdb with no source edits. Useful for quick poking. |
debugpy |
Remote / headless / "attach to already-running process." Talks DAP, scriptable from terminal, works for long-lived processes (gateway, daemon, PTY children). |
Start with breakpoint(). It's the cheapest thing that works.
When to Use
- A test fails and the traceback doesn't reveal why a value is wrong
- You need to step through a function and watch a collection mutate
- A long-running process (hermes gateway, tui_gateway) misbehaves and you can't restart it
- Post-mortem: an exception fired in prod-ish code and you want to inspect locals at the crash site
- A subprocess / child (Python
_SlashWorker, PTY bridge worker) is the actual bug site
Don't use for: things print() / logging.debug solve in under a minute, or things pytest -vv --tb=long --showlocals already reveals.
pdb Quick Reference
Inside any pdb prompt ((Pdb)):
| Command | Action |
|---|---|
h / h cmd |
help |
n |
next line (step over) |
s |
step into |
r |
return from current function |
c |
continue |
unt N |
continue until line N |
j N |
jump to line N (same function only) |
l / ll |
list source around current line / full function |
w |
where (stack trace) |
u / d |
move up / down in the stack |
a |
print args of the current function |
p expr / pp expr |
print / pretty-print expression |
display expr |
auto-print expr on every stop |
b file:line |
set breakpoint |
b func |
break on function entry |
b file:line, cond |
conditional breakpoint |
cl N |
clear breakpoint N |
tbreak file:line |
one-shot breakpoint |
!stmt |
execute arbitrary Python (assignments included) |
interact |
drop into full Python REPL in current scope (Ctrl+D to exit) |
q |
quit |
The interact command is the most powerful — you can import anything, inspect complex objects, even call methods that mutate state. Locals are read-only by default; use !x = 42 from the (Pdb) prompt to mutate.
Recipe 1: Local breakpoint
Easiest. Edit the file:
def compute(x, y):
result = some_helper(x)
breakpoint() # <-- drops into pdb here
return result + y
Run the code normally. You land at the breakpoint() line with full access to locals.
Don't forget to remove breakpoint() before committing. Use git diff or a pre-commit grep:
rg -n 'breakpoint\(\)' --type py
Recipe 2: Launch a script under pdb (no source edits)
python -m pdb path/to/script.py arg1 arg2
# Lands at first line of script
(Pdb) b path/to/script.py:42
(Pdb) c
Recipe 3: Debug a pytest test
Use terminal and the canonical runner for noninteractive diagnostics:
# Show locals in tracebacks without pdb:
scripts/run_tests.sh tests/path/to/test_file.py --showlocals --tb=long
scripts/run_tests.sh captures each file in a separate subprocess, so --pdb
or --trace cannot provide an interactive prompt there. For an interactive
debugger only, use the independent development/test interpreter prepared in
Recipe 5 (never a production generation):
.venv/bin/python -m pytest tests/foo_test.py::test_bar --pdb
This bypasses the hermetic-env guarantees — fine for debugging, but re-run under the wrapper to confirm before pushing.
Recipe 4: Post-mortem on any exception
import pdb, sys
try:
run_the_thing()
except Exception:
pdb.post_mortem(sys.exc_info()[2])
Or wrap a whole script:
python -m pdb -c continue script.py
# When it crashes, pdb catches it and you're in the frame of the exception
Or set a global hook in a repl/jupyter:
import sys
def excepthook(etype, value, tb):
import pdb; pdb.post_mortem(tb)
sys.excepthook = excepthook
Recipe 5: Remote debug with debugpy (attach to running process)
For long-lived processes: Hermes gateway, tui_gateway, a daemon, a process that's already misbehaving and can't be restarted clean.
Setup
For Hermes, use a separate development checkout and data home, not a live production generation. Follow the [PM developer workflow](https://hermes-agent.nousres
Häufige Fragen
Wie fange ich am einfachsten an?
Der Skill sagt, füge eine Zeile breakpoint() im Code hinzu und führe ihn normal aus. Dann öffnet sich an dieser Stelle eine Debugger-Eingabeaufforderung.
Wofür wird debugpy genutzt?
Der Skill nutzt debugpy für Remote- oder Headless-Debugging und für bereits laufende Prozesse.
Wann sollte ich es nicht nutzen?
Der Skill sagt, nicht für Probleme, die print-Ausgaben oder pytest-Ausgaben in unter einer Minute zeigen.
Details
Originalbeschreibung des Autors
Debug Python: pdb REPL + debugpy remote (DAP).
Beliebtheit
- GitHub-Sterne
- 260k
- Platz im Ranking
- #574
- Lizenz
- MIT
- Aktualisiert
- 2.11.2026
Kommentare
- …
Weitere Skills aus diesem Repository
agent-merge-conflict-arbiter
260kLöst einen Git-Merge-Konflikt zwischen den Branches zweier Agenten als neutrale dritte Partei und erzeugt ein zusammengeführtes Ergebnis für das Repo.
antigravity-cli
260kFührt dich durch Installation, Aktualisierung und Fehlersuche des Antigravity-Kommandozeilenwerkzeugs, einschließlich Plugins, Anmeldung und Sandbox.
blackbox
260kLässt deinen Agenten eine Coding-Aufgabe an das Blackbox-KI-Kommandozeilenwerkzeug übergeben, das mehrere KI-Modelle nutzt und das beste Ergebnis auswählt.
dynamic-workflow
260kBringt deinem Agenten bei, große Stapel gleichartiger Arbeit als gespeichertes Skript auszuführen, sodass nur geprüfte Ergebnisse in die Hauptunterhaltung zurückkehren.
Ähnliche Skills
diffs
394kLässt deinen Agenten einen echten, teilbaren Diff seiner Änderungen als Viewer-Link oder Bilddatei erstellen, statt einer handgeschriebenen Zusammenfassung.
coding-agent
394kHilft deinem Agenten, eine größere Programmieraufgabe als Hintergrund-Worker an Codex, Claude Code oder OpenCode zu übergeben und danach den Fortschritt zu prüfen.
gh-issues
394kHilft deinem Agenten, GitHub-Issues zu finden, die zu bearbeitenden auszuwählen und Pull Requests mit Korrekturen zu öffnen, einschließlich der Nacharbeit an Review-Kommentaren.