What makes a good rule
Rules work best when they are:- Normative: uses strong constraints like “must” or “must not”, not suggestions
- Verifiable: a reviewer can objectively check whether code follows the rule
- Focused: covers one specific concern, not a broad topic
- Durable: expected to be relevant for 6–12 months or more
- “All React components must use design tokens from the theme for colors and spacing”
- “Database migrations must be backward-compatible with the previous schema version”
- “API endpoints must validate path parameters against expected formats before forwarding to services”
- General tutorials or onboarding guides
- Style preferences that change frequently
- Implementation details specific to one project
Rule format
A rule is a single Markdown file with YAML frontmatter:Frontmatter fields
Activation
Rules can optionally specify when they should activate:How rules are discovered
Rules are automatically discovered by AI Explorer’s entity providers. The providers scan configured GitHub organizations for rule files in these locations:.claude/rules/*.mdMarkdown rules with YAML frontmatterrules/*.mdMarkdown rules with YAML frontmatterrules/*.yaml/rules/*.ymlPure YAML rule files (required fields:id,title,discipline,category,type)
CODEOWNERS if not specified in the frontmatter.
Optional: catalog-info.yaml override
If a repository also contains acatalog-info.yaml with AiContext rule entities, those hand-authored entities take precedence over any file-derived entity with the same namespace/name. This is an override mechanism, most cases will not require this.