---
name: add-template
description: Add a new built-in checklist template to Preflight. Use when the user wants a new preset list available in the app (e.g. "add a security review template", "make a template for onboarding"), or wants to turn an existing document or checklist into one.
---

# Add a checklist template

Templates live in a single file, `public/assets/templates.js`, exported on
`window.PREFLIGHT_TEMPLATES`. There is no build step — append and reload.

## Shape

```js
{
  id: 'kebab-case-id',         // unique, stable, never reused
  name: 'Human readable name',  // shown in the picker and dialog
  blurb: 'One line on when to reach for this.',
  items: [
    'A plain item',
    { t: 'An item with a reason', n: 'Why this is on the list.' },
  ],
}
```

## Rules

- **`id` must be unique and stable.** It is not used for lookup today, but
  duplicates make the file confusing and will break any future migration.
- **Items are imperative and checkable.** "Verify X" or "Check Y", not "X is
  important". If a reader can't tell whether it's done, rewrite it.
- **`n` is the reason, not the instructions.** One sentence. The point is that a
  future reader knows *why* the item exists and can judge whether it still
  applies. Prefer a concrete failure over a principle.
- **Order matters.** Items render in array order; put them in the order someone
  would actually work through them.
- **Keep a template under ~30 items.** Longer and people stop finishing them.
  Split into two templates instead.

## Steps

1. Read `public/assets/templates.js` to match the existing tone and formatting.
2. Append the new object to the `window.PREFLIGHT_TEMPLATES` array. Leave
   `blank` last — it is the escape hatch and belongs at the bottom.
3. Syntax-check before trusting it. A parse error here blanks the whole app,
   because `window.PREFLIGHT_TEMPLATES` becomes undefined:
   ```bash
   node --check public/assets/templates.js
   ```
4. Verify in the browser: open **⋯ → Load a template…** and confirm the new
   entry appears with the right item count.
5. If the user supplied source material (a doc, a wiki page, an old checklist),
   quote their wording rather than paraphrasing. They wrote it that way for a
   reason.

## Anti-patterns

- Don't add a template that duplicates an existing one with minor wording
  changes — extend the existing one.
- Don't put shell commands in `t`. This is a checklist, not a runbook; point at
  the runbook from `n` if one exists.
- Don't invent items to pad a list to a round number.
