← ClaudeAtlas

pattern-engineer-pythonlisted

Modern idiomatic Python: `uv` only for env/deps; PEP 8 + 88-char lines; full type annotations on every signature; EAFP with narrow `except` + `raise ... from e`; modern type hints (PEP 604/695); `Protocol` for duck-typed seams; frozen-slots `@dataclass` DTOs (Pydantic only at boundaries); `with` for resources; no mutable default args; comprehensions over C-style loops; no `import *`; no MD5/SHA1 for security; Alembic chained to head + `pytest-alembic` round-trip. Activate on `.py` files.
MartinKChen/harness-claude-code · ★ 0 · AI & Automation · score 72
Install: claude install-skill MartinKChen/harness-claude-code
# pattern-engineer-python ## When to activate Activate when writing or editing any `.py` file, scaffolding a Python service, modifying `pyproject.toml`, working with FastAPI / Flask / Django / SQLAlchemy / Pydantic / pytest, or running `mypy` / `ruff` / `bandit` / `pytest` / `uv`. Skip for non-Python code. ## Project memory overlay After loading this skill, also check `$MAIN_ROOT/.claude/memory/patterns/pattern-engineer-python.md` in the consuming project (resolve `MAIN_ROOT="$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")"`). If present, load it as an **additive overlay** to the rules below; if absent, skip silently. See `memory-convention` for the full contract (additivity, severity floor, conflict surfacing). ## Patterns ### Environment — `uv` only - `uv` is the only supported environment / dependency manager. - No `pip`, `poetry`, `pipenv`, `conda`, `virtualenv` workflows. - Pin Python version in `pyproject.toml` via `requires-python`. - Commit `uv.lock`; never edit by hand. - Prefer `uv run <cmd>` over activating the venv in scripts. | Command | Purpose | |---------|---------| | `uv venv` | Create `.venv` | | `uv sync` | Install from `pyproject.toml` + `uv.lock` | | `uv add <pkg>` | Add a runtime dep | | `uv add --dev <pkg>` | Add a dev dep | | `uv run <cmd>` | Run inside the project env | ### PEP 8 - 4-space indentation, no tabs. - Lines ≤ 88 chars (ruff default). - `snake_case` for functions / methods / variables / modules. - `PascalCase