lukabor 2517b1fb43 refactor(skills): extract containerize-project from build-* scaffolds
- refactor(scaffold): move Docker/compose templates and three-stage doc into
  new containerize-project skill; build-* skills delegate their Docker step
- fix(scaffold): drop source mount from the production compose service
- fix(scaffold): add .dockerignore templates so COPY . . excludes .git/.env/data
- feat(scaffold): run production stages as non-root app user; pin uv install
  via COPY --from=ghcr.io/astral-sh/uv:0.7
- docs(README): list containerize-project and add-docker-secrets; remove the
  now-empty _concepts section

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 12:49:48 +02:00

68 lines
3.3 KiB
Markdown

---
name: build-py-project
description: Scaffold a new Python project with uv for dependency management, a justfile task runner, and pyproject.toml configured with ruff, ty, and pytest, then delegate the three-stage Docker setup (Dockerfile, docker-compose, .dockerignore) to containerize-project. Materialises files into a target directory and stops on `jj diff` for review before any commit. Use when the user says "new python project", "scaffold python", "create python project", "set up python repo", "bootstrap python", "/build-py-project".
---
# build-py-project
## When to use
- User says "new python project", "scaffold python", "/build-py-project".
- A fresh empty directory needs the standard uv + Docker + justfile setup.
## Inputs to collect (one grouped prompt)
- **Project name** (kebab-case, e.g. `my-project`).
- **Package name** (derived: lowercase, hyphens → underscores; confirm).
- **Author name + email** for `pyproject.toml`.
- **One-line description** for `pyproject.toml`.
- **License** (default: MIT).
## Process
1. **Confirm target directory.** Refuse to write into a non-empty
directory unless the user explicitly opts in.
2. **Materialise files** from sibling templates with placeholder
substitution. Files written:
```
<project>/
├── src/<package>/__init__.py
├── tests/fixtures/.gitkeep
├── justfile ← justfile.tpl
├── pyproject.toml ← pyproject.toml.tpl
└── .gitignore ← gitignore.tpl
```
3. **Delegate Docker** to
[`/containerize-project`](../containerize-project/SKILL.md) (python
variant): it writes `Dockerfile`, `docker-compose.yml`,
`.dockerignore`, and appends the Docker recipes to the justfile.
4. **Stop. Do not run `jj describe`.** Tell the user:
> "Review with `jj diff` (or `git status` + `git diff`). Then run
> `just build-dev` to verify the toolchain. Describe the change with
> [`/jj-atomic`](../../productivity/jj-atomic/SKILL.md) when satisfied."
5. **Suggest** running [`/write-readme-py`](../../engineering/write-readme-py/SKILL.md)
after the first successful build to generate the README.
## Placeholders used by templates
- `<project-name>` — kebab-case project name.
- `<package_name>` — snake_case Python package name.
- `<author-name>`, `<author-email>` — for `pyproject.toml`.
- `<description>` — one-line project description.
- `<license>` — SPDX identifier (default `MIT`).
## Guardrails
- **Never** scaffold into a non-empty directory without explicit user
confirmation.
- **Never** invoke `jj describe` — the first commit is the user's call.
- **Never** invent dependency versions beyond the conservative pins in
`pyproject.toml.tpl`.
- **Never** add packages outside the templates without asking — keep
the scaffold lean and let the user grow it.
## See also
- [`../containerize-project/SKILL.md`](../containerize-project/SKILL.md)
— owns the Docker templates and the three-stage pattern rationale.
- [`../../engineering/dev-python/SKILL.md`](../../engineering/dev-python/SKILL.md)
— workflow that this scaffold sets up.
- [`../../engineering/write-readme-py/SKILL.md`](../../engineering/write-readme-py/SKILL.md)
— README generator that reads the scaffolded `pyproject.toml` and
`justfile`.