Communityコーディング&開発github.com

Python Debugpy

pdb、breakpoint()、ポストモーテム検査、および debugpy リモートアタッチを使用して Python コードをデバッグします。

Python Debugpy とは?

このスキルは、Python コードのインタラクティブなデバッグに必要なすべてのツールを提供します。隠れたローカル変数、混乱する状態変更、失敗するテスト、サブプロセス、長時間実行サービス、リモート/ヘッドレスプロセスなど、デバッグが困難なシナリオに対応します。breakpoint() や pdb コマンドによるローカルデバッグから、debugpy を使用したリモートアタッチ、ポストモーテム検査まで、問題の性質に応じて最適なデバッグ方法を選択できます。Claude Code や Cursor などの AI エージェント環境で使用することを想定して設計されており、デバッグ後にブレークポイントが残らないようにするクリーンアップコマンドや、ptrace 権限の確認など、実践的なルールも含まれています。pdb のステップ実行、スタックトレース、変数評価、ブレークポイント設定といった基本的な操作に加え、debugpy によるリモートデバッグ、PID アタッチ、ソース編集不要のデバッグ起動など、高度な機能をサポートします。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/skills/python-debugpy

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Python Debugpy は何をしますか?

Python コードでインタラクティブなデバッグが必要な場合に使用します。隠れたローカル変数、混乱する状態変化、失敗するテスト、サブプロセス、長時間実行サービス、リモート/ヘッドレスアタッチなどに対応します。

問題のフレームに到達できる最小のデバッガを選択してください。

選択

  • breakpoint(): ローカルコード、ソース編集が可能、最速のパス。
  • python3 -m pdb: ソース編集不要、最初から起動。
  • python3 -m pdb -c continue: 未処理の例外で停止。
  • debugpy: リモート/ヘッドレスプロセス、DAP クライアント、既に実行中の PID、またはサービス起動時の競合に対応。

コマンド

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>

ソース編集によるアタッチの場合:

import debugpy

debugpy.listen(("127.0.0.1", 5678))
debugpy.wait_for_client()
debugpy.breakpoint()

ポストモーテムの場合:

import pdb, sys

try:
    run()
except Exception:
    pdb.post_mortem(sys.exc_info()[2])
    raise

pdb

  • フロー: n, s, r, c, q。
  • スタック/ソース: w, u, d, a, l, ll。
  • 値: p expr, pp expr, display expr。
  • ブレークポイント: b file.py:42, b func, b file.py:42, condition, cl <num>。
  • 変更/評価: !statement; 完全な REPL: interact。

ルール

  • 最初に最小のコマンド/テストで再現すること。
  • 並列テストワーカーでは pdb を無効にすること。インタラクティブな stdin は通常、ワーカープール内で動作しません。
  • debugpy はアクティブな環境に保持し、プロジェクトが既に必要としない限り、プロジェクトの依存関係として追加しないこと。
  • デバッグサーバーは 127.0.0.1 にバインドし、隔離またはトンネル化されていない限り 0.0.0.0 を公開しないこと。
  • 並列セッションには一意のポートを使用すること。
  • debugpy --pid は実行中のプロセスに注入します。アタッチ前にターゲット PID を確認すること。
  • Linux で PID アタッチが失敗した場合、ターゲットを変更する前に ptrace/コンテナの権限を確認すること。
  • コミット前のクリーンアップ: rg -n 'breakpoint\(|pdb\.set_trace|debugpy\.' --type py。
  • 通常のプロジェクトのテスト/ゲートをデバッガなしでもう一度実行すること。
  • PYTHONBREAKPOINT=0 は breakpoint() を無効にします。
  • デバッガデタッチ後にプロセスが停止したままの場合は、ブレークポイントでまだ一時停止していないか確認すること。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills when explicitly requested; install, verify, update, uninstall, publish, or sync skills.

関連スキル