Let your AI Coding Agent write accurate Antlers Code for Statamic
A coding agent writes Antlers templates that look plausible but contain hallucinated tags and invented syntax. Providing the agent with the official Antlers cheat sheet fixes this.
Coding Agents and Statamic Antlers
LLMs are trained on loads of TypeScript and other languages. Their intelligence does not extend to every language equally. Antlers, the template engine behind Statamic, is rather new and the set of available training data is small, compared to TypeScript.
So for antlers, the model gets the broad shapes right, the curly braces, the collection names, the filter pipes. The specifics, however, are where hallucinated tags and invented modifiers creep in.
The Problem
When asked to generate Antlers code, an agent produces templates that look plausible but contain hallucinated tags, invented modifiers, or output that will simply not run. The cause is not a weak prompt but the absence of this reference material in the training data.
The model cannot correct these errors on its own, and without a proper reference, the generated templates remain unreliable.
Quick Solution
To fix hallucinated or plain non-functional Antlers output, provide the agent with the official Statamic cheat sheet.
It is accessible in two ways: install the statamic/docs repository into the project so the agent reads from the vendor directory (vendor/statamic/docs/content/collections/pages/antlers-cheat-sheet.md), or use the LLM-friendly online version at https://statamic.dev/frontend/antlers-cheat-sheet.md, which renders the same content as plain markdown.
Grounding the Agent
Add a short instruction to your AGENTS.md (or equivalent) that tells the agent to consult the official cheat sheet before writing any Antlers code. To install the repository, add a repositories entry and "statamic/docs": "^6.0" to require-dev dependency to your `composer.json`:
"repositories": [
{
"type": "package",
"package": {
"name": "statamic/docs",
"version": "6.0.0",
"type": "documentation",
"source": {
"url": "https://github.com/statamic/docs",
"type": "git",
"reference": "6.x"
}
}
}
],
"require-dev": {
"statamic/docs": "^6.0"
}Run composer update and the cheat sheet lands in vendor/statamic/docs/content/collections/pages/antlers-cheat-sheet.md, exactly where the agent looks.
Just as you can embed custom data sources into Statamic from other APIs, the same pattern works for reference documents.
The Resulting Workflow
The workflow is simple. You either explicitly reference that the Statamic docs are present in the vendor directory, and the agent finds them on its own.
Mentioning something that is required for the task is a good reinforcement, or reminder, of the project setup that is already in your `AGENTS.md`.
The alternative is to go ahead and create a skill for this. A harness such as pi makes this very easy through its skills system, which packages the reference lookup into a reusable, self-contained step the agent can invoke automatically.
A skill is also a clean place to hold your own Statamic-related preferences. As our LLM-powered website redesign showed, small product decisions about reference material can turn weeks of manual work into a single weekend.
Beyond Antlers
The tactic is not limited to Statamic. Any framework or SDK that ships its documentation inside the installed package works the same way.
In Filament, for example, the docs live side by side in the main repository, so you can already point your agent directly to vendor/filament/forms/docs/02-text-input.md whenever you work with a form field.
The model then reads the exact API from the file instead of guessing, and the same fix applies to Blade, Livewire, Alpine.js, or any other dependency whose reference material you can resolve to a path inside your project.