Prompt templates
A prompt template is a named, reusable prompt body. If you find yourself pasting the same instructions into a dozen workflows, lift them into a template and reference the template by name. The template is the single source of truth; every workflow that uses it stays in sync when you edit one file.
What a template looks like
Templates live in .zen/commands/ (or ~/.zen/commands/ for templates that should apply to every project on your machine). Each template is a .md file with a frontmatter block:
---
description: Extract decisions from a meeting transcript.
argument-hint: <transcript file path or content>
---
You're reading a meeting transcript. Pull out only the decisions that were
made, in the form "We decided to X because Y." Skip discussion that didn't
end in a decision. Group decisions by topic if there are more than five.
Transcript:
$ARGUMENTSThe filename (without extension) is the template name. summarize-decisions.md registers as summarize-decisions.
Calling a template from a workflow node
nodes:
- id: pull-transcript
type: bash
command: cat $TRANSCRIPT_FILE
- id: extract-decisions
type: prompt
template: summarize-decisions
depends_on: [pull-transcript]
vars:
TRANSCRIPT: $pull-transcript.outputThe node's prompt becomes the template body with variables filled in. You can still set per-node settings (provider, timeout, retries); they apply on top of the template.
Overriding parts of a template
You can pass extra instructions per-call without forking the template:
- id: extract-decisions
type: prompt
template: summarize-decisions
extra_instructions: |
This was a board meeting; focus on capital and strategy decisions only.
vars:
TRANSCRIPT: $pull-transcript.outputextra_instructions: is appended to the template body before the model sees it.
Why templates exist
The product reason: workflows are how you save the recipe; templates are how you save the spice rack. The "summarize decisions" instruction set isn't a workflow on its own, but every meeting workflow uses it. Without templates, you'd copy the instructions into ten workflow files and update all ten the next time you improve the wording.
Templates vs. workflows
The simple test:
- If the thing is a full sequence with multiple steps, dependencies, and an output that lands somewhere, it's a workflow.
- If the thing is a single prompt body you keep using inside workflows, it's a template.
Templates are workflow primitives, not standalone executables. You don't zen workflow run a template; you reference one from inside a workflow node.
Discovery
zen command list prints the templates Z.E.N. knows about, from both .zen/commands/ and ~/.zen/commands/. Project templates win over global ones with the same name.
Where to start
Pull any prompt you've pasted into a workflow more than twice. Move it into a template file. Reference the template from the workflows that need it. Edit the template the next time the instructions need a tweak; every workflow picks up the change at next fire.