> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tryhamsa.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Template Syntax & Naming

> Variable reference syntax and naming rules

## Variable References

Use double curly braces in text fields:

```
{{variable_name}}
```

### Valid Examples

```
"Hello {{customer_name}}, your appointment is at {{appointment_time}}"
"Your order #{{order_id}} will arrive on {{delivery_date}}"
```

### Invalid Examples

```
{user_input}           ❌ Single braces
{{User Input}}         ❌ Spaces
{{user-input}}         ❌ Hyphens
{{userInput}}          ❌ camelCase not allowed
{{ user_input }}       ❌ Spaces inside braces
```

### Template Validation

The system checks:

* **Existence**: Referenced variable exists
* **Syntax**: Valid `{{name}}` form
* **Types**: Value matches declared type where relevant
* **Availability**: Variable is available at the current node (flow agent)

## Naming Conventions

All variables must follow these rules:

### Rules

1. **Format**: `snake_case` only
2. **Start**: Lowercase letter (a–z)
3. **Characters**: Lowercase letters, digits, underscores
4. **Length**: 1–50 characters
5. **Reserved**: Do not reuse system variable names

### Valid Examples

```
customer_name          ✅
appointment_date_1     ✅
user_phone_number      ✅
api_response_data      ✅
is_premium_user        ✅
```

### Invalid Examples

```
customerName           ❌ camelCase
Customer_Name          ❌ Capital letters
customer-name          ❌ Hyphens
customer name          ❌ Spaces
123_customer           ❌ Starts with number
_customer_name         ❌ Starts with underscore
customer_name!         ❌ Special characters
```

See [System Variables](./system-variables) for reserved names and [Validation](./ui-and-validation) for how errors are shown.

## Jinja2 Template Syntax

Prompts support full **Jinja2** template syntax beyond simple `{{variable_name}}` substitution. You can use conditionals, filters, and any standard Jinja2 expression:

```
{% if direction == "outbound" %}
Hi {{customer_name}}, I'm calling from Acme Corporation.
{% else %}
Thanks for calling! How can I help you today?
{% endif %}
```

```
Your balance is {{balance | default("unavailable")}}.
```

Templates are processed server-side — the LLM receives the rendered output, not the template. For the full syntax reference including all filters, tests, and operators, see the [Jinja2 Template Designer Documentation](https://jinja.palletsprojects.com/en/stable/templates/).
