Strapi Agent Rules

A headless CMS with a Node.js server, an admin interface, and a plugin ecosystem.

On this page

Overview

Strapi's root guide maps its Yarn and Nx monorepo and sets boundaries for content access, dependency injection, shared types, and edition-specific code. Test areas use separate commands, while committed skills live in one directory and link into each tool.

Documents

├── 
├──  · imports AGENTS.md
├── .ai
│   └── skills
│       └──  — Canonical committed repository skills
├── .github
│   └── 
├── docs
│   └── docs
│       └── docs
│           └── 01-core
│               └── database
│                   └── 01-relations
│                       └── 
└── 

Patterns in this file

01 / Hard prohibitions

Name the exception to a sandbox-only rule

Example apps normally reproduce fixes rather than receive production changes. The guide names examples/complex as the exception because CI uses it as a migration fixture.

Source excerpt starting at line 259.
- **`examples/`** apps are sandboxes only — use them to reproduce and test fixes, never commit changes to them unless specifically asked to do so. **Exception:** `examples/complex` is the **migration test fixture** (schemas, seeds, `validate-migration.js`, DB tooling); CI runs `migration_v5` against it via `tests/migration/`. It may relocate under `tests/migration/` in the future.

02 / Pointing at the source of truth

Keep skill sources independent of tool-specific paths

Committed skills live in .ai/skills. A sync command creates or prunes local links for Agents, Claude, and Cursor, with Windows junctions supported and a read-only status command for diagnosing missing or conflicting links.

Source excerpt starting at line 37.
**`.ai/skills/`** is the canonical source for committed repo skills. Each subdirectory containing a `SKILL.md` is a skill.

03 / Hard prohibitions

Route content operations through the owning abstraction

Document Service owns high-level content access; raw queries belong only in the database package. Content-type schemas generate tables, so ordinary changes do not need raw migrations.

Source excerpt starting at line 57.
- **Document Service** — The primary high-level API for content (`strapi.documents`). Replaced the legacy Entity Service. Always use this for reading/writing content — never raw DB queries unless you're working inside `@strapi/database` itself.

04 / Verification by change type

Separate edition toggles across testing layers

Frontend and end-to-end tests use different environment variables to enable Enterprise behavior. The guide lists both alongside Community Edition frontend commands, making the distinction explicit for verification.

Source excerpt starting at line 182.
- `IS_EE=true` — enables Enterprise features in frontend tests (`yarn test:front`)- `RUN_EE=true` — enables Enterprise features in E2E tests

05 / Verification by change type

Identify stale generated test apps as misleading evidence

API integration test applications are generated automatically. The instructions require regeneration before reuse and explain that stale apps can produce failures unrelated to the current change.

Source excerpt starting at line 150.
Integration tests live in `tests/api/`. Test apps are generated automatically — always regenerate with `yarn test:generate-app` rather than reusing a stale one (stale apps cause misleading failures).

06 / Behavioral framing

Distinguish an absent optional tool from a broken one

A missing optional brain-start skill is a normal no-op for external contributors. If the installed tool fails to refresh, report and fix the failure.

Source excerpt starting at line 86.
  remediation. Only the absence of the optional skill is a clean no-op.

Ideas for your repo

  1. Name real exceptions to sandbox-only editing rules.
  2. Keep committed skills in one canonical location.
  3. Route data operations through the abstraction that owns them.
  4. Document distinct test toggles for product editions.
  5. Regenerate fixtures before interpreting integration failures.
  6. Distinguish absent optional integrations from failed installed ones.
Sponsored byModem

Give your agents the whole story.

These instructions explain how to work in Strapi. Modem shows your agents what customers said, who is affected, and what changed.

See how Modem works