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

# Prompt variables

> Render prompt values and generate their TypeScript types

Add variables with double braces:

```text theme={null}
You are a support agent for {{product}}. The customer is {{name}}.
```

Pass values when resolving the prompt:

```ts theme={null}
const prompt = await anpord.prompts.get({
  id: "support-reply",
  variables: { product: "Anpord", name: "Charlie" },
});
```

The returned `content` contains the rendered values.

Runtime values may be strings, numbers, booleans, `null`, or `undefined`. Generated declarations type each variable as a string. Dots and hyphens belong to the key, so `{{user.name}}` reads `variables["user.name"]`. Use `{{{{name}}}}` to render the literal text `{{name}}`.

When a `variables` object is present, every token needs a non-null value. A missing, `null`, or `undefined` value makes the call fail. Omit `variables` to return the unrendered template.

## Generate types

```bash theme={null}
npx anpord generate
```

The command writes `anpord-env.d.ts`:

```ts theme={null}
import "anpord";

declare module "anpord" {
  interface AnpordPromptVariables {
    "support-reply": { product: string; name: string };
  }
}
```

For prompts with extracted variables, TypeScript checks the keys whenever a caller supplies `variables`. A generated prompt with no variables keeps the loose runtime map type. The `variables` property remains optional so callers may still request the raw template.

Generation reads the first 100 prompts. Commit the generated file and regenerate it after adding, removing, or renaming a variable. Without generation, the SDK accepts any flat map of supported runtime values.
