Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问许可证需确认审计通过

python-devPython DEV 测试

Agent Skill

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

总安装

1,665

周安装

68

GitHub Stars

1,289

下载量

539
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/databricks-solutions/ai-dev-kit --skill python-dev

简介

提供 Python 开发规范,涵盖代码质量、测试与依赖管理实践。

  • 强调 DRY 原则、组合优于继承与类型提示使用。
  • 适用于提升代码可读性、可维护性与团队协作效率。
  • 建议在虚拟环境中运行,并使用 pytest 等标准框架进行测试。
  • python-dev 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Python Development Rules

Overview

Python development guidance focused on code quality, error handling, testing, and environment management. Apply when working with Python code or Jupyter notebooks.

When to Use This Skill

Use this skill when:

  • Writing new Python code or modifying existing Python files
  • Creating or updating Jupyter notebooks
  • Setting up Python development environments
  • Writing or updating tests
  • Reviewing Python code for quality and best practices

Code Quality

Principles

  • DRY (Don't Repeat Yourself): Avoid code duplication
  • Composition over inheritance: Prefer composition patterns
  • Pure functions when possible: Functions without side effects
  • Simple solutions over clever ones: Prioritize readability and maintainability
  • Design for common use cases first: Solve the primary problem before edge cases

Style & Documentation

  • Type hints required: All functions must include type annotations
  • snake_case naming: Use snake_case for variables, functions, and modules
  • Google-style docstrings: Document functions, classes, and modules using Google-style docstrings
  • Keep functions small: Single responsibility principle - one function, one purpose
  • Preserve existing comments: Maintain and update existing code comments

Example

def calculate_total(items: list[dict[str, float]], tax_rate: float = 0.08) -> float:
    """Calculate total cost including tax.

    Args:
        items: List of items with 'price' key
        tax_rate: Tax rate as decimal (default 0.08)

    Returns:
        Total cost including tax

    Raises:
        ValueError: If tax_rate is negative or items list is empty
    """
    if not items:
        raise ValueError("Items list cannot be empty")
    if tax_rate < 0:
        raise ValueError("Tax rate cannot be negative")

    subtotal = sum(item['price'] for item in items)
    return subtotal * (1 + tax_rate)

Error Handling & Efficiency

Error Handling

  • Specific exception types: Catch specific exceptions, not bare except
  • Validate inputs early: Check inputs at function entry
  • No bare except: Always specify exception types

Efficiency Patterns

  • f-strings: Use f-strings for string formatting
  • Comprehensions: Prefer list/dict/set comprehensions over loops when appropriate
  • Context managers: Use with statements for resource management

Example

def process_file(file_path: str) -> list[str]:
    """Process file and return lines.

    Args:
        file_path: Path to file

    Returns:
        List of non-empty lines

    Raises:
        FileNotFoundError: If file doesn't exist
        PermissionError: If file cannot be read
    """
    if not file_path:
        raise ValueError("File path cannot be empty")

    try:
        with open(file_path, 'r', encoding='utf-8') as f:
            return [line.strip() for line in f if line.strip()]
    except FileNotFoundError:
        raise FileNotFoundError(f"File not found: {file_path}")
    except PermissionError:
        raise PermissionError(f"Permission denied: {file_path}")

Testing (Critical)

Framework & Structure

  • pytest only: Use pytest exclusively (no unittest)
  • Test location: All tests in ./tests/ directory
  • Test package: Include __init__.py in tests directory
  • TDD approach: Write/update tests for all new/modified code
  • All tests must pass: Ensure all tests pass before task completion

Test Structure Example

project/
├── src/
│   └── my_module.py
└── tests/
    ├── __init__.py
    └── test_my_module.py

Example Test

# tests/test_calculations.py
import pytest
from src.calculations import calculate_total

def test_calculate_total_basic():
    """Test basic total calculation."""
    items = [{'price': 10.0}, {'price': 20.0}]
    result = calculate_total(items, tax_rate=0.1)
    assert result == 33.0

def test_calculate_total_empty_list():
    """Test error handling for empty list."""
    with pytest.raises(ValueError, match="Items list cannot be empty"):
        calculate_total([])

def test_calculate_total_negative_tax():
    """Test error handling for negative tax rate."""
    items = [{'price': 10.0}]
    with pytest.raises(ValueError, match="Tax rate cannot be negative"):
        calculate_total(items, tax_rate=-0.1)

Environment Management

Dependency Management

  • Use uv exclusively: All packaging, environment, and script execution via uv
  • No pip/venv/conda: Do not use pip, python3 -m venv, or condauv handles all of this
  • pyproject.toml is the source of truth: Define all dependencies in pyproject.toml (not requirements.txt)

Environment Setup Example

# Install dependencies from pyproject.toml
uv sync

# Install with optional dev dependencies
uv sync --extra dev

# Run a script (no activation needed)
uv run python script.py

# Run pytest
uv run pytest

# Add a new dependency
uv add requests

# Remove a dependency
uv remove requests

Running Python Code

  • Use uv run to execute scripts — no manual venv activation needed
  • Use uv run <tool> for dev tools (pytest, ruff, etc.)
  • Dependencies are defined in pyproject.toml (not requirements.txt)

Linting & Formatting (Ruff)

  • Ruff: Use Ruff for linting AND formatting (replaces flake8, black, isort)
# Lint code
uv run ruff check .

# Lint and auto-fix
uv run ruff check --fix .

# Format code
uv run ruff format .

# Check formatting without changes
uv run ruff format --check .

Type Checking (Pyright)

# Check types
uv run pyright

Note: Use pyright for type checking — do not use mypy.

Best Practices Summary

  1. Code Quality: DRY, composition, pure functions, simple solutions
  2. Style: Type hints, snake_case, Google docstrings, small functions
  3. Errors: Specific exceptions, early validation, no bare except
  4. Efficiency: f-strings, comprehensions, context managers
  5. Testing: pytest only, TDD, tests in ./tests/, all must pass
  6. Environment: Use uv exclusively for dependencies and execution, Ruff for linting/formatting, Pyright for type checking

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

36.06%
按下载量换算194

Claude

29.27%
按下载量换算158

Cursor

19.33%
按下载量换算104

Gemini CLI

9.08%
按下载量换算49

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

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

来源信息

继续浏览同类 Skills