Skip to content
Skillpedia
APIs & servers (backend)12k · #11575

python-debugpy

What it does

This skill teaches the agent how to find bugs in Python programs with Python's built-in debugger and a remote debugger. It is for developers stuck on problems that print statements do not reveal.

When to use it

  • ✓When a Python program gives wrong results and the cause is hidden.
  • ✓When a Python test fails in a way you cannot explain.
  • ✓When a Python service runs on another machine or starts in a confusing order and a debugger must be attached.

Skill link

https://github.com/EKKOLearnAI/ekko-studio/blob/main/packages/ekko-agent/skills/python-debugpy/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/EKKOLearnAI/ekko-studio/blob/main/packages/ekko-agent/skills/python-debugpy/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“My Python script gives the wrong total. Help me step through it and see which value goes wrong.”

5 new skills a week. 1 minute to read.

How it works

The agent picks the simplest debugger for the job and pauses the program at the right line so it can check variables. For a running program it attaches a remote debugger on a local port.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Python Debugging

Use when Python code needs interactive debugging: hidden locals, confusing state mutation, failing tests, subprocesses, long-running services, or remote attach.

Choose the smallest debugger that reaches the bad frame:

  • breakpoint(): local code where source edits are acceptable.
  • python3 -m pdb: launch from the beginning without editing source.
  • python3 -m pdb -c continue: stop at an unhandled exception.
  • debugpy: remote/headless processes, DAP clients, an existing PID, or startup races.

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>

Source-edit attach:

import debugpy

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

Post-mortem inspection:

import pdb
import sys

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

pdb commands

  • Flow: n, s, r, c, q.
  • Stack and 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>.
  • Evaluate or mutate: !statement; full REPL: interact.

Rules

  • Reproduce with the smallest command or test first.
  • Disable parallel test workers for pdb; worker pools usually break interactive stdin.
  • Keep debugpy in the active environment. Do not add it as a project dependency unless the project needs it.
  • Bind debug servers to 127.0.0.1; expose them only on an isolated network or through a secure tunnel.
  • Treat PID attach as process injection. Avoid security-sensitive or production targets unless explicitly approved.
  • On Linux, check ptrace and container privileges before changing a target when PID attach fails.
  • Before committing, run rg -n 'breakpoint\\(|pdb\\.set_trace|debugpy\\.' --type py and remove accidental breakpoints.
  • Rerun the normal project test gate without the debugger.
FAQ

Do I need to change my code?

Not always. The skill can start the program in the debugger without editing it, though local work may use a breakpoint line in the source.

Can it debug a program that is already running?

Yes. The debugger can attach to an existing process by its ID.

What is post-mortem debugging?

It opens the debugger at the moment a program crashes, so you can inspect the state at that point.

Details

Original description by the author

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

repo: EKKOLearnAI/ekko-studio

Popularity

GitHub stars
12k
Ranking position
#11575
License
—
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills