From 7cd2e447994d5feb2d58d43a996eb9201300ac55 Mon Sep 17 00:00:00 2001 From: Lukasz Boryn Date: Wed, 17 Jun 2026 10:10:36 +0200 Subject: [PATCH] fix(skills): harden write-readme from review findings - fix(skills): guard against clobbering an existing README before overwrite - fix(skills): require manifest fields present, not just marker file, before trusting ecosystem - fix(skills): resolve detection rule contradiction (ask when several markers match) - fix(skills): read project.requires-python instead of hardcoding python floor - fix(skills): make usage fence language a placeholder, not hardcoded bash --- skills/engineering/write-readme/REFERENCE.md | 6 +++--- skills/engineering/write-readme/SKILL.md | 18 +++++++++++++++--- .../write-readme/readme.template.md | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/skills/engineering/write-readme/REFERENCE.md b/skills/engineering/write-readme/REFERENCE.md index 8892572..39bb163 100644 --- a/skills/engineering/write-readme/REFERENCE.md +++ b/skills/engineering/write-readme/REFERENCE.md @@ -6,12 +6,12 @@ when its source is absent. ## python (`pyproject.toml`) Read: `project.name`, `project.description`, `project.dependencies`, -`dependency-groups.dev`, `project.license`. Task runner: `justfile` -recipes (group by `# ── Section ──` comments). +`project.requires-python`, `dependency-groups.dev`, `project.license`. Task +runner: `justfile` recipes (group by `# ── Section ──` comments). ``` ## Installation -Requires Python ≥ 3.11. Install with [uv](https://docs.astral.sh/uv/): +Requires Python . Install with [uv](https://docs.astral.sh/uv/): uv pip install -e "." # core: uv pip install -e ".[dev]" # + dev tools: diff --git a/skills/engineering/write-readme/SKILL.md b/skills/engineering/write-readme/SKILL.md index ce49220..eaaff8b 100644 --- a/skills/engineering/write-readme/SKILL.md +++ b/skills/engineering/write-readme/SKILL.md @@ -15,7 +15,8 @@ description: Generate a README.md for any project by detecting its ecosystem fro ## Process -1. **Detect ecosystem** (first marker wins; ask if none or several): +1. **Detect ecosystem** (check in listed order; if several markers are + present, ask which is authoritative; if none, use generic): | Marker | Ecosystem | Source of truth | |---|---|---| | `pyproject.toml` | python | `[project]` + `justfile` | @@ -31,6 +32,10 @@ description: Generate a README.md for any project by detecting its ecosystem fro 2. **Read sources, never memory.** Pull `name`, `description`, `license`, dependencies, and runnable commands from the files above. For a generic repo, read the scripts and any existing README to learn what it does. + A marker file can exist without authoritative metadata (monorepo roots, + tool-only `pyproject.toml` with no `[project]` table) — confirm the + manifest actually carries the fields before trusting the detected + ecosystem; if it does not, fall back to generic and ask. 3. **Refuse to invent.** If the description is empty, ask the user for a one-line description before writing. Never fabricate dependency @@ -38,17 +43,24 @@ description: Generate a README.md for any project by detecting its ecosystem fro not in the repo. Keep shell commands **verbatim** — they are the author's tested values; flag anything suspect instead of "fixing" it. -4. **Materialise `README.md`** from +4. **Guard an existing README.** If `README.md` already exists, show its + diff and get explicit confirmation before overwriting — on a repo not yet + under version control there is no undo for a clobbered hand-written file. + +5. **Materialise `README.md`** from [`readme.template.md`](readme.template.md): - ``, ``, ``, ``. - `` — the ecosystem's install snippet (REFERENCE.md). - `` — task-runner recipes (grouped by section comment), CLI invocation, or setup steps for a config/script repo. + - `` — the fence language for the usage block (`bash` for + shell/task-runner, `r` for an r-analysis pipeline, `rust`/`console` + as fits the ecosystem). Do not leave it as `bash` for non-shell usage. - `` — the real top-level tree, annotated. - **Omit** any section with no source data instead of padding it. -5. **Stop. Do not commit.** Tell the user: +6. **Stop. Do not commit.** Tell the user: > "Review with `jj diff`. Check that the Installation and Usage blocks > match how you actually run this. Describe with `/jj-atomic` when > satisfied." diff --git a/skills/engineering/write-readme/readme.template.md b/skills/engineering/write-readme/readme.template.md index 0d17578..ecbe721 100644 --- a/skills/engineering/write-readme/readme.template.md +++ b/skills/engineering/write-readme/readme.template.md @@ -35,7 +35,7 @@ to run. --> ## Usage -```bash +``` ```