python-debugpy
できること
このスキルは、pdbやdebugpyを含むPythonのデバッグツールを使い、コードを一時停止して状態を調べる手順を、AIエージェントに示します。Pythonのコードやサービスで厄介なバグを見つけたい開発者のためのものです。
使う場面
- ✓Pythonのスクリプトが妙な動きをし、ある地点での値を確認する必要があるとき。
- ✓Pythonのテストが失敗し、その中を段階的に追いたいとき。
- ✓長く動いているPythonのサービスを、リモートでデバッガーに接続する必要があるとき。
スキルのリンク
https://github.com/openclaw/openclaw/blob/main/skills/python-debugpy/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“私のPythonのスクリプトが誤った数字を出しています。正しい地点で一時停止して、変数の値を見せてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
このスキルは、問題に到達できる最も小さいデバッガーを選びます。pdbセッションや、コード内のブレークポイントなどです。そのうえでプログラムを段階的に進め、値を確認し、修正案を提案します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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
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:
import debugpy
debugpy.listen(("127.0.0.1", 5678))
debugpy.wait_for_client()
debugpy.breakpoint()
For post-mortem:
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
debugpyin 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 expose0.0.0.0unless isolated or tunnelled. - Use unique ports for parallel sessions.
debugpy --pidinjects 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=0disablesbreakpoint().- If a process is stuck after debugger detach, confirm it is not still paused at a breakpoint.
よくある質問
コードを変更する必要がありますか?
必ずしも必要ではありません。pdbセッションはソースを変更せずに始められますが、コード内のブレークポイントのほうが速い場合もあります。
実行中のサービスをデバッグできますか?
はい。debugpyは、実行中のプロセスや、起動中のサービスに接続できます。
デバッグポートを開くのは安全ですか?
スキルはデバッグポートにローカルのアドレス127.0.0.1を使うため、自分のマシンからしか接続できません。
詳細
作者による元の説明
Debug Python with pdb, breakpoint(), post-mortem inspection, and debugpy remote attach.
repo: openclaw/openclaw
人気
- GitHubのスター
- 394k
- ランキング
- #76
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
discord-user-post
394kエージェントが、承認済みのお知らせをDiscordのデスクトップアプリからあなたとして投稿できるよう支援します。投稿前に正確なチャンネルを確認します。
discrawl
394k保存済みのローカルなDiscordメッセージのアーカイブを検索して要約し、その新しさを確認し、ダイレクトメッセージを読めるようエージェントを支援します。
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
graincrawl
394k保存されたGranolaのミーティングメモとトランスクリプトを検索し、その新しさを確認して、一定期間の件数を数えるようエージェントを支援します。
似ているスキル
executing-plans
311k書かれた実装計画を、現在のセッションの中で段階的に実行し、次に進む前に各ステップをテストするようエージェントを支援します。
finishing-a-development-branch
311k完成したコードを、テストを実行してから、マージ、プルリクエストの作成、またはブランチの保持という明確な選択肢を示すことで仕上げるようエージェントを支援します。
receiving-code-review
311kコードレビューのフィードバックを慎重に検討し、変更を加える前に、各指摘がコードに照らして正しいかを確認するようエージェントを支援します。