Create prescriptive, action-oriented AGENTS.md files that tell agents what to DO, what to ASK ABOUT, what NEVER to do, and how to VALIDATE their work. Never write descriptive documentation — write instructions.
Authoritative source for the boundary convention: root AGENTS.md → ## Boundary Labels for Agent Rules. This skill follows that convention.
Core Philosophy
AGENTS.md files are not documentation. They are instruction sets for coding agents. Every sentence should either:
- Tell the agent what to do ("Use X when...")
- Constrain the agent's behavior ("MUST NOT...")
- Give a step-by-step procedure ("1. Create... 2. Add... 3. Run...")
Boundary Section Convention
Every AGENTS.md MUST use these four top-level boundary sections, in this order, with these exact headings:
| Section |
What goes in it |
## Always |
Required defaults, MUST/MUST NOT rules, and commands agents apply without asking. The bulk of constraint content lives here. |
## Ask First |
Decisions that need maintainer input before changing behavior, scope, dependencies, branch/deploy flow, or contract surfaces. |
## Never |
Prohibited actions and unsafe shortcuts. Phrased as "Never …" bullets (the section name does the rule-tagging). |
## Validation Commands |
Short, real commands an agent can run to prove the relevant code path (lint/build/typecheck/test/grep). |
These four headings are required. Additional sections (decision tables, checklists, structure tree, cross-references, etc.) live alongside them, never instead of them.
File Structure Template
Every AGENTS.md follows this structure. Adapt sections based on file size (small: 40-80 lines, medium: 80-150 lines, large: 150+ lines).
The template below is wrapped in a 4-backtick fence so the nested 3-backtick Validation Commands example renders correctly on GitHub.
# {Name} — Agent Guidelines
{One-line imperative directive: "Use X for Y." or "Use the Z module for A, B, and C."}
## {Optional decision/selection table — e.g. "Strategy Selection", "When to Use"}
{Table with "When to use" / "Configuration" columns}
## Always
1. **MUST ...** — {consequence or rationale}
2. **MUST NOT ...** — {what to do instead}
3. **MUST ...** — {consequence or rationale}
## Ask First
- Ask before {decision that needs maintainer input — scope, contract surface, dependency, infra}.
- Ask before {second decision class — typically destructive or cross-module}.
## Never
- Never {prohibited action — bypassing tenant scoping, skipping hooks, raw fetch, etc.}.
- Never {second prohibition}.
## Validation Commands
```bash
yarn workspace @open-mercato/{package} test
yarn workspace @open-mercato/{package} build
```
## {Primary Task Section — "When You Need X" or "Adding a New Y"}
{Numbered checklist or decision table}
## {Secondary Sections}
{Tables with "When to use" / "When to modify" columns}
## Structure
{Directory tree — keep brief}
## {Cross-References} (if applicable)
- **For X**: `path/to/AGENTS.md` → Section
Prescriptive Tone Rules
NEVER start a section with
- "The module provides..."
- "This package is..."
- "This document describes..."
- "X is a Y that..."
ALWAYS start sections with
- Imperative verbs: "Use", "Add", "Create", "Configure", "Declare", "Follow", "Resolve"
- Conditional directives: "When you need X, do Y"
- Constraints: "MUST", "MUST NOT"
Transform Patterns
| Descriptive (BAD) |
Prescriptive (GOOD) |
| "The cache module provides multi-strategy caching" |
"Use @open-mercato/cache for all caching needs. MUST NOT use raw Redis directly." |
| "Products are core entities with media" |
"Products — core entities. MUST have at least a name" |
| "Events support local and async dispatch" |
"When QUEUE_STRATEGY=async, persistent events dispatch through BullMQ" |
| "The pricing system uses layered overrides" |
"Price layers compose in order: base → channel → customer → promotional" |
| Description column in tables |
"When to use" or "When to modify" column |
Boundary Section Requirements
The Always, Ask First, Never, and Validation Commands headings are mandatory in every AGENTS.md. The Always section is where MUST/MUST NOT rules live, and its minimum item count scales with file size:
| File size |
Minimum Always items (MUST/MUST NOT rules) |
Ask First items |
Never items |
Validation Commands |
| Small (< 80 lines) |
3 |
1+ |
2+ |
1+ command |
| Medium (80–150 lines) |
5 |
2+ |
3+ |
2+ commands |
| Large (150+ lines) |
8+ |
2+ |
4+ |
2+ commands |
If a real prohibition only fits one of the boundaries, prefer the most restrictive: Never > Ask First > Always.
Writing Effective Always Rules
Each Always rule follows this pattern: **MUST [verb]** — [rationale or consequence]
Good examples:
**MUST resolve via DI** — always use container.resolve('cacheService'), never instantiate directly
**MUST NOT reimplement pricing logic** — use selectBestPrice and the resolver pipeline
**MUST export metadata** with { queue, id?, concurrency? } from every worker file
**MUST follow document flow**: Quote → Order → Invoice — no skipping steps
Bad examples:
**MUST** follow best practices (too vague)
**MUST** be careful with... (not actionable)
**MUST** use the correct approach (says nothing)
Writing Effective Ask First Items
Phrase as Ask before {scope-changing action}. Each item names a concrete decision that a maintainer (human) should approve.
Good examples:
Ask before adding a new cache backend, changing default strategy selection, or caching data whose sensitivity is unclear.
Ask before changing queue strategy defaults, retry semantics, or worker concurrency limits.
Ask before applying database migrations locally with yarn db:migrate.
Bad examples:
Ask if unsure (uselessly generic — every rule could say that)
Ask before doing anything dangerous (not actionable)
Writing Effective Never Items
Phrase as Never {prohibited action}. Do NOT prefix with "MUST NOT" — the section heading already supplies that force.
Good examples:
Never expose cross-tenant data or skip tenant/organization scoping.
Never use raw fetch in backend pages — always go through apiCall.
Never edit generated files by hand.
Bad examples:
Avoid X (too soft for Never)
Try not to Y (not a rule)
Writing Effective Validation Commands
List the smallest set of real commands an agent can copy-paste to prove the relevant path. Prefer package-scoped commands over repo-wide ones for module/package AGENTS.md files.
Good examples:
yarn workspace @open-mercato/cache test
yarn workspace @open-mercato/cache build
yarn generate
yarn typecheck
yarn workspace @open-mercato/core test --testPathPattern=customers
Bad examples:
Run the tests (not a command)
yarn test:everything --all-the-things (invented or impractical)
Table Column Conventions
NEVER use these column headers
- "Description"
- "Purpose" (as standalone — use "Purpose / MUST rules" instead)
- "Details"
ALWAYS use these column headers
| Context |
Column headers to use |
| Feature/strategy tables |
"When to use", "Configuration" |
| Directory listings |
"When to modify" |
| Entity/data model |
Constraint-framed bullets: "Entity — description. MUST [constraint]" |
| File reference tables |
"When you need", "Copy from" |
| API/endpoint tables |
"When to use", "MUST rules" |
| Environment variables |
"When to configure" |
| DI tokens / imports |
"When to use", "Import path" |
Checklist Sections
Include numbered checklists for common tasks. Pattern: "Adding a New X" or "Checklist: Do Y"
## Adding a New Worker
1. Create worker file in `src/modules/<module>/workers/<worker-name>.ts`
2. Export `metadata` with `{ queue: '<queue-name>', id: '<worker-id>', concurrency: <n> }`
3. Export default async handler function
4. Ensure handler is idempotent — check state before mutating
5. Run `yarn generate` to register the worker
6. Test with `QUEUE_STRATEGY=local` in development
Every checklist MUST:
- Use numbered steps (not bullets)
- Start each step with an imperative verb
- Include the
yarn generate step when adding module files
- End with a testing/verification step
Data Model Sections
Convert entity lists to constraint-framed bullets:
## Data Model Constraints
- **Products** — core entities with media. MUST have at least a name
- **Categories** — hierarchical. MUST maintain parent-child integrity (no circular references)
- **Variants** — linked via `product_id`. MUST reference valid option schemas
- **Prices** — multi-tier with channel scoping. MUST use `selectBestPrice` for resolution
Pattern: **Entity** — brief description. MUST [constraint]
Cross-Reference Rules
When two AGENTS.md files cover related topics:
- Pick one authoritative source for each topic — never duplicate full content
- Use condensed quick-references in the non-authoritative file
- Add a Cross-Reference section at the bottom linking to related guides
- Keep the Task Router in root AGENTS.md accurate with descriptive task names
Example:
## Cross-Reference
- **Declaring events in a module**: `packages/core/AGENTS.md` → Events
- **Queue worker contract**: `packages/queue/AGENTS.md`
File Size Guidelines
| Type |
Target lines |
Examples |
| Small package |
40–80 |
cache, content, queue, events |
| Medium module |
60–100 |
catalog, sales, customers, onboarding |
| Large package |
80–150 |
shared, create-app, specs |
| Very large (tone rewrite) |
Keep original length |
ai-assistant (1100), search (700) |
Sizing Rules
- Keep small files focused — do not pad with unnecessary sections
- Large files: keep ALL technical content, only reframe tone
- Root AGENTS.md: MUST stay under 230 lines
Code Examples in AGENTS.md
- Include code examples only for contracts (worker metadata, event declaration, subscriber export)
- Keep examples minimal — 3-5 lines max for inline snippets
- For full API examples, cross-reference the relevant module or spec
- MUST NOT include implementation details — only show the interface/pattern
Verification Checklist
After writing an AGENTS.md, verify:
- Boundary headings present: File contains exactly one of each
## Always, ## Ask First, ## Never, and ## Validation Commands, in that order. Confirm with grep -nE '^## (Always|Ask First|Never|Validation Commands)$' <file>.
Always audit: File has required number of MUST/MUST NOT rules in ## Always (3+ small, 5+ medium, 8+ large).
Ask First populated: At least one concrete "Ask before …" item that names a scope-changing decision.
Never populated: At least one "Never …" prohibition; phrased as a "Never" bullet, not "MUST NOT".
Validation Commands runnable: Commands are real and copy-pasteable; no placeholder or invented scripts.
- Tone: Every section starts with imperative verb or "When you need..."
- No descriptive openers: No section starts with "The module provides..." or similar.
- Tables: All tables use "When to use" / "When to modify" columns, never "Description".
- Checklists: Common tasks have numbered step-by-step procedures.
- Data models: Entity lists are constraint-framed with MUST rules.
- Cross-references: No duplicated content between files; clear pointers instead.
- Structure section: Directory tree is present and brief.
- Opening line: File starts with one-line imperative directive, not a description.
Anti-Patterns
- Explaining how things work instead of telling agents what to do
- Listing features instead of listing constraints
- Duplicating content across multiple AGENTS.md files
- Writing paragraphs where a checklist would be clearer
- Adding changelog sections to small/medium files (only for large files with complex history)
- Over-documenting internals — AGENTS.md guides usage, not implementation
- Missing the "when" framing — every table/section should answer "when do I use this?"
- Skipping a boundary section because "the file is small" — every AGENTS.md MUST carry all four (
Always, Ask First, Never, Validation Commands). Tighten the content per file size; do not omit headings.
- Reusing legacy headings like
## MUST Rules, ## Critical Rules, ## Key Rules, or MUST Rules/MANDATORY: as H2s. These predate the boundary convention and are not accepted.
- Mixing forces — putting
MUST NOT rules under Never, or Never … bullets under Always. Each section's heading carries the force; phrase items to match.
Reference Examples
Study these files as reference implementations — all updated to the boundary convention in PR #2082:
| Size |
File |
Why it's good |
| Small |
packages/cache/AGENTS.md |
All four boundary sections present, MUST rules under Always, concrete Validation Commands, decision table |
| Small |
packages/queue/AGENTS.md |
Idempotency MUST rule under Always, concurrency guidelines table, worker contract |
| Medium |
packages/core/src/modules/sales/AGENTS.md |
Data model constraints, document-flow MUST rules under Always, scope-tightening Ask First items |
| Medium |
packages/core/src/modules/customers/AGENTS.md |
"Copy from here" directive, reference files table, module checklist |
| Large |
packages/search/AGENTS.md |
Strategy decision guide, dual checklists, DI token reference, populated Validation Commands |
| Large |
packages/ai-assistant/AGENTS.md |
Common tasks up front, auth MUST rules under Always, dedicated Ask First for AskUserQuestion confirmation boundary |
When Updating Root AGENTS.md Task Router
After creating a new AGENTS.md, update the Task Router table in root AGENTS.md:
- Add a row with descriptive task keywords (not just the package name)
- Include specific function names, patterns, and task verbs an agent would search for
- Keep the root file under 230 lines
Migrating an Existing AGENTS.md to the Boundary Convention
When refactoring an older AGENTS.md that predates PR #2082:
- Identify legacy headings — typically
## MUST Rules, ## Critical Rules, ## Key Rules, or mixed ## Always / Never blocks.
- Hoist each existing rule into the correct boundary:
- MUST/MUST NOT defaults →
## Always, preserving the **MUST [verb]** — [rationale] pattern.
- Scope/contract decisions that need maintainer approval →
## Ask First, phrased as Ask before ….
- Hard prohibitions and unsafe shortcuts →
## Never, phrased as Never ….
- Add a
## Validation Commands block with the smallest set of real, package-scoped commands that prove the affected path.
- Preserve any high-risk operational details (hard tool-call limits,
AskUserQuestion confirmation boundaries, encryption defaults, etc.) — content reclassification is fine, content loss is not.
- Verify with
grep -nE '^## (Always|Ask First|Never|Validation Commands)$' <file> that all four headings exist.
- Update any other docs that referenced the legacy section anchors (
#must-rules, #critical-rules, etc.).
1---2name: om-create-agents-md3description: Create or rewrite AGENTS.md files for Open Mercato packages and modules. Use this skill when adding a new package, creating a new module, or when an existing AGENTS.md needs to be created or refactored. Ensures prescriptive tone, the Always/Ask First/Never/Validation Commands boundary structure, MUST-style rules, checklists, and consistent structure across all agent guidelines.4---56Create prescriptive, action-oriented AGENTS.md files that tell agents **what to DO**, **what to ASK ABOUT**, **what NEVER to do**, and **how to VALIDATE** their work. Never write descriptive documentation — write instructions.78> Authoritative source for the boundary convention: root `AGENTS.md` → `## Boundary Labels for Agent Rules`. This skill follows that convention.910## Core Philosophy1112AGENTS.md files are **not documentation**. They are **instruction sets for coding agents**. Every sentence should either:13- Tell the agent what to do ("Use X when...")14- Constrain the agent's behavior ("MUST NOT...")15- Give a step-by-step procedure ("1. Create... 2. Add... 3. Run...")1617## Boundary Section Convention1819Every AGENTS.md MUST use these four top-level boundary sections, in this order, with these exact headings:2021| Section | What goes in it |22|---------|-----------------|23| `## Always` | Required defaults, MUST/MUST NOT rules, and commands agents apply without asking. The bulk of constraint content lives here. |24| `## Ask First` | Decisions that need maintainer input before changing behavior, scope, dependencies, branch/deploy flow, or contract surfaces. |25| `## Never` | Prohibited actions and unsafe shortcuts. Phrased as "Never …" bullets (the section name does the rule-tagging). |26| `## Validation Commands` | Short, real commands an agent can run to prove the relevant code path (lint/build/typecheck/test/grep). |2728These four headings are required. Additional sections (decision tables, checklists, structure tree, cross-references, etc.) live **alongside** them, never instead of them.2930## File Structure Template3132Every AGENTS.md follows this structure. Adapt sections based on file size (small: 40-80 lines, medium: 80-150 lines, large: 150+ lines).3334The template below is wrapped in a 4-backtick fence so the nested 3-backtick `Validation Commands` example renders correctly on GitHub.3536````markdown37# {Name} — Agent Guidelines3839{One-line imperative directive: "Use X for Y." or "Use the Z module for A, B, and C."}4041## {Optional decision/selection table — e.g. "Strategy Selection", "When to Use"}4243{Table with "When to use" / "Configuration" columns}4445## Always46471. **MUST ...** — {consequence or rationale}482. **MUST NOT ...** — {what to do instead}493. **MUST ...** — {consequence or rationale}5051## Ask First5253- Ask before {decision that needs maintainer input — scope, contract surface, dependency, infra}.54- Ask before {second decision class — typically destructive or cross-module}.5556## Never5758- Never {prohibited action — bypassing tenant scoping, skipping hooks, raw fetch, etc.}.59- Never {second prohibition}.6061## Validation Commands6263```bash64yarn workspace @open-mercato/{package} test65yarn workspace @open-mercato/{package} build66```6768## {Primary Task Section — "When You Need X" or "Adding a New Y"}6970{Numbered checklist or decision table}7172## {Secondary Sections}7374{Tables with "When to use" / "When to modify" columns}7576## Structure7778{Directory tree — keep brief}7980## {Cross-References} (if applicable)8182- **For X**: `path/to/AGENTS.md` → Section83````8485## Prescriptive Tone Rules8687### NEVER start a section with8889- "The module provides..."90- "This package is..."91- "This document describes..."92- "X is a Y that..."9394### ALWAYS start sections with9596- Imperative verbs: "Use", "Add", "Create", "Configure", "Declare", "Follow", "Resolve"97- Conditional directives: "When you need X, do Y"98- Constraints: "MUST", "MUST NOT"99100### Transform Patterns101102| Descriptive (BAD) | Prescriptive (GOOD) |103|---|---|104| "The cache module provides multi-strategy caching" | "Use `@open-mercato/cache` for all caching needs. MUST NOT use raw Redis directly." |105| "Products are core entities with media" | "**Products** — core entities. MUST have at least a name" |106| "Events support local and async dispatch" | "When `QUEUE_STRATEGY=async`, persistent events dispatch through BullMQ" |107| "The pricing system uses layered overrides" | "Price layers compose in order: base → channel → customer → promotional" |108| Description column in tables | "When to use" or "When to modify" column |109110## Boundary Section Requirements111112The `Always`, `Ask First`, `Never`, and `Validation Commands` headings are mandatory in every AGENTS.md. The `Always` section is where MUST/MUST NOT rules live, and its minimum item count scales with file size:113114| File size | Minimum `Always` items (MUST/MUST NOT rules) | `Ask First` items | `Never` items | `Validation Commands` |115|-----------|---------------------------------------------|-------------------|---------------|------------------------|116| Small (< 80 lines) | 3 | 1+ | 2+ | 1+ command |117| Medium (80–150 lines) | 5 | 2+ | 3+ | 2+ commands |118| Large (150+ lines) | 8+ | 2+ | 4+ | 2+ commands |119120If a real prohibition only fits one of the boundaries, prefer the most restrictive: `Never` > `Ask First` > `Always`.121122### Writing Effective `Always` Rules123124Each `Always` rule follows this pattern: `**MUST [verb]** — [rationale or consequence]`125126Good examples:127- `**MUST resolve via DI** — always use container.resolve('cacheService'), never instantiate directly`128- `**MUST NOT reimplement pricing logic** — use selectBestPrice and the resolver pipeline`129- `**MUST export metadata** with { queue, id?, concurrency? } from every worker file`130- `**MUST follow document flow**: Quote → Order → Invoice — no skipping steps`131132Bad examples:133- `**MUST** follow best practices` (too vague)134- `**MUST** be careful with...` (not actionable)135- `**MUST** use the correct approach` (says nothing)136137### Writing Effective `Ask First` Items138139Phrase as `Ask before {scope-changing action}.` Each item names a concrete decision that a maintainer (human) should approve.140141Good examples:142- `Ask before adding a new cache backend, changing default strategy selection, or caching data whose sensitivity is unclear.`143- `Ask before changing queue strategy defaults, retry semantics, or worker concurrency limits.`144- `Ask before applying database migrations locally with yarn db:migrate.`145146Bad examples:147- `Ask if unsure` (uselessly generic — every rule could say that)148- `Ask before doing anything dangerous` (not actionable)149150### Writing Effective `Never` Items151152Phrase as `Never {prohibited action}.` Do NOT prefix with "MUST NOT" — the section heading already supplies that force.153154Good examples:155- `Never expose cross-tenant data or skip tenant/organization scoping.`156- `Never use raw fetch in backend pages — always go through apiCall.`157- `Never edit generated files by hand.`158159Bad examples:160- `Avoid X` (too soft for `Never`)161- `Try not to Y` (not a rule)162163### Writing Effective `Validation Commands`164165List the smallest set of real commands an agent can copy-paste to prove the relevant path. Prefer package-scoped commands over repo-wide ones for module/package AGENTS.md files.166167Good examples:168169```bash170yarn workspace @open-mercato/cache test171yarn workspace @open-mercato/cache build172```173174```bash175yarn generate176yarn typecheck177yarn workspace @open-mercato/core test --testPathPattern=customers178```179180Bad examples:181- `Run the tests` (not a command)182- `yarn test:everything --all-the-things` (invented or impractical)183184## Table Column Conventions185186### NEVER use these column headers187- "Description"188- "Purpose" (as standalone — use "Purpose / MUST rules" instead)189- "Details"190191### ALWAYS use these column headers192193| Context | Column headers to use |194|---------|----------------------|195| Feature/strategy tables | "When to use", "Configuration" |196| Directory listings | "When to modify" |197| Entity/data model | Constraint-framed bullets: "Entity — description. MUST [constraint]" |198| File reference tables | "When you need", "Copy from" |199| API/endpoint tables | "When to use", "MUST rules" |200| Environment variables | "When to configure" |201| DI tokens / imports | "When to use", "Import path" |202203## Checklist Sections204205Include numbered checklists for common tasks. Pattern: "Adding a New X" or "Checklist: Do Y"206207```markdown208## Adding a New Worker2092101. Create worker file in `src/modules/<module>/workers/<worker-name>.ts`2112. Export `metadata` with `{ queue: '<queue-name>', id: '<worker-id>', concurrency: <n> }`2123. Export default async handler function2134. Ensure handler is idempotent — check state before mutating2145. Run `yarn generate` to register the worker2156. Test with `QUEUE_STRATEGY=local` in development216```217218Every checklist MUST:219- Use numbered steps (not bullets)220- Start each step with an imperative verb221- Include the `yarn generate` step when adding module files222- End with a testing/verification step223224## Data Model Sections225226Convert entity lists to constraint-framed bullets:227228```markdown229## Data Model Constraints230231- **Products** — core entities with media. MUST have at least a name232- **Categories** — hierarchical. MUST maintain parent-child integrity (no circular references)233- **Variants** — linked via `product_id`. MUST reference valid option schemas234- **Prices** — multi-tier with channel scoping. MUST use `selectBestPrice` for resolution235```236237Pattern: `**Entity** — brief description. MUST [constraint]`238239## Cross-Reference Rules240241When two AGENTS.md files cover related topics:2422431. **Pick one authoritative source** for each topic — never duplicate full content2442. **Use condensed quick-references** in the non-authoritative file2453. **Add a Cross-Reference section** at the bottom linking to related guides2464. **Keep the Task Router in root AGENTS.md** accurate with descriptive task names247248Example:249```markdown250## Cross-Reference251252- **Declaring events in a module**: `packages/core/AGENTS.md` → Events253- **Queue worker contract**: `packages/queue/AGENTS.md`254```255256## File Size Guidelines257258| Type | Target lines | Examples |259|------|-------------|---------|260| Small package | 40–80 | cache, content, queue, events |261| Medium module | 60–100 | catalog, sales, customers, onboarding |262| Large package | 80–150 | shared, create-app, specs |263| Very large (tone rewrite) | Keep original length | ai-assistant (~1100), search (~700) |264265## Sizing Rules266267- Keep small files focused — do not pad with unnecessary sections268- Large files: keep ALL technical content, only reframe tone269- Root AGENTS.md: MUST stay under 230 lines270271## Code Examples in AGENTS.md272273- Include code examples only for **contracts** (worker metadata, event declaration, subscriber export)274- Keep examples minimal — 3-5 lines max for inline snippets275- For full API examples, cross-reference the relevant module or spec276- MUST NOT include implementation details — only show the interface/pattern277278## Verification Checklist279280After writing an AGENTS.md, verify:2812821. **Boundary headings present**: File contains exactly one of each `## Always`, `## Ask First`, `## Never`, and `## Validation Commands`, in that order. Confirm with `grep -nE '^## (Always|Ask First|Never|Validation Commands)$' <file>`.2832. **`Always` audit**: File has required number of MUST/MUST NOT rules in `## Always` (3+ small, 5+ medium, 8+ large).2843. **`Ask First` populated**: At least one concrete "Ask before …" item that names a scope-changing decision.2854. **`Never` populated**: At least one "Never …" prohibition; phrased as a "Never" bullet, not "MUST NOT".2865. **`Validation Commands` runnable**: Commands are real and copy-pasteable; no placeholder or invented scripts.2876. **Tone**: Every section starts with imperative verb or "When you need..."2887. **No descriptive openers**: No section starts with "The module provides..." or similar.2898. **Tables**: All tables use "When to use" / "When to modify" columns, never "Description".2909. **Checklists**: Common tasks have numbered step-by-step procedures.29110. **Data models**: Entity lists are constraint-framed with MUST rules.29211. **Cross-references**: No duplicated content between files; clear pointers instead.29312. **Structure section**: Directory tree is present and brief.29413. **Opening line**: File starts with one-line imperative directive, not a description.295296## Anti-Patterns2972981. **Explaining how things work** instead of telling agents what to do2992. **Listing features** instead of listing constraints3003. **Duplicating content** across multiple AGENTS.md files3014. **Writing paragraphs** where a checklist would be clearer3025. **Adding changelog sections** to small/medium files (only for large files with complex history)3036. **Over-documenting internals** — AGENTS.md guides usage, not implementation3047. **Missing the "when" framing** — every table/section should answer "when do I use this?"3058. **Skipping a boundary section** because "the file is small" — every AGENTS.md MUST carry all four (`Always`, `Ask First`, `Never`, `Validation Commands`). Tighten the content per file size; do not omit headings.3069. **Reusing legacy headings** like `## MUST Rules`, `## Critical Rules`, `## Key Rules`, or `MUST Rules`/`MANDATORY:` as H2s. These predate the boundary convention and are not accepted.30710. **Mixing forces** — putting `MUST NOT` rules under `Never`, or `Never …` bullets under `Always`. Each section's heading carries the force; phrase items to match.308309## Reference Examples310311Study these files as reference implementations — all updated to the boundary convention in PR #2082:312313| Size | File | Why it's good |314|------|------|---------------|315| Small | `packages/cache/AGENTS.md` | All four boundary sections present, MUST rules under `Always`, concrete `Validation Commands`, decision table |316| Small | `packages/queue/AGENTS.md` | Idempotency MUST rule under `Always`, concurrency guidelines table, worker contract |317| Medium | `packages/core/src/modules/sales/AGENTS.md` | Data model constraints, document-flow MUST rules under `Always`, scope-tightening `Ask First` items |318| Medium | `packages/core/src/modules/customers/AGENTS.md` | "Copy from here" directive, reference files table, module checklist |319| Large | `packages/search/AGENTS.md` | Strategy decision guide, dual checklists, DI token reference, populated `Validation Commands` |320| Large | `packages/ai-assistant/AGENTS.md` | Common tasks up front, auth MUST rules under `Always`, dedicated `Ask First` for `AskUserQuestion` confirmation boundary |321322## When Updating Root AGENTS.md Task Router323324After creating a new AGENTS.md, update the Task Router table in root `AGENTS.md`:3251. Add a row with descriptive task keywords (not just the package name)3262. Include specific function names, patterns, and task verbs an agent would search for3273. Keep the root file under 230 lines328329## Migrating an Existing AGENTS.md to the Boundary Convention330331When refactoring an older AGENTS.md that predates PR #2082:3323331. Identify legacy headings — typically `## MUST Rules`, `## Critical Rules`, `## Key Rules`, or mixed `## Always / Never` blocks.3342. Hoist each existing rule into the correct boundary:335 - **MUST/MUST NOT defaults** → `## Always`, preserving the `**MUST [verb]** — [rationale]` pattern.336 - **Scope/contract decisions that need maintainer approval** → `## Ask First`, phrased as `Ask before …`.337 - **Hard prohibitions and unsafe shortcuts** → `## Never`, phrased as `Never …`.3383. Add a `## Validation Commands` block with the smallest set of real, package-scoped commands that prove the affected path.3394. Preserve any high-risk operational details (hard tool-call limits, `AskUserQuestion` confirmation boundaries, encryption defaults, etc.) — content reclassification is fine, content loss is not.3405. Verify with `grep -nE '^## (Always|Ask First|Never|Validation Commands)$' <file>` that all four headings exist.3416. Update any other docs that referenced the legacy section anchors (`#must-rules`, `#critical-rules`, etc.).