Skip to content
Back to skills

Lean Doc Generator

ASecurity

Use when creating, updating, or reviewing technical documentation, ADRs, sprint files, or AI-context files; running the sprint lifecycle (promote / execute / close); or **migrating existing docs** (dev-flow / adlc-flow / any layout) into the lean-flow standard. Follows the LEAN DOCUMENTATION STANDARD — WHY and WHERE only, never HOW. Do not use to document HOW something works; redirect to code comments instead.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 1, 2026
ai-agentsgobashawstestinggitfrontenddocumentation

Security analysis

A100/100

Pro scans all 20 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add aldianriski/lean-flow --skill lean-doc-generator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Lean Doc Generator?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Lean Doc Generator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aldianriski-lean-doc-generator/badge)](https://www.skillsdirectory.com/skills/aldianriski-lean-doc-generator)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: lean-doc-generator
description: Use when creating, updating, or reviewing technical documentation, ADRs, sprint files, or AI-context files; running the sprint lifecycle (promote / execute / close); or **migrating existing docs** (dev-flow / adlc-flow / any layout) into the lean-flow standard. Follows the LEAN DOCUMENTATION STANDARD — WHY and WHERE only, never HOW. Do not use to document HOW something works; redirect to code comments instead.
argument-hint: "[ | <type> <subject> | promote | close | epic \"<outcome>\" | prd | migrate | init]"
allowed-tools: Read, Write, Edit, Bash(git *), Glob, Grep, Agent, SendMessage, AskUserQuestion
user-invocable: true
version: "0.4.0"
---

# Lean Documentation Generator

Generate high-signal docs against a canonical format. Every template ships inside this skill under
`${CLAUDE_SKILL_DIR}/`; the standard itself is cited from the versioned `spec/STANDARD.md` — the
SSOT for every standard-owned rule (ADR-023).
**Inline by default; worker route on a trigger** — `promote` runs inline in this session and asks its own popups. Use the worker route (`${CLAUDE_SKILL_DIR}/references/promote-brief.md`, before source reads) only in an attended session with Agent + resumable subagents; in such a session, use it when the history opens with a compaction summary or the owner / a coordinator brief asks for a worker. Otherwise (including unattended), read inline as below; unattended promote still parks. Workers do not redispatch promote.

## Golden Rule

> Never generate documentation that explains HOW something works.

| Explains… | Goes in… |
|---|---|
| HOW it works | code (comments, types, tests) |
| WHY decided | a rich ADR — one file at `docs/adr/ADR-NNN-<slug>.md` (`templates/ADR.md.template`); add a row to the `docs/DECISIONS.md` index. Offer one only when it clears STANDARD §4's three-part bar |
| WHERE things live | `docs/architecture/overview.md` or `README.md` |
| WHAT changed | `CHANGELOG.md` (root) |
| Unsure | code |

## Bundled + cited assets (load these — do not free-generate)

- `spec/STANDARD.md` — the standard (cited, not bundled — ADR-023): 4 Laws, Core Files + line caps, ownership header, ADR format, HOW filter, checklist. **Read first.**
- `${CLAUDE_SKILL_DIR}/templates/*.md.template` — the canonical format per doc type. **The template IS the format** — read the matching one before writing any core doc.
- `templates/DESIGN.md.template` — **OPTIONAL · frontend-only · non-core.** Offer only for UI/frontend repos wanting a shared design-system / token contract (`docs/DESIGN.md` or repo's design dir). Never auto-create; never include in core doc generation. Direction fields come only from the owner's answers or their own file; the agent formats, never invents; no answer leaves `[CUSTOMIZE]`.
- `templates/RESEARCH.md.template` — **occasional · create-lazily.** A decision-driving question → options · evidence · recommendation that **feeds an ADR** (desk synthesis; distinct from `/prototype` = design you must *feel*, and `/council` = a hard fork). → `docs/research/<slug>.md`.
- `templates/roadmap.md.template` — **occasional · create-lazily** (a delivery sequence spanning ≥ 2 sprints or epics; ordinary `<type> <subject>` mode). Phased vertical-slice rows with Status + Covered by. → `docs/product/roadmap.md`.
- `templates/deployment-guide.md.template` + `templates/deployment-rollback.md.template` — **occasional · create-lazily.** Deploy flow, env matrix, migration order, health checks, release verification (guide) + rollback process + verification (rollback) — operational, like setup. `/release-patch` bumps + stops before push; these own the push/deploy/rollback steps. → `docs/deployment/deployment-guide.md` / `docs/deployment/rollback-guide.md`.

## Modes

| Command | Behavior |
|---|---|
| `/lean-doc-generator` | Update every doc touched this session; refresh `last_updated` |
| `/lean-doc-generator <type> <subject>` | Create/update one core file |
| `/lean-doc-generator promote` | Sprint Promote (below) |
| `/lean-doc-generator close` | Sprint Close (below) |
| `/lean-doc-generator epic "<outcome>"` | **Open an epic** — a *multi-sprint* outcome (below). One sprint's worth of work is a sprint; an unnameable destination is fog (`/task-decomposer --fog`) until it isn't |
| `/lean-doc-generator prd` | **Create/update `docs/product/requirements.md`** (+ `acceptance-criteria.md`) from `templates/product-requirements.md.template`. The durable, project-scoped requirements doc — distinct from the per-feature PRD `/task-decomposer` synthesizes at intake, whose approved residue is sanitized *into* this file |
| `/lean-doc-generator migrate` | **Adopt + clean** existing docs (dev-flow · adlc-flow · any layout) — align placement/format/wiring, **consolidate dupes, retire dead docs**, and **add the repo profile** (same as init) while keeping every decision. Plan → approve → apply. **Re-runnable as an update sync** (never clobber). |
| `/lean-doc-generator init` | **Scaffold a fresh repo** — writes the **repo profile** (Stack, Conventions in use, five business topics: Business goal · Main flows · Invariants · Quality attributes · Non-goals) from the scan, the repo's docs and any matched question set; asks only what none settles, with one reviewed suggestion per applicable prompt; docs-only (never `settings.json`), never overwrites; hands over to migrate when chosen for existing docs. |

`TODO.md` present and no `docs/work/` → v1 · both present → mixed · only `docs/work/` → v2 (existence only, never content).
`promote` / `close` / epic rollup refuse v1 or mixed by name and point to `/lean-doc-generator migrate` — the only 2.x path accepting one; doc/ADR generation and `migrate` itself are unaffected.

## Migrate (adopt + clean existing docs)

Align an existing docs tree (dev-flow · adlc-flow · ad-hoc · **v1 work-item layout**) to lean-flow
**placement · format · wiring**; consolidate dupes, retire dead docs. **HITL + surgical**, idempotent,
report-only on re-run; **headless parks to `/handoff`**. Full procedure · plan vocabulary · out-of-scope
filter → `${CLAUDE_SKILL_DIR}/references/migration-map.md`.
Carrying a v1 `TODO.md` onto `docs/work/` → that same reference, § v1 → v2 work-item store (2.0) (a by-reference sprint's `Tn` are skipped; existing store files are never touched).

## Init (scaffold a fresh repo)

Greenfield twin of migrate. **Scope-interactive + docs-only** — base tier always, higher tiers via an
AskUserQuestion popup; docs + the safe-scaffold allowlist only, never `settings.json`. **Headless
parks to `/handoff`.** Procedure · tier table · allowlist → `${CLAUDE_SKILL_DIR}/references/init.md`.

## Execution flow

1. **Load the standard** — read `spec/STANDARD.md`. It defines the Core Files, line caps, and the template-load protocol.
2. **Date check** — compare today's date to any `last_updated:` you are about to write; if it would drift ≥1 day, ask before correcting. Never silently fix.
3. **Staleness scan** — read `.claude/CONTEXT.md` (else `CONTEXT.md`) in full (its sprint rules bind promote), only the needed sections of `docs/architecture/overview.md` (else `docs/ARCHITECTURE.md`), and the mode's source docs; adapt host paths. Missing → report, use what exists; flag stale/missing ownership headers. On the worker route, its worker does this read.
4. **Read manifests** — `package.json` / `pyproject.toml` / `go.mod` etc. + existing docs. If inaccessible, ask the user to paste the file tree + manifest.
5. **HOW filter** — discard anything that explains implementation; keep WHY / WHERE / WHAT only.
6. **Template-load protocol** *(this is the step that, when skipped, produces wrong docs)* — for each core file, **Read `${CLAUDE_SKILL_DIR}/templates/<X>.md.template` BEFORE writing**. Match its frontmatter order, section order, and placeholders; replace `[CUSTOMIZE]` / `[bracket]` tokens with real content. If the template is missing, WARN and fall back to `STANDARD.md §2` — never hard-stop. Template wins on any divergence; note the correction inline.
7. **Write** — use **STANDARD §2** placement, `/humanizer` embedded mode, line caps and ownership headers. Follow `references/sprint-by-reference.md` § Writing docs and commits for the prose/commit pass and same-commit knowledge-index regeneration.
8. **Close** — open with one line carrying the verdict (what was delivered or decided) and the next step, then docs delivered + headers to verify, then exactly one `Next:` line; every confirmation popup this skill raises leads with its decision the same way.

## Creates vs consumes (the boundary)

**This skill creates every core doc; `/task-decomposer` consumes them and emits tasks.** Two artifacts
share the word "PRD" and are not the same thing: the **feature PRD** is a *working* intake artifact
(Problem · User Stories · Implementation/Testing Decisions) that `/task-decomposer` synthesizes to slice
against — not a §2 core file; **`docs/product/requirements.md`** is the durable, project-scoped core doc
this skill owns. The pipeline is *feature PRD → sanitize → requirements.md*, never a second copy of the
same content. `--prd <path>` on the decomposer therefore means **consume this file**, nothing else.

## Epic (a multi-sprint outcome)

`docs/epic/EPIC-NNN-<slug>.md` from `templates/EPIC.md.template`, + a lazily-created `epic/INDEX.md`.
**Admission test, in order:** can you write the outcome as ONE verifiable sentence? *No* → it is fog,
route to `/task-decomposer --fog`. *Yes, and it fits one sprint?* → it is a sprint, not an epic. Only a
nameable outcome that genuinely spans sprints earns a file. Created here; **consumed** by
`/task-decomposer --epic`, which never creates one. Member sprints are appended at promote and
completed at close (Sprint lifecycle below); the epic closes only when every § Closed-when condition
is `[x]`, not when its last sprint closes. Retention → STANDARD §11. **Activation (`status: active`) lists the epic's uncovered open conditions** — rule + procedure → `${CLAUDE_SKILL_DIR}/references/epic-coverage.md`. A proposal someone reviews before activation runs that review under `orchestrator/references/review-scoping.md` § Draft reviews (at most two rounds).

## Sprint lifecycle

The active sprint is its own file — `docs/sprint/SPRINT-NNN-<slug>.md` from `templates/SPRINT.md.template`.
`docs/work/backlog/` is the Backlog **pool**; the sprint file is the **active** plan + Retro, and the Execution Log is its uncapped sibling `docs/sprint/logs/SPRINT-NNN-<slug>.md` (ADR-014).
Optional **streams**: a multi-stream repo runs one active sprint *per stream* (`stream:` frontmatter ·
one `status: active` sprint per stream); single-stream repos omit it — unchanged.

| User says… | Do |
|---|---|
| "promote" / "start sprint" | **Layout check gates entry (v1/mixed stops here, § above).** **Governance review first** (below) → **size-check what you are about to pull: a `[size: L]` task is split (or sent back to `/task-decomposer`) BEFORE it is rendered, never after.** The Plan freezes at promote, before G1; a later split costs a scope-change. At pull time it costs nothing → promote **by reference** (`references/sprint-by-reference.md`): move the chosen `state: ready` tasks (and any dependent whose every open blocker joins with it, in a later wave) `docs/work/backlog/ → todo/` (the git case: `git mv` in their own commit; no git — `git rev-parse --git-dir` fails at the root — a plain move), stamp `sprint:`, render a new `docs/sprint/SPRINT-NNN-<slug>.md` from `templates/SPRINT.md.template` — `## Members` lists the files; each Plan `Tn` holds sprint-scoped meta only, **never a DoD copy**; set `status: active` + `plan_commit` (**the freeze**; with no git, `none (no git)` plus a verbatim `## Done when` snapshot in the promote entry — that reference says what each pins); **once the batch G1/G2 pass is signed, record it as `gates_signed: G1,G2 @ <sha>` (`@ <YYYY-MM-DD>` with no git) in the sprint frontmatter — an unattended run reads only the sprint file for sign-off. Omit the field until the gates are actually signed: its absence means NOT signed, and must never be read as approval**; **if the tasks advance an open epic, set `epic: EPIC-NNN` in frontmatter and append the sprint's row to that epic's § Member sprints** (ask which epic only when it is ambiguous — never guess one); **refuse to render while an active epic this sprint touches has an uncovered open Closed-when condition, unless the owner records an override (`references/epic-coverage.md`)**; **multi-stream: confirm which stream this sprint belongs to before writing `stream:`**; **render the Execution Log from `templates/sprint-log.md.template` with the `promote` entry carrying the signed governance checklist**, in the same commit `sprint(N): plan locked` (the git case) |
| executing during a sprint | Tick the member file's `## Done when` `[x]` as each passes (rewording it needs a `scope-change` Log entry naming the id **before** the edit — the freeze); append `progress` to the Execution Log, never edit § Plan. Progress, surprises and Files Changed → `references/sprint-by-reference.md` § During execution |
| "close" / "sprint done" | **Layout check gates entry (v1/mixed stops here, § above).** Follow `references/sprint-by-reference.md` § Close by reference for member/freeze checks, one close commit, archive pin, epic rollup, retention, doc freshness and release routing |

**Retro at close** — first **sweep the full session** (the Execution Log + any TD/follow-up surfaced mid-run but not yet filed), then sort the sprint into four buckets and **route each to its durable home** (STANDARD §10):
Shipped → `CHANGELOG.md` (root; legacy `docs/`), listing each fixed `type: bug` item with its one-line root cause · Tech debt → `TD-NNN` in root `TECH-DEBT.md` · Follow-ups → a new task file in `docs/work/backlog/` **stamped `origin: close-retro`** (filed from a Retro, never grilled at intake — the stamp is what denies them G1's fast-path) · Learnings → `L-NNN` in `docs/LEARNINGS.md`. **Auto-file all four** (per `templates/LEARNINGS.md.template`); show the user what was filed.
**Unattended** — close splits: the Retro, the four-bucket auto-file, and the close commit are **additive → they run**; §11 retention (archive · move · prune · compact) and the doc-freshness propose→approve are **lossy or approval-bound → they park** for the morning. Never approve your own retention pass to "finish the close".
**Handoff reconciliation gates close (STANDARD §12(b)).** Sweep the Execution Log for any `handoff`
entry not yet `spent`; route each item to a durable home (or rule it needs none) and append a
`spent` entry sharing its `handoff-path` — a close-time check FAILs over one still `live`/`consumed`. Full protocol → `references/handoff-reconciliation.md`.

**Governance review at promote** — before planning, run the scan and **emit it as a checklist the owner signs off on**, never silent prose:
`☐ L-promotion (count≥2, promoted:no; each with a disposition): <findings|none>` · `☐ TD aging (≥3 sprints unaddressed): <findings|none>` · `☐ doc-aging — §11 retention (TD deletion · CHANGELOG rotation · LEARNINGS pointer-collapse) **+ every §2 cap breach**: <findings|none>`.
· `☐ epic rollup currency (every `status: active` epic): <findings|none>` · `☐ epic coverage (every active epic): <findings|none>` · `☐ roadmap coverage: <findings|none>` (reported to sign, never a refusal) · `☐ handoff ledger (root HANDOFF-LEDGER.md, live/consumed rows): <findings|none>`
**Doc-aging reads from two sources and neither is this list.** §11's ledger owns *retention*; §2's table owns *caps*. Report every §11 trigger that fired **and** every §2 breach — sourced from the project's own cap check where it has one, otherwise measured directly against §2's table. **Never restate a §2 cap figure here**: the enumeration above is a routing hint, not the source, and a copied number is a second SSOT that drifts from the row it copied.
**Epic rollup currency is a THIRD source and is not doc-aging.** Retention asks *should this epic be
archived?*, a question that only goes live at the end; this asks *is an active epic's rollup current?*
Three drift classes, each its own finding: a closed member sprint with no rollup row — or a row
carrying no `close_commit` — in § Member sprints; an ownership header whose `last_updated` predates its
own trigger's last firing (for an epic, the newest member close); a ticked § Closed-when condition
naming no closing sprint. A schema check proves presence, not currency.
Resolve each ☑ line before sign-off: promote flagged learnings into a durable rule **placed by §10's placement test** — ask which flows can hit the failure, place it where all of them read (a skill red-flag fires in that skill's flow alone) — and mark `promoted: yes → <where>` **with a stated `disposition:`** on the pointer line (`replace` · `merge` · `move-to-reference` · `automate-into-check` · `retain` + justification — a promotion without one is not done; a soft §2 breach closes the same way, by a row in `.cap-dispositions`); aged TD → re-review prompt, `severity: high` → auto-escalate Backlog P1; doc-aging → propose compression, apply on approval. **Explicit owner sign-off on the checklist is required before rendering the sprint file or committing `plan locked`.**
**Unattended** — promote is HITL end-to-end (it *forms* the Plan, so nothing here is pre-approvable): a headless run **parks** at the scan and exits; it never signs its own checklist, and never renders a sprint to get on with the night. Same for `migrate`/`init` per-item approvals (recorded there too — see each section). Every park is **recorded, not merely performed**: no sprint file to log into → the record (what stopped · its unblock condition) goes in the `/handoff` doc. Contract → `orchestrator/references/night-run.md` Part 0.

## Red flags

❌ **Writing a core doc without reading its template** — the cause of skipped/wrong generation; Step 6 is mandatory.
❌ **HOW in a doc** — redirect to a code comment; never raise a line cap to fit HOW.
❌ **No ownership header** — STANDARD §3 requires one on every doc; refresh it before you leave the file.
❌ **A person as owner** ("Alice") — reassign to a role.
❌ **Stale doc used as source** — run the staleness scan first.
❌ **A new file outside the core set** — fit it into an existing core file or a code comment.

Files in this skill

  • SKILL.md18.3 KB
  • references/ADR-example.md3.1 KB
  • references/epic-coverage.md4.8 KB
  • references/handoff-reconciliation.md5.7 KB
  • references/humanize-pass.md1.1 KB
  • references/init.md21.1 KB
  • references/migration-map.md36 KB
  • references/profiles/README.md744 B
  • references/profiles/go-chi.md2.2 KB
  • references/profiles/postgres.md2.5 KB
  • references/profiles/react-vite.md2.8 KB
  • references/profiles/vue-vite.md3.1 KB
  • references/promote-brief.md5 KB
  • references/sprint-by-reference.md15.8 KB
  • templates/ADR.md.template2.1 KB
  • templates/AGENTS.md.template500 B
  • templates/BUG.md.template1.6 KB
  • templates/CHANGELOG.md.template1.1 KB
  • templates/CLAUDE.md.template3 KB
  • templates/CODE_OF_CONDUCT.md.template5.7 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.