- ✏️ built-in templating — Write prompts as Liquid templates (in
.promptformat) with YAML frontmatter. - 🛡️ Zod validation — Schema variables are validated at render time.
- 📦 Codegen — Generate typed TypeScript modules from
.promptfiles. - 🧩 Partials — Reusable prompt fragments with
{% render %}tags, flattened at build time. - 📁 Groups — Organize prompts into nested namespaces via the
groupfield.
npm install @funkai/promptsCreate a .prompt file with YAML frontmatter and a Liquid template body:
---
name: writer
schema:
tone: string
---
You are a {{ tone }} writer.
npx funkai prompts generate --out .prompts/client --includes "src/agents/**"Add the ~prompts alias to your tsconfig.json:
{
"compilerOptions": {
"paths": {
"~prompts": ["./.prompts/client/index.ts"]
}
}
}Then import and use:
import { prompts } from "~prompts";
const instructions = prompts.agents.writer.render({ tone: "concise" });| Field | Required | Description |
|---|---|---|
name |
Yes | Unique kebab-case identifier |
group |
No | Namespace path for grouping |
version |
No | Version number |
schema |
No | Variable declarations (see below) |
Each key under schema declares a template variable:
| Field | Default | Description |
|---|---|---|
type |
string |
Variable type (only string supported) |
required |
true |
Whether the variable must be provided |
description |
— | Human-readable description |
Shorthand: tone: string is equivalent to tone: { type: string, required: true }.
Use {% render 'name', key: 'value' %} to include shared partials. Partials resolve from:
- Custom partials —
.prompts/partials/in your project (takes precedence) - Built-in partials — SDK's bundled
identity,constraints,tools
For comprehensive documentation, see the Prompts concept and Prompts CLI reference.