本文へ移動
cccskills
無料GitHub で公開

python-debug

Debug Python code using tracebacks, pdb, and structured logging.

インストール方法を見る

含まれるファイル(2)

  • SKILL.md3.1 KB
  • assets/logging_config.py1.7 KB

SKILL.md(原文)

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

What I do

I guide you through three core Python debugging workflows:

  1. Reading tracebacks — parse the error, find the root cause, identify common exception types
  2. Interactive debugging with pdb — set breakpoints, step through execution, inspect state
  3. Structured logging — configure logging for visibility in tests and production

A reusable logging configuration template is available in assets/logging_config.py.

When to use me

Use when you:

  • See an unexpected exception and need to find the root cause
  • Want to step through execution to understand what's happening
  • Need to add logging to a module for ongoing observability
  • Are setting up debugging infrastructure for a new project

Example usage

"Help me read this traceback and find what's causing the KeyError" "Set a breakpoint before the loop in process_items and inspect each item" "Add structured logging to src/services/payment.py"

How to respond

  • Tracebacks: identify root cause first, then walk the relevant frames — don't narrate the whole stack
  • pdb: show the minimal breakpoint placement and the commands needed for the specific situation — don't dump the full command reference
  • Logging: write the actual config for the target module; offer to apply assets/logging_config.py if they need a reusable setup

Debugging workflow

1. Problem analysis

  • Identify the specific exception or erroneous output and location
  • Confirm expected vs actual behavior before diving into code
  • Trace the execution flow (call stack, async context) to locate the breakpoint

2. Debugging strategy

  • Add targeted logging statements or instrument the offending function
  • Use pdb.set_trace() or breakpoint() just before key transitions
  • Inspect relevant state (locals, instance attributes) without overwhelming output
  • Suggest tooling like pytest -k <test> with -vv or python -m pdb as needed

3. Solution approach

  • Outline possible fixes, describe trade-offs (performance, readability, backward compatibility)
  • Reference specific modules, classes, or helpers that need the change
  • Provide clear before/after snippets and explain why the fix resolves the failure

4. Prevention

  • Recommend additional tests that exercise the fixed path (unit, integration, regression)
  • Suggest alerting/logging improvements to detect similar issues earlier
  • Highlight architectural changes (e.g., safer defaults, input validation) to avoid repeats
  • Identify any code smells uncovered during debugging (hidden state, silent failures)

Debug checklist

  • Established expected vs actual behavior
  • Traced execution flow to locate the root cause
  • Recommended logging/breakpoints to observe the failure
  • Proposed concrete fix(es) with trade-off analysis
  • Added prevention steps (tests, logging, validation) to avoid regressions

レビュー

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

同じリポジトリのスキル

概要と使いどころ

Implement comprehensive error handling for Python code paths to keep services resilient and user-friendly. Use when failures are currently silent or exceptions leak through.

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

Unique-AG/ai52026年10月10日 更新

Tabular and numerical data analysis with descriptive statistics and insights. Use when the user provides data, tables, CSVs, or numbers and wants analysis.

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

Unique-AG/ai52026年10月10日 更新

Financial factsheet analysis with key metrics extraction and investment rationale

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

Unique-AG/ai52026年10月10日 更新

ci-fix

無料

Diagnose and fix CI failures without leaving your editor.

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

Unique-AG/ai52026年10月10日 更新

Reproduce ai-repo PR checks locally with Poe and CI scripts, including per-package typecheck and coverage behavior. Use when validating changes before push or when user asks which local commands match CI.

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

Unique-AG/ai52026年10月10日 更新

Ask clarifying questions before implementing to ensure Python requirements are understood. Use when a task lacks detail, dependencies are unclear, or multiple interpretations are possible.

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

Unique-AG/ai52026年10月10日 更新

Unique-AG のスキルをすべて見る

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