Type-safe prompt templating, testing, and tooling for LLM apps. This monorepo contains the Core engine, a CLI, and a VSCode extension.
- Core (
@prompteng/core) — LiquidJS-powered, safe prompt templates, multi-output sections, constraint tags, and first-class tests. - CLI (
@prompteng/cli) — Init project structure, run prompt tests, generate TypeScript types. - VSCode Extension — Syntax highlighting and commands for templates/tests.
If you just want to use PromptEng in your app, start with the Core docs:
Install:
npm i @prompteng/core
# or
pnpm add @prompteng/coreMinimal template (prompts/templates/email-welcome.ptemplate):
---
name: "email-welcome"
description: "Welcome email generator"
variables:
- name: recipientName
type: string
required: true
- name: productName
type: string
required: true
---
{% section 'system' %}
You are a helpful assistant writing concise, friendly emails.
{% endsection %}
{% section 'prompt' %}
Write a short welcome email for {{ recipientName }} to introduce {{ productName }}.
{% endsection %}Render it:
import { PromptEngine } from '@prompteng/core';
const engine = new PromptEngine('prompts/templates');
const { sections } = await engine.renderWithMeta('email-welcome', {
recipientName: 'Ada',
productName: 'Acme'
});
// sections.system, sections.promptWrite a simple prompt test (prompts/tests/email-welcome.ptest):
template: "email-welcome"
description: "Welcome email basic test"
providers:
- name: "mock"
model: "mock-1"
test_cases:
- name: "Simple welcome"
variables:
recipientName: "Ada"
productName: "Acme"
assertions:
- contains: "Acme"
- not_contains: "unsubscribe"Run tests (Vitest under the hood via our runner):
pnpm -F @prompteng/core testFor more examples, custom tags/filters, and type generation, see the Core README:
- 📂 prompts/ — example templates and tests you can run and modify.
Prerequisites: Node 18+, pnpm >= 9
Install dependencies and build:
pnpm install
pnpm -F @prompteng/core buildPackages:
packages/core— Core rendering engine, providers, testing frameworkpackages/cli— Command-line interface for init/test/generate-typespackages/vscode-extension— VSCode extension: syntax highlighting and commands
CLI examples (from repo):
# Build CLI
pnpm -F @prompteng/cli build
# Initialize a prompts workspace
node packages/cli/lib/index.js init
# Run prompt tests (optionally set a real provider key)
export OPENAI_API_KEY=sk-...
node packages/cli/lib/index.js test
# Generate TypeScript types from templates
node packages/cli/lib/index.js generate-typesVSCode Extension:
pnpm -F prompteng-vscode buildLaunch VSCode and press F5 to start the Extension Development Host. The extension provides:
- Prompt Template syntax highlighting (
.ptemplate) - Prompt Test syntax highlighting (
.ptest) - Explorer views: "Prompt Templates" and "Prompt Tests"
- Commands: Run Prompt, Run Tests, Generate TypeScript Types
- Testing uses Vitest.
- Templates live under
prompts/templates/. - Tests live under
prompts/tests/.
- Provider adapters beyond OpenAI