본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)12k · #11575

python-debugpy

하는 일

이 스킬은 Python 내장 디버거와 원격 디버거로 Python 프로그램의 버그를 찾는 방법을 에이전트에게 가르칩니다. 출력문으로는 드러나지 않는 문제에 막힌 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓Python 프로그램이 잘못된 결과를 내는데 원인이 숨어 있을 때.
  • ✓Python 테스트가 설명할 수 없는 방식으로 실패할 때.
  • ✓다른 기기에서 Python 서비스가 돌아가거나 헷갈리는 순서로 시작해서 디버거를 붙여야 할 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

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.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 Python 스크립트가 잘못된 합계를 냅니다. 한 단계씩 따라가면서 어느 값이 잘못되는지 찾도록 도와주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 해당 작업에 가장 단순한 디버거를 고르고, 변수를 확인할 수 있도록 올바른 줄에서 프로그램을 멈춥니다. 실행 중인 프로그램에는 로컬 포트로 원격 디버거를 연결합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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.
자주 묻는 질문

코드를 바꿔야 하나요?

항상 그렇지는 않습니다. 스킬은 코드를 고치지 않고도 디버거에서 프로그램을 시작할 수 있지만, 로컬 작업에서는 소스에 중단점 줄을 넣기도 합니다.

이미 실행 중인 프로그램도 디버그할 수 있나요?

네. 디버거는 프로세스 ID로 기존 프로세스에 연결할 수 있습니다.

사후 디버깅이란 무엇인가요?

프로그램이 충돌한 순간에 디버거를 열어, 그 시점의 상태를 확인할 수 있게 하는 것입니다.

상세 정보

작성자의 원본 설명

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

repo: EKKOLearnAI/ekko-studio

인기도

GitHub 스타
12k
순위
#11575
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬