Appearance
A prompt template is a file with named slots. You invoke it like a function — pass arguments in, get a contracted output back. Reusable, parameterizable, audit-traceable.
Pattern
Slash Command Prompt Template
Anatomy
Five sections. Each has one job.
.claude/commands/feature.md
Variables
Declares interpolation slots. The invoker supplies values; the template substitutes.
# Variables
$1 = issue_number
$2 = commit_sha
$3 = issue_json
Instructions
High-level directives. Tone and posture.
THINK HARD.
Research the codebase before editing.
Be surgical — change the minimum required.
Relevant Files
Glob patterns the agent must read before acting. Bounds context — not too little, not too much.
app/adws/adw_modules/**/*.py
app/agents/$1/spec.md
app/tests/test_$1_*.py
Format
The exact output shape. Markdown skeleton for plans, JSON schema for structured data.
{
"plan": string,
"files_to_change": string[],
"risk": "low" | "med" | "high"
}
Report
What the agent returns on completion. A path, a summary, a JSON blob — declared explicitly.
Write result to $SESSION_DIR/plan.json
Print the path on stdout.
Invocation
Pass arguments. Get a contracted output.
claude -p"/feature 47 cc73faf1 '{...issue JSON...}'"
↓
$1→47
$2→cc73faf1
$3→{"title": "Add auth", ...}
↓
✓ Returns JSON matching the declared Format.
✓ Same schema every invocation. Downstream tooling can parse.
The template is the function. The arguments are the call. The Format is the type signature.
The extended menu
Up to nine sections. Pick what the task needs.
Why prose prompts fail
Every invocation drifts. The agent fills gaps with guesses.
Prose promptone-off
"Hey Claude, look at issue 47 and fix it. Do it well."
What's missing
- ✗ no variable slots → not reusable
- ✗ no declared format → output varies run-to-run
- ✗ no files-to-read → agent guesses what to load
- ✗ no report contract → downstream parsing breaks
Consequence
Second invocation produces different output than the first. You can't eval it, you can't pipe it, you can't compare runs.
Templatereusable
/feature 47 cc73faf1 '{...}'
What it gives you
- ✓ variable slots → run it 100x with different args
- ✓ declared format → output is parseable by contract
- ✓ files-to-read → context is bounded, not guessed
- ✓ report contract → downstream tooling is stable
Consequence
Every invocation is measurable. Prompts become evals. Model upgrades become diffs.
The discipline
If a prompt runs more than once, it's a template.
Ad-hoc prompts that prove valuable get promoted. The template turns plan-is-the-prompt from aspiration into mechanics — each section is a contract the agent can't drift past.