> For the complete documentation index, see [llms.txt](https://help.metaforms.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.metaforms.ai/survey-programming-decipher/legacy-flow/what-are-templates.md).

# What are Templates?

Templates in Metaforms are predefined sets of rules and examples that shape how surveys are generated and programmed. Think of them as the **baseline code** or **configuration layer** that loads even before you begin programming a survey.

Templates allow you to build on top of the model’s baseline intelligence with your own custom logic and instructions - helping standardise survey logic across teams and clients.

You can create new templates or change existing templates by navigating to **Templates** tab.

Templates are built using:

* **Shell** - This includes a baseline XML, Quota sheet and other files that you can set for every single template. These also include Dynamic placeholders to be filled by AI based on the questionnaires used.

<figure><img src="/files/uXVkCkO3PfAjV6af9H3I" alt=""><figcaption></figcaption></figure>

* **AI Rules** – Clear, detailed instructions that guide how questions should be interpreted and generated.
  * **XML Examples** – Sample question structures that demonstrate the expected output.
  * **Explanations** – Supporting notes that clarify how rules should be applied.
  * **Instructions** - An explanation on how AI should generate code when this template is used.

<figure><img src="/files/mihZEdzXXtCxQUa2Podm" alt=""><figcaption></figcaption></figure>

The better defined your rules and examples, the more accurate and consistent your outputs will be.

## **Improving a Template (Continuous Tuning Process)**

To update a template effectively:

1. **Check if the rule already exists.**
   * If it does but isn’t working well, identify the failing part and update the explanation.
2. **Look for conflicting examples.**
   * Remove or reword anything that contradicts your intended logic.
3. **Improve clarity.**
   * If a rule works but isn’t well documented, add it as a distinct entry under AI Rules.
4. **Add new rules as needed.**
   * Clearly define any missing logic and support it with relevant examples and explanations.
5. **Test changes.**
   * Save the updated template, refresh the survey, and re-generate the same questions to confirm that the behaviour has been fixed.

{% hint style="info" %}
This is a **continuous improvement** process. Every refinement reduces future manual intervention and speeds up programming.
{% endhint %}

## **Using a Template in Your Survey**

To apply a template to your survey project:

* Select the desired template during **Step 2: Setup** when creating a new project in Metaforms.

{% embed url="<https://www.youtube.com/watch?list=PLHbQhZhtp5j-5YZc2HF_AW3cwwuGKSul8&v=zUpro8JfwCY>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.metaforms.ai/survey-programming-decipher/legacy-flow/what-are-templates.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
