A tiny, pink-powered prompt language.

YAPL is a text-based templating language built for the future of AI agents. YAPL makes prompt design composable and scalable: define blocks once, extend with mixins and inheritance, and inject variables seamlessly. Write less, reuse more — because the future of agents deserves better prompts.

Inspired by TwigMIT LicensedFrom AI for AI
hello.json.yapl
{
"blocks": {
  "system": "You are an expert code reviewer with deep knowledge of {{ language | default(\"programming\") }}.",
  "guidance": [
      "Focus on code quality, security, and best practices",
      "Provide specific, actionable feedback",
      {% if experience_level == \"junior\" %}
        "Explain the reasoning behind your suggestions"
      {% endif %}
  ],
  "snippets": [
    {% for snippet in snippets %}
      {
        {{ snippet }}
      }
    {% endfor %}"
  ]
}

Why YAPL #

Everything you need to write structured and reusable prompts.

🧱

Template Inheritance

Create base templates and extend them with {% extends %}. Override specific blocks while inheriting structure.

🧬

Mixins

Compose templates from reusable components with {% mixin %}. Add safety, personality, or capabilities without duplication.

🧩

Variables & Defaults

Dynamic interpolation with {{"{{ var | default(\"value\") }}"}}. Nested object access and safe rendering.

🔀

Conditionals & Loops

Adaptive prompts with {% if %} statements and {% for %} loops. Context-aware content generation.

📦

Modular Components

Break templates into reusable pieces with {% include %}. Build component libraries for consistent prompts.

Universal Runtime

Works in Node.js and browsers. File system integration, caching, and precise whitespace control for clean output.

Install #

Pick your environment. YAPL ships a CLI and a tiny JS runtime.

npm i @yapl-language/yapl.ts

Playground #

This simple client-side demo renders variables and basic blocks.
New: Try the interactive playground powered by Sandpack below!

FAQ #

How does template inheritance work?

Use {% extends "parent.yapl" %} to inherit structure, then override specific {% block %} sections. Use {{ super() }} to include parent content.

What's the difference between mixins and inheritance?

Inheritance creates parent-child relationships with {% extends %}. Mixins use {% mixin %} for composition, letting you combine multiple behaviors like safety guidelines or personality traits.

Can I use YAPL in the browser?

Yes! YAPL works in both Node.js and browsers. The browser version requires custom loadFile and resolvePath functions since it can't access the file system directly.

What file extensions should I use?

Use .yapl for templates. Common patterns include .md.yapl for Markdown prompts and .json.yapl for structured data templates.

How do I handle missing variables?

Always provide defaults: {{"{{ name | default(\"Assistant\") }}"}}. Use {% if var is defined %} to check existence, or {% if var is not empty %} for non-empty values.

Is there VS Code support?

Yes! Install the YAPL extension from the VS Code Marketplace for syntax highlighting, snippets, and file icons. LSP support for advanced features is planned.

VS Code Extension #

YAPL VS Code icon
Install from Visual Studio Marketplace
Syntax, snippets, and future LSP diagnostics.
YAPL VS Code icon
Install from Open VSX Registry
Syntax, snippets, and future LSP diagnostics.