Writing zamn with AI agents
An agent writes valid zamn with the rules in its context and a check of every file it writes. What that costs in Claude Code, and how this setup came out of it: Engineering the zamn Claude Code skill for efficiency.
Install
In the project's root:
sh
curl -fsSL --create-dirs -o .claude/skills/zamn/SKILL.md https://zeokku.github.io/zamn/downloads/SKILL.md
cargo install zamnsh
curl -fsSL https://zeokku.github.io/zamn/downloads/zamn-agent-rules.md >> AGENTS.mdThe first installs the skill and the zamn command, which its hook runs; the second adds the rules to AGENTS.md.
The workflow
- Write readable zamn, laid out the way a person would: children in indented
{ }blocks, one child per line, attributes on the tag's line. - Check it.
zamn --validate page.zamn Component.vuereports every problem with a code and a hint, which an agent can act on, and prints nothing when all is well. Only errors fail the check; warnings, such as a line indented as if it were a child when it isn't, are worth fixing too. It reads the<template lang="zamn">of a.vuefile in place;vue-tscandeslintalso check the expressions in it. In Claude Code, a hook runs the check after every write and edit, and a check that passes costs no tokens.
zamn
ul.nav {
li: a(href="/") Home
li {
a(href="/docs" :class="{ active: onDocs }") Docs
span.badge= count
}
}Give your agent the rules
Models know HTML well and zamn not at all, so they need the rules in context. They fit in about a page:
- Agent rules: a block to paste into
AGENTS.md,CLAUDE.mdor a system prompt. - Claude Code skill: the same rules, loaded only when a task touches zamn, and a hook that checks every file Claude writes.
llms.txtandllms-full.txt: the whole of this documentation for models, generated on every build. Every page also has a Markdown version, linked from the buttons under its title.
