本文へ移動
cccskills
無料GitHub で公開日本語紹介

python-debugpy

Pythonの実行を途中で止めて変数や処理の流れを調べ、例外発生時の状態や稼働中のプロセスも確認しながら、不具合の原因を追うスキル。

原文Debug Python with pdb, breakpoint(), post-mortem inspection, and debugpy remote attach.

インストール方法を見る

こんなときに便利

  • 失敗するPythonテストの変数確認
  • 予想外の状態変化を追いたいとき
  • 例外発生時の状態を調べたいとき
  • 稼働中のサービスのデバッグ

日本語での紹介

できること

Pythonの実行を止め、変数の値や処理の流れを確認して不具合の原因を探ります。コードに置くbreakpoint()、起動時に使うpdb、外部から実行中のプログラムにつなぐdebugpyを状況に応じて選びます。例外発生時の状態の確認や、条件を満たしたときだけ処理を止める設定にも対応します。

こんなときに便利

テストが失敗する理由が分からないときや、変数が予想外に変わる箇所を追いたいときに向いています。長時間動くサービスや、画面のない環境のプロセスを調べる場合にも使えます。

使い方の例

  • 「この失敗するテストを最小の条件で再現し、pdbで変数を確認して」
  • 「実行中のサービスにdebugpyで接続し、止まっている箇所を調べて」

注意点

python3が必要です。debugpyは使用中の環境に導入します。接続先は原則127.0.0.1に限定し、稼働中のプロセスにつなぐ前に対象のPIDを確認します。pdbで調べる際はテストの並列実行を止め、調査後はデバッグ用コードを除いて通常のテストを再実行します。

この紹介文は、公開されている SKILL.md をもとに AI(Claude Haiku)が作成しました。正確な仕様は下の原文を確認してください。

含まれるファイル(1)

  • SKILL.md2.5 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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 debugpy in 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 expose 0.0.0.0 unless isolated or tunnelled.
  • Use unique ports for parallel sessions.
  • debugpy --pid injects 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=0 disables breakpoint().
  • If a process is stuck after debugger detach, confirm it is not still paused at a breakpoint.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

1password

無料日本語概要

1Password CLIの導入と認証を確認し、保存したパスワードやAPIキーをコマンドや設定へ渡します。デスクトップ連携やサービスアカウントにも対応します。

  • 1Password CLIを導入したいとき
  • APIキーをコマンドに渡したいとき
  • CIでサービスアカウント認証を使う
openclaw/openclaw39.2万2026年10月10日 更新

acp-router

無料日本語概要

OpenClawへの自然な言葉の依頼をClaude Codeなどの外部コーディングエージェントへ振り分け、作業の開始や継続、スレッド内の会話をつなぐスキルです。

  • Claude Codeをスレッドで開始
  • 外部エージェントの作業を続けたいとき
  • acpxから直接指示を渡したいとき
openclaw/openclaw39.2万2026年10月10日 更新

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

日本語の概要は準備中です。原文の説明を表示しています。

openclaw/openclaw39.2万2026年10月10日 更新

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

日本語の概要は準備中です。原文の説明を表示しています。

openclaw/openclaw39.2万2026年10月10日 更新

apple-notes

無料日本語概要

macOSのApple Notesをエージェントから作成・検索・編集・削除し、フォルダ間の移動やHTML・Markdownへの書き出しを行うスキル。

  • タイトルを付けてメモを作りたいとき
  • フォルダ指定やあいまい検索でメモ探し
  • メモの編集とフォルダ整理
openclaw/openclaw39.2万2026年10月10日 更新

apple-reminders

無料日本語概要

Apple Remindersの予定付きToDoをMacから確認・追加・編集するスキル。リストの管理や完了・削除にも対応し、iPhoneやiPadで見るタスクを整理できます。

  • 今日のタスクや期限超過を確認したいとき
  • 期限付きの個人ToDoを追加したいとき
  • iPhoneやiPadのタスクを整理
openclaw/openclaw39.2万2026年10月10日 更新

openclaw のスキルをすべて見る

このスキルの問題を報告する