How to use templates
Your AI feature works, and its prompt is a string in your code that only a developer can change. Then someone asks for a one word edit, and it turns into a review and a deploy.
To use templates is to move that setup out of the code. You save the model, the instructions, the settings and the named inputs once, and your app sends only the parts that change on each call. Knowing how to use templates well comes down to three habits: separating what is fixed from what varies, changing things through versions, and reading what happened after you ship.
Why this is harder than it sounds
What are templates in an AI app?
A template in an AI app is a saved, reusable setup for one task, such as "write a product description" or "summarize this support ticket". It holds everything the model needs except the details of the current request, which your app passes in as inputs.
Moving a prompt into a template sounds like copying text into a dashboard. In practice the prompt is the easy part, and the hard part is everything around it.

- The prompt is only part of the behavior. The model you pick and its parameters shape the result as much as the wording does. Parameters are settings such as how long or how varied the answer can be.
- The changing parts are tangled in. Most hardcoded prompts mix fixed instructions with user data in one string, so nobody can say where the template ends.
- Edits erase history. Change a shared prompt in place and there is no way to tell which wording produced last week's answers.
- Someone has to own it. A prompt outside the code needs a home the people who edit it can reach.
Get those four right and your team talks about the template by name, instead of a file path.
What it actually looks like
You may have seen this happen. The same prompt is pasted into three files with small differences nobody remembers making. A customer forwards a strange answer, and you cannot tell which wording was live when it was written.
Trying a different model means changing a provider library, the request shape and the error handling. Marketing wants a warmer tone and has to wait for a developer.
The root cause is that three kinds of work share one place:
- App code covers sign in, user state, the screen and the input the user typed.
- Prompt work covers instructions, examples and the versions of both.
- Operations cover which model answers, the logs of each call and what it cost.
Only the first belongs in your code. Templates give the second its own home, and they make the third easier to see because every call now goes through a named task. Our page on AI prompt templates covers writing the prompt itself; this one is about putting it to work.
How to use templates, step by step
The steps below work whether you write the code yourself or build through Claude Code or Cursor. Start with one feature.

1. Pick one feature that calls a model
Choose the AI feature that changes most often or annoys people most, because that is where a template pays back first.
Find every place in the code that builds its prompt. If there are several, compare them and decide which one is correct before you move anything.
2. Split what is fixed from what changes
Read the prompt and mark every part that differs between calls, such as the product name, the customer's message or the target language.
Give each one a plain name, like product_name or ticket_text. Those become the inputs your app sends. Everything else, the role, the rules, the format of the answer, stays in the template.
3. Create the template
Supagen treats each AI task as a template, and a Supagen template keeps the model, the instructions, the parameters and the inputs together in one place.
You can set it up in the dashboard, or ask your agent to do it. MCP is the standard way agents connect to outside tools. The Supagen MCP server is at mcp.supagen.dev and uses streamable HTTP and OAuth sign in, so Claude Code or Cursor can create the template for you. A request like this works:
Create a Supagen template called product-description. Move the prompt from
lib/describe.tsinto it, with inputs for product_name and features, and keep the current model.
4. Test with real inputs
Run the template against inputs you have seen in real use, as well as the tidy example you wrote it with:
- A long product name
- An empty or missing field
- A message in another language
An agent connected through the Supagen MCP server can run these tests and show you the results, which is quicker than wiring up a test page. Fix the wording until the odd cases behave.
5. Call the template from your app
Replace the old prompt code with a single call that names the template and passes the inputs. The model and instructions no longer live in your code, so the app does not need to know which provider answers.
Supagen is the backend for AI features and agents: small teams and solo founders keep prompts, model choice and routing, and call logging out of their code and call every model, from text to image, video and speech, through one API.
6. Change it through versions
Supagen saves every edit to a template as a new version, and exactly one version is the active one your app gets. A tone change or a model swap becomes a new version you can test before it goes live, and the older versions stay there to compare against.
The step people skip
Most teams stop once the template ships. The useful work starts afterwards, when real calls show you what the test inputs missed. A short review loop, run every week or two, catches most problems early:

- Pull the slowest calls. Compare their version and model with the calls that ran normally.
- Look at the heaviest requests. Long inputs often come from one feature sending far more context than it needs.
- Trace expensive outliers to a feature. A single screen or job usually explains most of a surprise.
- Change one thing, then watch the next batch. One change at a time keeps cause and effect readable.
Be careful with what you conclude. Slow calls and errors rising together does not mean one caused the other; a busy provider can produce both.
Supagen keeps logs of the calls, and an agent connected through the Supagen MCP server can read those logs for you. Asking "which product-description calls were slowest yesterday, and which version were they on?" is a reasonable way to run the loop without opening a dashboard.
When this is not the real problem
Templates are not always the fix. If the prompt never changes, one person owns the feature and there is a single call site, a template adds a step without saving one.
Other problems look like prompt problems and are not:
- The inputs are bad. A template cannot fix a missing field or messy data from your own database.
- The task is wrong for the model. If no wording works, try a different model or split the task in two.
- The feature itself is unclear. If nobody agrees on what a good answer looks like, versions will only record the disagreement.
Sort those out first. Templates help once the task is clear and keeps changing.
Frequently asked questions
Do I need to write code to use templates?
No. An agent such as Claude Code or Cursor, connected to the Supagen MCP server, can build your templates, try them out and look through their logs for you.
What happens to the old prompt when I edit a template?
Supagen keeps it. Each edit becomes a new version, and only one version is active at a time.
Can a template switch to a different model?
Yes. The model is part of a Supagen template, so you switch it by saving a new version, and the app keeps calling the same template.
How much does Supagen cost?
Supagen costs USD 0 a month or USD 29 a month. There is no free trial.
Are AI templates the same as document templates?
AI templates and document templates share the idea of fixed parts plus blanks. An AI template also stores the model and its settings.
See also: AI prompt templates. When you are ready to move your first prompt out of the code, start building free.