一键导入
python-debugger
Debug Python errors, exceptions, and unexpected behavior. Analyzes tracebacks, reproduces issues, identifies root causes, and provides fixes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Debug Python errors, exceptions, and unexpected behavior. Analyzes tracebacks, reproduces issues, identifies root causes, and provides fixes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | python-debugger |
| description | Debug Python errors, exceptions, and unexpected behavior. Analyzes tracebacks, reproduces issues, identifies root causes, and provides fixes. |
| allowed-tools | Read Write Edit Grep Glob Bash WebSearch |
Traceback (most recent call last): <- Read bottom to top
File "app.py", line 45, in main <- Entry point
result = process_data(data) <- Call chain
File "processor.py", line 23, in process_data
return transform(item) <- Getting closer
File "transformer.py", line 12, in transform
return item["value"] / item["count"] <- Error location
ZeroDivisionError: division by zero <- The actual error
Common error types: see references/python-error-types.md
Create a minimal test case that triggers the error. Answer these questions:
def process_data(data):
print(f"DEBUG: data type = {type(data)}")
print(f"DEBUG: data = {data}")
for i, item in enumerate(data):
print(f"DEBUG: processing item {i}: {item}")
result = transform(item)
print(f"DEBUG: result = {result}")
return results
import pdb
def problematic_function(x):
pdb.set_trace() # Execution stops here
# Or use: breakpoint() # Python 3.7+
result = x * 2
return result
pdb commands: see references/pdb-commands.md
from icecream import ic
def calculate(x, y):
ic(x, y) # Prints: ic| x: 5, y: 0
result = x / y
ic(result)
return result
if x is None: raise ValueError(...)int(a) + int(b) not a + bdef f(items=None): then items = items or [] insidefrom .module import Classawait returns coroutine instead of result.get(key, default) for dicts, check len() for listsglobal/nonlocal declarations, closure variable capture in loopsencoding="utf-8" in open() callsdecimal.Decimal or math.isclose() for comparisonswith statements for files, connections, locksdef safe_divide(a, b):
if b == 0:
raise ValueError("Cannot divide by zero")
return a / b
def safe_get(data: dict, key: str, default=None):
return data.get(key, default)
def process_user(user_id: int, data: dict) -> dict:
if not isinstance(user_id, int) or user_id <= 0:
raise ValueError(f"Invalid user_id: {user_id}")
required_fields = ["name", "email"]
missing = [f for f in required_fields if f not in data]
if missing:
raise ValueError(f"Missing required fields: {missing}")
import logging
logger = logging.getLogger(__name__)
def fetch_user_data(user_id: int) -> dict:
try:
response = api_client.get(f"/users/{user_id}")
response.raise_for_status()
return response.json()
except requests.HTTPError as e:
logger.error(f"HTTP error fetching user {user_id}: {e}")
raise
except requests.ConnectionError:
logger.error(f"Connection failed for user {user_id}")
raise ServiceUnavailableError("API unavailable")
import pytest
def test_transform_handles_zero_count():
"""Verify fix for ZeroDivisionError."""
data = {"value": 10, "count": 0}
with pytest.raises(ValueError, match="count cannot be zero"):
transform(data)
def test_transform_normal_case():
"""Verify normal operation still works."""
data = {"value": 10, "count": 2}
result = transform(data)
assert result == 5
import logging
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s %(name)s %(levelname)s: %(message)s",
handlers=[
logging.FileHandler("debug.log"),
logging.StreamHandler(),
],
)
# Time profiling
import cProfile
cProfile.run("main()", "output.prof")
# Memory profiling
from memory_profiler import profile
@profile
def memory_heavy_function():
# ...
from rich.traceback import install
install(show_locals=True) # Enhanced tracebacks
Skills for accessing and searching docs in DeepWiki/GitHub’s public code repositories can help users understand open-source project source codes, and users can also ask questions directly about the code docs.
Interact with local Chrome browser session (only on explicit user approval after being asked to inspect, debug, or interact with a page open in Chrome)
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
Web reading, search, academic research, NLP, screenshots, and PDF extraction via Jina AI mcpcall. TRIGGER when need to read a URL, search the web, find academic papers (arXiv/SSRN), classify text, rerank documents, deduplicate content, capture screenshots, or extract PDF figures.
Guide and template for converting MCP servers into self-contained Claude Code skills with a Python wrapper script. TRIGGER when creating a new MCP skill, wrapping an MCP server as a skill, or need the mcpcall script template.
AI-powered documentation for GitHub repositories via DeepWiki MCP. TRIGGER when need to understand a GitHub repository, read its documentation topics, ask questions about a repo's codebase, architecture, or usage, or explore how an open-source project works.