home / skills / pluginagentmarketplace / custom-plugin-python / debugging

debugging skill

/skills/debugging

This skill helps you master Python debugging with pdb and IDE tools, enabling efficient issue resolution, profiling, and robust log-based troubleshooting.

npx playbooks add skill pluginagentmarketplace/custom-plugin-python --skill debugging

Review the files below or copy the command above to add this skill to your agents.

Files (6)
SKILL.md
1.2 KB
---
name: Debugging
description: Python debugging techniques, pdb, and IDE debugging tools
version: "2.1.0"
sasmp_version: "1.3.0"
bonded_agent: 04-testing-quality
bond_type: PRIMARY_BOND

# Skill Configuration
retry_strategy: exponential_backoff
observability:
  logging: true
  metrics: issue_resolution_time
---

# Python Debugging Skill

## Overview
Master Python debugging using pdb, IDE debuggers, and advanced troubleshooting techniques.

## Topics Covered

### pdb Debugger
- Basic pdb commands
- Breakpoint() function
- Post-mortem debugging
- Remote debugging
- pdb++ enhancements

### IDE Debugging
- VS Code debugger
- PyCharm debugging
- Breakpoint conditions
- Watch expressions
- Call stack navigation

### Logging
- logging module setup
- Log levels and handlers
- Structured logging
- Log aggregation
- Debug logging strategies

### Profiling
- cProfile usage
- line_profiler
- memory_profiler
- py-spy for production
- Flame graphs

### Error Analysis
- Traceback analysis
- Exception chaining
- Context managers for debugging
- Sentry integration
- Error monitoring

## Prerequisites
- Python fundamentals
- Exception handling

## Learning Outcomes
- Debug effectively with pdb
- Profile performance issues
- Set up proper logging
- Analyze production errors

Overview

This skill teaches practical Python debugging using pdb, IDE debuggers, logging, profiling, and error analysis. I guide you from basic breakpoint debugging to production-safe tools like py-spy and structured logging. You will learn to reproduce, inspect, and fix bugs faster and with less disruption to production.

How this skill works

I cover core pdb commands, breakpoints(), post-mortem and remote debugging, plus enhancements like pdb++. I walk through IDE workflows for VS Code and PyCharm: conditional breakpoints, watches, and call stack navigation. I also teach logging setup, profiling with cProfile/line_profiler/memory_profiler, and techniques for analyzing tracebacks and integrating error monitoring.

When to use it

  • When you need to step through code to find logic errors or inspect state.
  • When investigating production issues without stopping services (py-spy, remote pdb).
  • When performance problems require CPU or memory profiling.
  • When tracebacks are unclear and you need structured error context.
  • When setting up logging and monitoring to reduce future debugging time.

Best practices

  • Start with a minimal reproducible example before deep debugging.
  • Use conditional breakpoints and watch expressions to limit noise.
  • Prefer structured logging and appropriate log levels over print debugging.
  • Profile with representative workloads and compare before/after changes.
  • Use post-mortem debugging and error monitoring to capture issues in production.

Example use cases

  • Step through a failing unit test with pdb to inspect local variables and call flow.
  • Attach py-spy to a production process to collect flame graphs without downtime.
  • Configure VS Code breakpoints with conditions to skip noisy iterations in a loop.
  • Use cProfile and line_profiler to identify a slow function and optimize hotspots.
  • Integrate Sentry or a similar service to capture tracebacks and context for uncaught exceptions.

FAQ

Do I need an IDE to debug effectively?

No. pdb and py-spy provide powerful CLI debugging and profiling; IDEs add convenience but are optional.

Is print() debugging ever acceptable?

Yes for quick checks, but structured logging and breakpoints scale better and are safer in production.