| name | add-template |
| description | Add a reusable email template to the local template store. Templates are markdown files with YAML frontmatter (subject, audience, scope, tags) used as starting points for new emails. Scope is either `global` (any newsletter) or a specific newsletter slug. |
Add Template
Templates live at $DATA_ROOT/templates/<template-name>.md.
Steps
-
Ask for:
- Template name (kebab-case filename, e.g.
weekly-roundup).
- Source — paste body inline, or path to an existing markdown file to copy in.
- Subject template (may include
{{placeholders}}).
- Scope —
global or a specific newsletter slug (validate against config.json).
- Audience / segment (optional, default empty).
- Tags (optional list).
-
Write $DATA_ROOT/templates/<name>.md with this frontmatter:
---
name: weekly-roundup
subject: "Weekly roundup — {{date}}"
scope: global # or a newsletter slug
audience: "" # optional segment
tags: [roundup, weekly]
created: 2026-04-29T00:00:00Z
updated: 2026-04-29T00:00:00Z
---
<body markdown here, with {{placeholders}} as needed>
-
Reject if a template with the same name already exists — direct the user to update-template.
-
Print the resolved path and a one-line summary.
Placeholders
Document the placeholders the template uses (e.g. {{date}}, {{lead_story}}) at the top of the body so future invocations of send-email can prompt for them.