Skip to content

Wire Varar into your AI agent's instructions

This guide shows you how to make an AI coding agent — Claude Code, Cursor, Copilot, anything that reads project-level instructions — default to writing a Varar oath before it writes code. One-time setup per repo.

  • A repo with Varar installed.
  • An agent that reads a persistent instruction file. Common names: AGENTS.md, CLAUDE.md, .cursorrules, .github/copilot-instructions.md.

Look for an existing AGENTS.md or CLAUDE.md at the repo root. If neither exists, create the one your agent expects; when unsure, start with AGENTS.md.

Paste this block in. Edit the wording to match your house style; the substance is what matters.

## How we work
We use Varar for behaviour-driven development. When you implement a feature
or fix a bug, you must:
1. Write or update a `*.md` oath before touching production code. The oath
describes the behaviour in plain English with concrete examples.
2. Write or update the matching `*.steps.ts` step definitions.
3. Run the Varar suite and read the failures.
4. Implement the production code in small steps, running the suite after
each step.
5. When the suite is green and you believe the feature is complete, stop
and summarise what you changed. Do not refactor unrelated code.
The oath is the contract. If you cannot satisfy the oath, surface the
disagreement instead of changing the oath to match your implementation.

Underneath, add the exact command your agent should run, so it doesn’t guess:

## Running tests
```bash
pnpm test
```

Start a fresh agent session and ask for a small feature without mentioning tests. A correctly configured agent should announce it will write the oath first, produce a *.md file with concrete examples before any production code, then run the suite and iterate. If it skips straight to production code, the instruction file isn’t being read — check the file name your agent expects.

  • Don’t paste a Varar syntax reference into the instruction file. The agent can read the repo’s own oaths and READMEs. Instructions are for how to work, not what Varar is.
  • Don’t write “add tests where appropriate”. Vague guidance gets ignored. Oath first, every time.
  • Don’t let the agent edit an oath to make a failing test pass. The “oath is the contract” line above is load-bearing.

With the instructions in place, see Drive a feature with Varar and an agent for the per-feature working loop.