skills/python/SKILL.md
Python project conventions and coding standards. Use when: creating a new Python project, writing Python modules, setting up pyproject.toml, configuring Python dependencies, writing Python tests, scaffolding Python Lambda functions, auditing Python code for type safety and convention compliance, or improving an existing Python codebase. Covers type hints, pydantic, docstrings, and dependency management.
npx skillsauth add michaelsvanbeek/personal-agent-skills pythonInstall 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.
Target Python 3.12+ unless constraints require otherwise.
Use the latest Python language features:
X | Y syntax (Python 3.10+):=) where it improves readabilityUse uv as the package and project manager. It is substantially faster than pip and handles virtual environments, lockfiles, and workspaces in a single tool.
# Create a new project
uv init my-project && cd my-project
# Add runtime dependencies
uv add fastapi mangum pydantic pydantic-settings
# Add dev-only dependencies (not bundled in Lambda)
uv add --dev pytest ruff mypy boto3
# Run tools within the project environment
uv run pytest
uv run ruff check .
# Sync environment from lockfile (CI / fresh checkout)
uv sync
pyproject.toml as the single source for all project metadata and dependencies.uv.lock lockfile must be committed to version control for reproducible installs.boto3, botocore) belong in [dependency-groups] dev — not bundled in the artifact.[project]
name = "my-project"
version = "0.1.0"
requires-python = ">=3.12"
dependencies = [
"fastapi",
"mangum",
"pydantic",
"pydantic-settings",
]
[dependency-groups]
dev = [
"boto3",
"pytest",
"ruff",
"mypy",
]
Use Pydantic BaseModel as the default for all structured data that crosses a function or module boundary: API request/response models, configuration, and any externally-sourced data.
from datetime import datetime
from pydantic import BaseModel, Field
class CreateProjectRequest(BaseModel):
name: str = Field(..., min_length=1, max_length=100)
description: str = Field(default="", max_length=500)
is_public: bool = False
class ProjectResponse(BaseModel):
id: str
name: str
description: str
is_public: bool
created_at: datetime
Use pydantic-settings for environment-based configuration. It reads env vars automatically and validates types at startup — fail fast before any work begins:
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
service_name: str = "my-api"
stage: str = "dev"
database_url: str # required — no default
api_key: str # required — no default
max_retries: int = 3
model_config = {"env_file": ".env", "env_prefix": "APP_"}
settings = Settings() # reads APP_DATABASE_URL, APP_API_KEY, etc.
| Use | When |
|-----|------|
| BaseModel | Validation needed, API boundaries, config, JSON parsing |
| @dataclass | Pure data containers with no validation or serialization |
| TypedDict | Typing only — no runtime instances, plain dict interop |
Never use plain dict for structured data that crosses a function or module boundary.
def process_items(items: list[str], max_count: int = 10) -> dict[str, int]:
"""Process a list of items and return frequency counts.
Args:
items: List of item names to process.
max_count: Maximum number of items to include in results.
Returns:
Dictionary mapping item names to their frequency counts.
Raises:
ValueError: If items list is empty.
"""
except.logging module, never print() for operational output.pyproject.toml:[tool.ruff]
line-length = 100
target-version = "py312"
[tool.ruff.lint]
select = ["E", "F", "I", "N", "UP", "B", "SIM"]
[tool.mypy]
strict = true
test_<module>.py and test functions test_<behavior>.tmp_path fixture for file system tests.For VS Code / Cursor configuration with Pylance type checking, Ruff format-on-save, uv virtual environment discovery, and pytest test runner, see the ide-setup skill. For FastAPI web server patterns and Lambda deployment, see the python-web-server skill. For general testing strategy and coverage thresholds, see the testing skill. For data pipeline development with dlt, see the data-pipelines skill. For DataFrame analysis workflows with pandas, Polars, and DuckDB, see the data-analysis skill.
development
TypeScript coding standards and type safety conventions. Use when: creating TypeScript files, defining interfaces and types, writing type-safe code, reviewing TypeScript for type correctness, auditing a codebase for type safety gaps, eliminating any or ts-ignore usage, or improving strict-mode compliance. Covers strict typing, avoiding any and ts-ignore, discriminated unions, Zod runtime validation, immutability patterns, and proper type definitions.
testing
Writing clear, actionable tickets in any issue tracker (Jira, Linear, GitHub Issues, ServiceNow, etc.). Use when: creating epics, stories, tasks, bugs, or spikes; writing acceptance criteria; decomposing work for a sprint; linking dependencies between tickets; auditing backlog items for clarity; or coaching a team on ticket quality. Covers title conventions, description templates, acceptance criteria, decomposition rules, dependency linking, and org-specific pluggable configuration.
development
Testing strategy, patterns, and evaluation for software and LLM/AI systems. Use when: writing tests, choosing test boundaries, designing test data, structuring test suites, evaluating LLM outputs, building evaluation pipelines, setting coverage thresholds, auditing test coverage gaps in existing projects, or improving test quality and structure.
development
Writing effective status updates for different audiences and cadences. Use when: writing a weekly status update, preparing a monthly summary, drafting a quarterly review, sending updates to leadership, sharing progress with stakeholders, or improving the clarity and impact of team communications. Covers weekly, monthly, and quarterly formats tailored for upward, lateral, and downward communication.