Last updated May 16, 20264 min read

Rules: Set the Agent's Constitution

Outcome

One instruction file the agent reads before every task, plus the Skills it reuses across projects. The guides below write and test each part; the checklist on this page is what the finished file has to cover.

Branded ice cubes with a blue flame holding a checklist beside a code window, under the title Rules First. Then Code.

Share this guide

Share this guide on LinkedIn

Summarize with AI

ChatGPTPerplexityClaude
Table of Contents

What this stage settles

An AI coding agent does not need a bigger prompt. It needs boundaries that survive between sessions: which files it reads first, which source wins when two disagree, which work is packaged so it never has to be explained again, and when it must stop and ask.

Spec Kit calls this layer the constitution, and the AGENTS.md format is where most agents look for it. The name matters less than the property: it is written once, it is read before the task, and it is testable.

Get this wrong and the agent invents. Get it right and the review changes from "did it remember the basics?" to "did it follow the rules?" - which is a question you can answer in a minute.

Steps

Guide

  1. Install the workbench

    An editor, a runtime, version control and the agent itself, in a real project folder. Chat history is not a project.

    Codex Technical Setup

  2. Decide which file wins

    Name one owner for each kind of decision - routes, brand, scope, rationale - a precedence rule for when two sources disagree, and the order the agent reads them in. Then prove it with one deliberate conflict before the agent writes code.

    The AGENTS.md Book: Source of Truth and Read Order

  3. Package what repeats

    Work that comes back on every project - header, footer, colours, metadata, consent, QA - becomes a Skill with inputs, outputs and checks, so it is never re-explained.

    Reusable Skills: The Website Superpower

  4. Write one Skill end to end

    The footer is the smallest useful example: legal links, structure, responsive behaviour and acceptance checks, with brand values left in the project files where they belong.

    Footer Skill Setup

  5. Check the file covers all seven parts

    A rules file that only says what the agent may edit is half a file. These are the seven parts the guides above write:

    • Agent definition - its role, what it may change, and what it must never invent.
    • Read order - which sources it loads, in which order, before it starts.
    • Precedence - which source wins when two disagree, and when to stop instead.
    • Reusable Skills - the repeated jobs, packaged with their own checks.
    • Build flow - the production order: inputs, reusable parts, pages, integrations, tracking, checks, notes.
    • Per-run report - sources read, files changed, checks run, issues found.
    • Recurring checks - what gets re-checked on a schedule after launch: links, metadata, tracking, sitemap, dependencies.

Be Aware

The agent starts coding before loading context.

Keep the read order in the rules file and require the agent to report which sources it used before the first edit.

The rules file grows into a manual nobody re-reads.

Keep it to the seven parts. Detail belongs in the Skills and the source-of-truth files it points at.

Rules are written and never tested.

A rule you have not tested is a preference. Run the conflict test after any change to the file's structure.

About the author

Nikita Goncharenko

Nikita Goncharenko

AI Fast Integrator

Nikita Goncharenko uses AI as a practical delivery layer for research, coding, documentation, content systems, and faster decisions.