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.
{
"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 %}"
]
}
Everything you need to write structured and reusable prompts.
Create base templates and extend them with
{% extends %}
. Override specific
blocks while inheriting structure.
Compose templates from reusable components with
{% mixin %}
. Add safety, personality,
or capabilities without duplication.
Dynamic interpolation with
{{"{{ var | default(\"value\") }}"}}
.
Nested object access and safe rendering.
Adaptive prompts with
{% if %}
statements and
{% for %}
loops. Context-aware
content generation.
Break templates into reusable pieces with
{% include %}
. Build component
libraries for consistent prompts.
Works in Node.js and browsers. File system integration, caching, and precise whitespace control for clean output.
Pick your environment. YAPL ships a CLI and a tiny JS runtime.
npm i @yapl-language/yapl.ts
This simple client-side demo renders variables and basic blocks.
New: Try the interactive playground powered by Sandpack
below!
Use {% extends "parent.yapl" %}
to
inherit structure, then override specific
{% block %}
sections. Use
{{ super() }}
to include parent
content.
Inheritance creates parent-child relationships with
{% extends %}
. Mixins use
{% mixin %}
for composition, letting
you combine multiple behaviors like safety guidelines or personality
traits.
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.
Use .yapl
for templates. Common
patterns include .md.yapl
for
Markdown prompts and .json.yapl
for
structured data templates.
Always provide defaults:
{{"{{ name | default(\"Assistant\") }}"}}
. Use {% if var is defined %}
to
check existence, or
{% if var is not empty %}
for
non-empty values.
Yes! Install the YAPL extension from the VS Code Marketplace for syntax highlighting, snippets, and file icons. LSP support for advanced features is planned.