From a595106cc5ed9c3715053f15c1ae5340a09c9f54 Mon Sep 17 00:00:00 2001 From: Lukasz Boryn Date: Tue, 23 Jun 2026 22:38:46 +0200 Subject: [PATCH] feat(write-readme-py): adopt Saduko-style README layout Extends the template and skill so a generated README matches the Saduko reference: logo block in the header table, multi-extras install, local- checks subsection, and an Apache-aware License block with attribution. - readme-py.template.md: add , , , , placeholders; Project layout block trimmed to match Saduko's flatter form - SKILL.md: read every project.optional-dependencies group (not just dev), detect logo asset, detect local-* recipes, branch the License block on the licence string; refuse to invent author or repo URL - saduko-license-block.md: new topic file with the parameterised Apache 2.0 rights / requirements / attribution / bibtex template, token resolution table, and a minimal NOTICE companion --- skills/engineering/write-readme-py/SKILL.md | 52 +++++++++++--- .../write-readme-py/readme-py.template.md | 29 ++++---- .../write-readme-py/saduko-license-block.md | 71 +++++++++++++++++++ 3 files changed, 125 insertions(+), 27 deletions(-) create mode 100644 skills/engineering/write-readme-py/saduko-license-block.md diff --git a/skills/engineering/write-readme-py/SKILL.md b/skills/engineering/write-readme-py/SKILL.md index a6c43d9..2bea45e 100644 --- a/skills/engineering/write-readme-py/SKILL.md +++ b/skills/engineering/write-readme-py/SKILL.md @@ -1,6 +1,6 @@ --- name: write-readme-py -description: Generate a README.md for a Python project scaffolded by `/build-py-project`. Reads `pyproject.toml` and `justfile` from the current directory to populate name, description, dependencies, license, and task-runner commands. Materialises a README.md and stops on `jj diff` for review before any commit. Use when the user says "write readme", "/write-readme-py", "generate readme", "document the project" inside a Python project. +description: Generate a README.md for a Python project scaffolded by `/build-py-project`. Reads `pyproject.toml` and `justfile` from the current directory to populate logo, extras, license, attribution, and task-runner commands in a Saduko-style two-column layout (logo + TOC header, multi-extras install, Docker/local quality checks, Apache-aware License block). Materialises a README.md and stops on `jj diff` for review before any commit. Use when the user says "write readme", "/write-readme-py", "generate readme", "document the project" inside a Python project. --- # write-readme-py @@ -13,31 +13,58 @@ description: Generate a README.md for a Python project scaffolded by `/build-py- 1. **Read sources.** - `pyproject.toml` → `project.name`, `project.description`, - `project.dependencies`, `dependency-groups.dev`, `project.license`. + `project.dependencies`, `project.optional-dependencies` (every group, + not just `dev`), `project.license`, `project.authors[0]`, + `project.urls.Repository` (fall back to `Homepage`). - `justfile` → each recipe name plus the comment line(s) above it. Group by section comments (lines like `# ── Docker ───`). + Detect `local-*` recipes separately for the Local subsection. + - `assets/` → first match of `.png`, `.svg`, `.jpg` + becomes the logo. Missing is fine — skip the `` tag. -2. **Refuse to invent.** If `project.description` is empty, ask the user - for a one-line description before writing. Do not fabricate - dependency versions, deps not listed, or recipes not in the justfile. +2. **Refuse to invent.** If `project.description` is empty, ask for one + line before writing. Do not fabricate dependency versions, deps not + listed, recipes not in the justfile, an author, or a repo URL. 3. **Materialise `README.md`** from [`readme-py.template.md`](readme-py.template.md), substituting: - - ``, ``, `` - - ``, `` + - ``, ``, `` (the + `project.name` with hyphens → underscores). + - `` → `<name> logo` + if the asset exists; empty string otherwise. + - `` → one `uv pip install -e ".[]"` line per + optional-dependencies group, each annotated with the group's deps in + a trailing comment. Lead with `uv pip install -e "."` for the core. - ``, ``, ``, ``, `` — built from the justfile. Omit any section whose recipes are absent. + - `` → ` Use \`local-*\` variants if you have + \`uv\` installed locally.` when any `local-*` recipes exist; empty + otherwise. + - `` → a `# Local (requires uv)` block listing each + `local-*` recipe; empty if none. + - `` → + - **Apache 2.0**: full rights / requirements / attribution / bibtex + block (see [`saduko-license-block.md`](saduko-license-block.md)), + substituting ``, ``, ``, + ``, ``, ``. + - **Anything else**: one line — ` is licensed under + .` 4. **Stop.** Tell the user: - > "Review the Installation section — the `[dev]` extras may need - > adjustment if you've added optional dependency groups beyond `dev`. - > When satisfied, describe with [`/jj-atomic`](../../productivity/jj-atomic/SKILL.md)." + > "Review the Installation extras and the License block — extras must + > match `project.optional-dependencies`; the License block defaults to + > Apache 2.0 wording only when `project.license` says so. Drop a + > `assets/.png` if you want the logo to render. When satisfied, + > describe with [`/jj-atomic`](../../productivity/jj-atomic/SKILL.md)." ## Guardrails -- **Never** invent dependency versions or recipe descriptions. +- **Never** invent dependency versions, recipe descriptions, author + names, or repo URLs. - **Never** commit. Stop after writing the file. - **Omit sections** with no source data instead of hallucinating. +- **License wording is license-specific.** Only emit the rich Saduko + attribution block for Apache 2.0; other licenses get the one-liner. ## Out of scope - R projects. The R counterpart (`write-readme-r`) is not yet written. @@ -45,6 +72,9 @@ description: Generate a README.md for a Python project scaffolded by `/build-py- analyses is the planned interface. ## See also +- [`saduko-license-block.md`](saduko-license-block.md) — the Apache 2.0 + rights / requirements / attribution / bibtex template, lifted from the + Saduko reference and parameterised. - [`../../scaffold/build-py-project/SKILL.md`](../../scaffold/build-py-project/SKILL.md) — produces the `pyproject.toml` + `justfile` this skill reads. - [`../dev-python/SKILL.md`](../dev-python/SKILL.md) — the workflow diff --git a/skills/engineering/write-readme-py/readme-py.template.md b/skills/engineering/write-readme-py/readme-py.template.md index c1897dd..14e4e30 100644 --- a/skills/engineering/write-readme-py/readme-py.template.md +++ b/skills/engineering/write-readme-py/readme-py.template.md @@ -3,6 +3,7 @@ @@ -10,7 +11,7 @@ ## Table of Contents - [Installation](#installation) -- [Docker](#docker) +- [Docker (dev)](#docker-dev) - [Quality checks](#quality-checks) - [Project layout](#project-layout) - [License](#license) @@ -24,14 +25,12 @@ Requires Python ≥ 3.11. Install with [uv](https://docs.astral.sh/uv/): ```bash -uv pip install -e "." # core: -uv pip install -e ".[dev]" # + dev tools: + ``` -## Docker +## Docker (dev) -Uses [just](https://github.com/casey/just) as a task runner. -Run `just --list` for the full set of recipes. +Uses [just](https://github.com/casey/just) as a task runner. Run `just --list` for the full set of recipes. ```bash @@ -39,7 +38,7 @@ Run `just --list` for the full set of recipes. ## Quality checks -All checks run inside Docker via `just`. +All checks run inside Docker. ```bash # Linting @@ -52,22 +51,20 @@ All checks run inside Docker via `just`. # Combined - + ``` ## Project layout ``` src// # library source - __init__.py -tests/ - fixtures/ # real data fixtures for tests -Dockerfile # base / production / development stages -docker-compose.yml # dev + production services -justfile # task runner -pyproject.toml # dependencies and tool config +tests/ # test suite +docker-compose.yml +Dockerfile +justfile +pyproject.toml ``` ## License - is licensed under . + diff --git a/skills/engineering/write-readme-py/saduko-license-block.md b/skills/engineering/write-readme-py/saduko-license-block.md new file mode 100644 index 0000000..7256ce6 --- /dev/null +++ b/skills/engineering/write-readme-py/saduko-license-block.md @@ -0,0 +1,71 @@ +# Apache 2.0 License block (Saduko-style) + +Emit this block as `` in `readme-py.template.md` **only** +when `project.license` resolves to Apache 2.0. For any other licence, +emit the one-liner ` is licensed under .` +instead. + +Substitute every angle-bracketed token; if a token can't be resolved +(missing author, no `project.urls.Repository`), ask the user — do not +invent. + +```markdown + is licensed under the Apache License 2.0. + +You are free to: +- Use for any purpose (commercial or non-commercial) +- Modify and distribute the code +- Use it in proprietary software +- Patent protection included + +### Requirements: +- Include the LICENSE and NOTICE files +- Preserve copyright notices +- State any changes you made + +### Attribution +When using , we appreciate attribution such as: + +In your project: +> Powered by by + +In academic papers: +```bibtex +@software{, + author = {, }, + title = {: }, + year = {}, + url = {} +} +``` + +Full license: See LICENSE and NOTICE files. +``` + +## Token resolution + +| Token | Source | +|---|---| +| `` | `pyproject.toml` → `project.name` | +| `` | `pyproject.toml` → `project.description` | +| `` | `project.authors[0].name` (full name as given) | +| `` | last whitespace-separated token of `` | +| `` | everything before `` | +| `` | current year (UTC) | +| `` | `project.urls.Repository`, fall back to `Homepage` | + +## NOTICE file + +The block references a `NOTICE` file. If the repo does not already have +one, write a minimal `NOTICE` alongside the README: + +``` + +Copyright + +This product includes software developed by . +``` + +The Apache 2.0 licence does not *require* a NOTICE file unless the +upstream `LICENSE` says it does, but the attribution block references it, +so emit one to keep the README honest.
+