greenfield-python-stacklisted
Install: claude install-skill lawzava/megapowers
# Greenfield Python Stack
Opinionated defaults for a new Python service in 2026. Time-stamped: these reflect
today's tools and will go stale — treat them as a starting point to adapt.
For a non-trivial new project, run megapowers:brainstorming and
megapowers:writing-plans first (if installed) — this skill supplies the stack,
not the process.
## Toolchain (pin these)
- **uv** — dependency + venv + lockfile manager. `uv init`, `uv add`, `uv run`,
`uv sync`. One tool, fast, a real lockfile (`uv.lock`). Commit the lock.
- **ruff** — lint *and* format (replaces black + flake8 + isort). `ruff check --fix`
and `ruff format`. Enable a strict ruleset in `pyproject.toml`.
- **pyright** (or **ty**) in **strict** mode — types are a correctness tool, not
decoration. CI fails on a type error.
- **pytest** — tests. `pytest-asyncio` for async tests.
- **pydantic v2** — validation and settings (`pydantic-settings` for config from env).
## Layout
`src/` layout so tests import the installed package, not the working dir:
```
myservice/
├── pyproject.toml # deps, ruff, pyright, pytest config all here
├── uv.lock
├── src/myservice/
│ ├── __init__.py
│ ├── main.py # app wiring only
│ ├── api/ # routes
│ ├── domain/ # logic, no framework imports
│ └── db.py
└── tests/
```
Keep framework imports out of `domain/` — logic you can test without a server.
## Web: FastAPI + uvicorn
FastAPI + pydantic v2 for typed request/response. Prefer `as