본문으로 건너뛰기
Skillpedia
일반 코딩394k · #76

python-debugpy

하는 일

AI 에이전트가 pdb와 debugpy 같은 Python 디버깅 도구로 코드를 멈추고 상태를 살펴보도록 안내합니다. Python 코드나 서비스에서 헷갈리는 버그를 찾아야 하는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓Python 스크립트가 이상하게 동작해서 특정 지점의 값을 보아야 할 때.
  • ✓Python 테스트가 실패해서 한 단계씩 살펴보고 싶을 때.
  • ✓오래 실행되는 Python 서비스를 원격으로 디버거에 연결해야 할 때.

스킬 링크

https://github.com/openclaw/openclaw/blob/main/skills/python-debugpy/SKILL.md

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

사용 방법

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

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

Use this skill to help me: https://github.com/openclaw/openclaw/blob/main/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분.

작동 방식

스킬은 문제에 닿을 수 있는 가장 작은 디버거를 고릅니다. 예를 들어 pdb 세션이나 코드 안의 중단점을 씁니다. 그다음 프로그램을 한 단계씩 진행하며 값을 살펴보고 수정 방법을 제안합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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.
자주 묻는 질문

코드를 바꿔야 하나요?

꼭 그렇지는 않습니다. pdb 세션은 소스를 고치지 않고 시작할 수 있지만, 코드 안의 중단점이 더 빠릅니다.

실행 중인 서비스를 디버그할 수 있나요?

예. debugpy는 실행 중인 프로세스나 시작 중인 서비스에 연결할 수 있습니다.

디버그 포트를 여는 것이 안전한가요?

스킬은 디버그 포트에 로컬 주소 127.0.0.1을 사용하므로, 자신의 컴퓨터에서만 접근할 수 있습니다.

상세 정보

작성자의 원본 설명

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

repo: openclaw/openclaw

인기도

GitHub 스타
394k
순위
#76
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬