Prompt Templates
On this page
You type /review in a session and kli sends a long, specific code-review
prompt to the model as if you had written it yourself. You wrote that prompt
once, in a file. That file is a prompt template.
A prompt template is a Markdown file. Its name, minus the .md, becomes the
slash command; its body is the text kli submits as your message. When you run
the command, the body enters the conversation as user input and reaches the
agent. The transcript still shows the short command line you typed, while the
model sees the full body. No code and no config schema: a file with a name and
some text.
This is the zero-code altitude of extending kli, and it is itself an
extension. The builtin prompt-templates extension scans your prompts directories
and registers one slash command per file, with a retractor that unregisters them on
reload; you supply the Markdown, it writes the effect.
Reach for it whenever you find yourself retyping the same instructions.
Where templates live
kli reads templates from two places:
~/.config/kli/prompts/— global, available in every session.<repo>/.kli/prompts/— per project, available only in that project.
A file named review.md in either directory gives you a /review command.
Project templates extend the global set and shadow a global template of the same
name, so a project can override /review with its own version. Discovery is not
recursive: kli reads *.md directly in those directories, not in
subdirectories.
What the body can do
The body is plain Markdown, sent verbatim. It can also take arguments. When you
run /review src/parser.lisp, placeholders in the body expand from what you
typed after the command: $1 becomes the first argument, $ARGUMENTS becomes
all of them. A template that needs no arguments simply omits the placeholders.
An optional frontmatter block at the top sets a description (shown in the
command list) and an argument-hint. Leave the frontmatter out and kli derives
the description from the first non-empty line of the body.
The full placeholder syntax and frontmatter keys live in the reference. To make one now, follow Write a prompt template.