# WP-43 — Runnable leaf generators Status: done (value-object + form-machine; ui-component/bff-endpoint kept as skills) Phase: 8 — platform/DX/showcase Priority: P3 ## Outcome Tool = **plop**. `plopfile.mjs` + `plop-templates/` provide two runnable generators for the pure-TS patterns: `npm run gen:value-object` (branded type + `parseX` + spec, mirrors postcode/bsn) and `npm run gen:form-machine` (Draft/Valid/Errors + Editing/Submitting/Submitted/Failed union + `initial`/pure `reduce`/`assertNever` + spec, mirrors change-request.machine). Prompts take context + PascalCase name (positional-arg bypass for scripting); each emits a co-located spec so the "pure logic must have a spec" rule holds by default; a post-action reminds to add the English `` for the generated `$localize` id. Smoke-tested (both generate → lint + dep:check clean), then the demo output removed. Skills (`value-object`, `form-machine`) point at the generator. `plop-templates/` is prettier-ignored (Handlebars, not TS). **Scoped out (kept as skills):** `gen:ui-component` (Angular template `{{ }}` collides with Handlebars) and `gen:bff-endpoint` (spans the C# backend + `gen:api` regen) — a generator adds little over the recipe there. ## Why The house patterns (value object, form machine, bff endpoint, ui component) are documented only as agent-executed prose skills; there's no `npm run gen:*` a developer runs to emit the boilerplate. For a template meant to bootstrap real registers, mechanise the highest-churn recipes. ## Decisions - **Step 1 — tool fork:** plop (recommended: tiny, readable templates, `npm run gen:*`) vs Angular schematics (native `ng generate`, heavier to author). Decide before building. - Generators emit house-pattern files **with co-located spec/story**, matching current idioms: `gen:value-object`, `gen:form-machine` (page/wizard), `gen:bff-endpoint`, `gen:ui-component`. - Templates become the single source; each matching skill gets a one-line "run `npm run gen:x`, then …". ## Files - New `plopfile.mjs` (or `schematics/`) + template files; `package.json` `gen:*` scripts. - Update the corresponding `.claude/skills/*/SKILL.md` to invoke the generator. ## Acceptance criteria - [x] `gen:value-object` + `gen:form-machine` emit files that pass `npm run lint` + `dep:check` with no hand-edits beyond the domain specifics (rule/fields) + the en.xlf target. - [x] Generated units include their co-located spec. - [x] Smoke-tested both; `npm run ci` green.