python
Python开发标准和工具链偏好。在(1)编写任何Python代码,(2)使用pyproject.toml设置Python项目,(3)创建独立CLI脚本,(4)配置Python工具(ruff, mypy, pytest, nox, uv),(5)审查或重构Python代码,或(6)建议Python最佳实践时使用。强制执行现代Python风格、严格类型提示和基于uv的工作流程。
📖 中文导读:Python开发标准和工具链偏好。在(1)编写任何Python代码,(2)使用pyproject.toml设置Python项目,(3)创建独立CLI脚本,(4)配置Python工具(ruff, mypy, pytest, nox, uv),(5)审查或重构Python代码,或(6)建议Python最佳实践时使用。强制执行现代Python风格、严格类型提示和基于uv的工作流程。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: python description: Python development standards and toolchain preferences. Use when (1) writing ANY Python code, (2) setting up Python projects with pyproject.toml, (3) creating standalone CLI scripts, (4) configuring Python tooling (ruff, mypy, pytest, nox, uv), (5) reviewing or refactoring Python code, or (6) advising on Python best practices. Enforces modern Pythonic style, strict type hints, and uv-based workflows.
Python Development Standards
Before Writing Any Code
For applications and multi-file projects: Read references/tdd-workflow.md first. Follow TDD with mandatory verification after every change.
For CLI scripts and one-off utilities: Skip TDD workflow. Focus on working code.
Core Requirements
- Type hints everywhere - all functions, all parameters, all return types. No
Any. - Docstrings on all public interfaces - RST format for Sphinx compatibility
- Absolute imports only - never use relative imports
- Modern Python idioms - use latest features appropriate for target version
- Empty
__init__.py- never add anything to__init__.py
Reference Files
Read based on task:
- references/toolchain.md - Project setup and tool configuration (uv, ruff, mypy, pytest, nox, just)
- references/cli-scripts.md - CLI tool development
- references/documentation.md - Docstring and doctest patterns