python-debugpy
Что он делает
Скилл помогает вашему ИИ находить ошибки в программах на Python, приостанавливая код и проверяя значения. Он нужен разработчикам, у которых вывод через print не показывает проблему.
Когда использовать
- ✓Когда тест на Python падает, а трассировка не показывает, почему значение неверно.
- ✓Когда нужно пройти функцию по шагам и смотреть, как меняются данные во время выполнения.
- ✓Когда долгий процесс Python работает неправильно и его нельзя перезапустить.
Ссылка на скилл
https://github.com/NousResearch/hermes-agent/blob/main/optional-skills/software-development/python-debugpy/SKILL.mdСкопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.
Как использовать
Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.
Готовое сообщение для вставки
Для Claude Code, Codex или Cursor: запустите в папке проекта, и скилл установится.
Скачайте SKILL.md и положите его в папку скиллов вашего агента.
Пример запроса к вашему ИИ
“Моя функция на Python возвращает неправильный список, а print не помогает. Можешь пройти её вместе со мной по шагам?”
5 новых скиллов в неделю. 1 минута чтения.
Как это работает
Скилл использует встроенный отладчик pdb, который запускается точкой останова в коде или запуском скрипта под pdb. Для уже работающих процессов он использует инструмент debugpy и подключается удалённо.
Технический текст (оригинальный SKILL.md)
Оригинальный текст автора на английском, прямо с 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
Частые вопросы
Какой самый простой способ начать?
Скилл советует добавить строку breakpoint() в код и запустить его обычным образом, тогда отладчик откроется на этой строке.
Для чего нужен debugpy?
Скилл использует debugpy для удалённой отладки без интерфейса и для процессов, которые уже запущены.
Когда его не стоит использовать?
Скилл советует не использовать его для проблем, которые print или вывод pytest покажут меньше чем за минуту.
Подробности
Оригинальное описание автора
Debug Python: pdb REPL + debugpy remote (DAP).
Популярность
- Звёзды на GitHub
- 260k
- Место в рейтинге
- #574
- Лицензия
- MIT
- Обновлён
- 02.11.2026
Комментарии
- …
Другие скиллы из этого репозитория
agent-merge-conflict-arbiter
260kРазрешает конфликт слияния git между ветками двух агентов как нейтральная третья сторона и создает один объединенный результат для репозитория.
antigravity-cli
260kПомогает установить, обновить и устранить неполадки в командной строке Antigravity, включая плагины, вход в аккаунт и песочницу.
blackbox
260kПозволяет агенту передать задачу по коду инструменту командной строки Blackbox AI, который запускает несколько ИИ-моделей и выбирает лучший результат.
dynamic-workflow
260kУчит агента выполнять большие пакеты однотипной работы как сохраненный скрипт, чтобы в основной разговор возвращались только проверенные результаты.
Похожие скиллы
diffs
394kПозволяет агенту создать настоящее сравнение правок в виде ссылки или файла изображения, которым можно поделиться, вместо ручной сводки.
coding-agent
394kПомогает агенту передать большую задачу по коду в Codex, Claude Code или OpenCode как фоновому исполнителю, а затем проверять ее ход.
gh-issues
394kПомогает агенту находить задачи GitHub, выбирать, над какими работать, и открывать запросы на слияние с исправлениями, включая ответы на комментарии рецензентов.