.claude/skills/python-project-standards/SKILL.md
# Python Project Standards ## When to Load This Skill Load when working with: `pyproject.toml`, Python files, pre-commit config, dependency management, type hints, linting configuration. ## Stack Versions (as of 2026-Q1) - Python: `>=3.11` (minimum), prefer `3.12` - uv: latest stable (replaces pip, venv, pip-tools — all in one) - Ruff: `>=0.9.0` - MyPy: `>=1.10.0` - pre-commit: `>=3.7.0` ## pyproject.toml Standard Config The canonical `pyproject.toml` for all projects. Copy and adjust `[pr
npx skillsauth add pyramidheadshark/ml-claude-infra .claude/skills/python-project-standardsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Load when working with: pyproject.toml, Python files, pre-commit config, dependency management, type hints, linting configuration.
>=3.11 (minimum), prefer 3.12>=0.9.0>=1.10.0>=3.7.0The canonical pyproject.toml for all projects. Copy and adjust [project].name and dependencies.
[project]
name = "project-name"
version = "0.1.0"
description = ""
readme = "README.md"
requires-python = ">=3.11"
dependencies = []
[project.optional-dependencies]
dev = [
"ruff>=0.9.0",
"mypy>=1.10.0",
"pytest>=8.0.0",
"pytest-asyncio>=0.23.0",
"pytest-bdd>=7.0.0",
"pytest-cov>=5.0.0",
"httpx>=0.27.0",
]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.ruff]
target-version = "py311"
line-length = 100
fix = true
[tool.ruff.lint]
select = [
"E", "W", # pycodestyle
"F", # pyflakes
"I", # isort
"B", # bugbear
"C4", # comprehensions
"UP", # pyupgrade
"ANN", # annotations
"S", # bandit security
"SIM", # simplify
"TCH", # type-checking imports
"RUF", # ruff-specific
]
ignore = ["ANN101", "ANN102", "S101"]
[tool.ruff.lint.per-file-ignores]
"tests/**" = ["S101", "ANN"]
[tool.mypy]
python_version = "3.11"
strict = true
warn_return_any = true
warn_unused_configs = true
no_implicit_reexport = true
ignore_missing_imports = false
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = ["tests"]
addopts = "--cov=src --cov-report=term-missing --cov-fail-under=80"
[tool.coverage.run]
source = ["src"]
omit = ["tests/*", "*/migrations/*"]
uv init project-name
uv add fastapi uvicorn[standard]
uv add --dev ruff mypy pytest pytest-asyncio pytest-bdd
uv run pytest
uv run ruff check .
uv run mypy src/
uv sync
uv lock
See resources/pre-commit-config.md for the full .pre-commit-config.yaml.
project-name/
├── src/
│ └── {project_name}/
│ ├── __init__.py
│ ├── api/
│ │ ├── __init__.py
│ │ └── routers/
│ ├── core/
│ │ └── __init__.py
│ ├── services/
│ │ └── __init__.py
│ ├── adapters/
│ │ └── __init__.py
│ └── models/
│ └── __init__.py
├── tests/
│ ├── __init__.py
│ ├── conftest.py
│ ├── unit/
│ ├── integration/
│ └── features/ # BDD .feature files
├── dev/
│ ├── status.md # ALWAYS maintained
│ └── active/ # task-specific context
├── pyproject.toml
├── uv.lock
├── .pre-commit-config.yaml
├── .gitignore
├── .env.example
├── design-doc.md
└── README.md
Every project must have .env.example committed to repo with all required keys listed but no values.
.env is always in .gitignore. Application validates all required env vars at startup via Pydantic BaseSettings.
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8")
openrouter_api_key: str
database_url: str
environment: str = "development"
settings = Settings()
See resources/gitignore.md for the full .gitignore template covering Python, uv, ML artifacts, IDE files.
testing
# Design Doc Creator ## When to Load This Skill Load when: design documents, requirements, new project start. Short fixture skill for testing (optional/meta skill).
development
# Windows Developer Guide ## When to Load Automatically loaded on Windows (`platform_trigger: "win32"`). Applies to: `.py`, `.ps1`, `.bat`, `.cmd` files and any Windows-specific workflow. ## Python on Windows ### Encoding (CRITICAL) Windows defaults to `cp1251` / `cp1252` for file I/O. Always specify UTF-8 explicitly: ```python with open("file.txt", "r", encoding="utf-8") as f: content = f.read() Path("file.txt").read_text(encoding="utf-8") Path("file.txt").write_text(content, encodin
development
# Test-First Patterns ## When to Load This Skill Load when writing tests, creating `.feature` files, setting up conftest, discussing test strategy, or reviewing coverage. ## Philosophy Tests are written BEFORE code. Always. No exceptions. The order is: Design Doc → BDD Scenarios → Unit Tests → Implementation. BDD scenarios come from the design document's use cases section — they are a direct translation of business requirements into executable specifications. This makes tests the living do
testing
# Skill: Supply Chain Auditor ## When to Load Auto-load when: adding dependencies, reviewing packages, updating versions, or discussing `requirements.txt`, `pyproject.toml`, `package.json`. Triggers on `dependency`, `install`, `package`, `CVE`, `audit`, `vulnerable` (≥2 keywords). ## Core Rules Every new dependency addition must pass this checklist before merging: 1. **Pinned** — exact version in production (`==1.2.3` for pip, `"1.2.3"` for npm, not `^` or `~`). 2. **Maintained** — last com