AgentSkillsCN

python-bootstrap

使用生产就绪的工具链,快速搭建全新的Python项目。当用户提出“新建Python项目”“初始化Python仓库”“生成项目脚手架”“配置新Python项目”或“启动Python项目”等需求时,可使用此技能。触发词包括:“新Python项目”“初始化Python仓库”“生成Python应用脚手架”“配置Python软件包”“启动Python项目”等。该技能将采用uv(包管理)、ruff(代码Lint与格式化)、pyright严格模式下的类型检查、pytest(测试框架)、pre-commit钩子,以及GitHub Actions CI流水线,全面遵循PEP 8规范,并强制添加静态类型注解。

SKILL.md
--- frontmatter
name: python-bootstrap
description: >
  Bootstrap a new Python project with a production-ready toolchain. Use when the user asks to
  create, initialise, scaffold, or set up a new Python project or repository. Triggers include
  phrases like "new Python project", "init a Python repo", "scaffold a Python app", "set up a
  Python package", or "bootstrap Python". The skill creates a fully configured project using uv
  (package management), ruff (linting/formatting), pyright in strict mode (type checking), pytest
  (testing), pre-commit hooks, and GitHub Actions CI — all following PEP 8 conventions with
  mandatory static type annotations.

Python Project Bootstrap

Scaffold a new Python project with an opinionated, production-ready toolchain.

Toolchain

ToolPurposeConfig
uvPackage management, venv, dependency resolutionpyproject.toml
ruffLinting (PEP 8, isort, bugbear, etc.) + formattingpyproject.toml [tool.ruff]
pyrightStatic type checking in strict modepyproject.toml [tool.pyright]
pytestTestingpyproject.toml [tool.pytest]
pre-commitGit hooks (ruff + pyright).pre-commit-config.yaml
GitHub ActionsCI (lint, format, type check, test).github/workflows/ci.yml

Usage

Run the bootstrap script. It accepts a project name and optional flags:

bash
python <skill_path>/scripts/bootstrap.py <project-name> \
  --python 3.12 \
  --description "Short project description" \
  --dir /optional/parent/directory

The script:

  1. Creates the project directory with src layout (src/<package_name>/)
  2. Generates pyproject.toml with all tool configuration
  3. Creates test scaffolding, .gitignore, README.md, pre-commit config, and CI workflow
  4. Runs uv venv and uv sync --all-extras to install dependencies
  5. Verifies all checks pass (ruff lint, ruff format, pyright, pytest)

Coding Standards

All code in projects created by this skill must follow:

  • PEP 8 — enforced by ruff (E, W, F, I, N, UP, B, SIM, TCH, RUF rule sets)
  • Static type annotations on all functions, parameters, and return types — enforced by pyright in strict mode
  • py.typed marker included for PEP 561 compliance

Defaults

  • Python version: 3.12 (override with --python)
  • Line length: 88 (ruff/black standard)
  • Layout: src layout (src/<package_name>/)

After Bootstrap

Remind the user to:

  1. cd <project-name>
  2. git init && uv run pre-commit install
  3. Start coding in src/<package_name>/