Skip to content

Rules

Rules encode durable guidance (style, testing, domain constraints). Declare them under rules, then run capa install. capa writes Cursor-style rule files where the provider has a rules directory, and folds content into the provider’s instructions file elsewhere.

TypeFields
inlinecontent
remoteurl
github / gitlabdef.repo (@basename or ::exact/path, with optional :tag / #sha)
FieldPurpose
idFilename stem and capa marker id
providersOptional allow-list of provider ids; omit for all active providers
appliesToGlob patterns (maps to Cursor globs)
alwaysApplyWhen true, always load the rule
descriptionFrontmatter description where supported
rules:
- id: code-style
type: inline
alwaysApply: true
description: Project code style guidelines
content: |
Use TypeScript strict mode. Prefer const over let.
- id: test-patterns
type: inline
appliesTo:
- '**/*.test.ts'
- '**/*.spec.ts'
description: Testing conventions
content: |
Use describe/it blocks. Prefer toBe over toEqual for primitives.
- id: typescript-standards
type: github
def:
repo: my-org/standards::rules/typescript.md
providers:
- cursor

Prefer :: for rules when you know the file path — installs fail loudly if the file moves. Use @basename only when the basename is unique in the repo.

Provider shapeWhat capa writes
Rules directory (e.g. Cursor → .cursor/rules/)Separate rule file with YAML frontmatter (description, globs, alwaysApply) — Cursor uses .mdc
No rules directory (e.g. many CLI agents)Rule body folded into the provider’s instructions file as a capa-managed marker block

capa clean removes capa-installed rules. Hand-authored provider rules are left alone.