# Templates and snippets

> Templates fill a harness's instructions per request, from snippets you reuse. Write the instructions once with variables, keep shared pieces as snippets, and send the values with each task.

Canonical URL: https://harnessrouter.ai/docs/templates-and-snippets
Section: Agent capabilities

## What they are

A harness's instructions can be a template: text with variables that each request fills in. Snippets are reusable pieces of instructions, kept in folders, that any template includes by name, so a rule written once is the same in every harness that uses it.

## Writing one

- Write the template in the harness's instructions editor. Preview it with test values before you save.
- Keep shared pieces under Add-on, Snippets.
- A snippet must itself read as a template. One that does not is refused with the line that failed.

## Sending the values

A task that fills the template:

```
POST /{harness_id}/v1/responses
Content-Type: application/json

{
  "input": "Draft the renewal email.",
  "prompt": { "variables": { "customer": "Acme", "tone": "warm" } }
}
```

> **Plain instructions ignore it.** Sent to a harness whose instructions are plain text, `prompt` is ignored, and the response lists it in `metadata.ignored_fields` so you can see that it was.

## Endpoints

Snippets and preview:

```
GET    /v1/snippets                      every snippet and folder
GET    /v1/snippets/{path}               one snippet
PUT    /v1/snippets/{path}               create or replace one
DELETE /v1/snippets/{path}               delete one
POST   /v1/snippet-folders               create a folder
DELETE /v1/snippet-folders/{path}        delete a folder
POST   /v1/snippets-move                 move a snippet or folder
POST   /v1/instructions/render           preview a template with test values
```
