Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计异常

python-debuggerPython debugger 搜索

Agent Skill

用于辅助 Python 项目开发、测试、依赖管理和常见框架工作流。它适合让 Agent 阅读 Python 代码、定位测试问题、整理运行命令、生成脚本或分析数据处理逻辑。使用时需要确认项目虚拟环境、依赖版本和测试入口;涉及执行脚本、读写文件、访问数据库或调用外部 API 时,应先明确运行目录和输入输出范围,避免误改生产数据。

总安装

1,583

周安装

68

GitHub Stars

37

下载量

555
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:python-debugger(Python debugger 搜索)
来源仓库:https://github.com/majesticlabs-dev/majestic-marketplace
仓库路径:skills/python-debugger
安装命令:
npx skills add https://github.com/majesticlabs-dev/majestic-marketplace --skill python-debugger
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/majesticlabs-dev/majestic-marketplace --skill python-debugger

简介

用于辅助 Python 项目的调试与问题排查。

  • 适合定位代码错误、分析运行时异常和执行流程。
  • 通过日志分析和断点模拟帮助理解程序行为。python-debugger 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 需配合具体项目和虚拟环境使用,明确运行路径和依赖版本。
  • 执行脚本或访问外部资源时注意权限和数据安全边界。

SKILL.md

Python Debugger

Debugging Process

  1. Understand the Error -> 2. Reproduce -> 3. Isolate -> 4. Identify Root Cause -> 5. Fix -> 6. Verify

Step 1: Understand the Error

Reading Tracebacks

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

Step 2: Reproduce the Issue

Create a minimal test case that triggers the error. Answer these questions:

  • What input triggered this?
  • Is it consistent or intermittent?
  • When did it start happening?
  • What changed recently?

Step 3: Isolate the Problem

Print Debugging

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

Using pdb

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

Using icecream

from icecream import ic

def calculate(x, y):
    ic(x, y)  # Prints: ic| x: 5, y: 0
    result = x / y
    ic(result)
    return result

Step 4: Common Root Causes

  • None values: Check return values before accessing attributes. Guard with if x is None: raise ValueError(...)
  • Type mismatches: Add type hints, cast inputs explicitly. int(a) + int(b) not a + b
  • Mutable default arguments: Use def f(items=None): then items = items or [] inside
  • Circular imports: Use lazy imports inside functions: from.module import Class
  • Async/await: Missing await returns coroutine instead of result
  • Key/Index errors: Use .get(key, default) for dicts, check len() for lists
  • Scope issues: global/nonlocal declarations, closure variable capture in loops
  • Encoding: Specify encoding="utf-8" in open() calls
  • Float precision: Use decimal.Decimal or math.isclose() for comparisons
  • Resource leaks: Use with statements for files, connections, locks

Step 5: Fix Patterns

Defensive Programming

def 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)

Input Validation

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}")

Exception Handling

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")

Step 6: Verify the Fix

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

Debugging Tools

Logging Setup

import logging

logging.basicConfig(
    level=logging.DEBUG,
    format="%(asctime)s %(name)s %(levelname)s: %(message)s",
    handlers=[
        logging.FileHandler("debug.log"),
        logging.StreamHandler(),
    ],
)

Profiling

# Time profiling
import cProfile
cProfile.run("main()", "output.prof")

# Memory profiling
from memory_profiler import profile

@profile
def memory_heavy_function():
    # ...

Using rich for better output

from rich.traceback import install
install(show_locals=True)  # Enhanced tracebacks

References

When to Use WebSearch

  • Cryptic error messages
  • Library-specific errors
  • Version compatibility issues
  • Undocumented behavior

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.53%
按下载量换算192

Claude

28.75%
按下载量换算160

Cursor

19.64%
按下载量换算109

Gemini CLI

9.39%
按下载量换算52

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills