Quick start
1. Initialize your project
Run the init command in your project root:
npx @typeprompt/cli initThis scaffolds a typeprompt.yaml configuration file and a prompts/ directory containing a starter template. See project structure for how files are organized.
2. Configure target languages
Edit typeprompt.yaml to specify where generated code should be written, for each language you target. For example, to generate TypeScript and Kotlin:
gen:
typescript:
file: src/gen/prompts.ts
kotlin:
file: src/main/kotlin/gen/Prompts.kt
package: com.example.promptsSee the language guide for your target (TypeScript, Python, Kotlin, Rust, C++, Swift, Dart, or C#) in the Languages menu above for the exact options and runtime dependencies.
3. Write a template
Create a .tp file under prompts/ describing your template's schema, instructions, and few-shot examples. See template syntax for the full XML syntax and schema language for the type system.
4. Generate code
npx @typeprompt/cli genPass --watch to regenerate automatically as you edit your templates:
npx @typeprompt/cli gen --watchThe generated code exposes a prompts object with one typed render method per template. Render it with typed input, send the result to your LLM, then parse the response back into a typed object — see the guide for your language for the exact API.
Using with AI coding agents
If you use an AI coding agent (Claude Code, Cursor, Codex, etc.), install the TypePrompt agent skill so it knows the .tp template syntax, schema rules, and CLI:
npx skills add gepheum/typeprompt