Agent Rules
Generate agent rule files for Claude Code, Codex, Copilot, and other AI tools so code suggestions start closer to your repo standards.
Ultracite provides seamless integration with AI coding assistants by automatically generating agent rule files. These rules help guide AI assistants to write better, more consistent code that follows best practices.
The agent rules work alongside your linter’s formatting and linting. While your linter handles code formatting and catches errors, the agent rules guide AI assistants to write better code from the start, reducing the need for fixes later.
The generated rules intentionally focus on code quality and implementation guidance instead of hardcoding formatter-specific settings like line width, quote style, or trailing commas. That keeps the rules portable across repositories while still letting each project’s configured formatter stay in charge.
This dual approach ensures both automated code quality (through linting) and intelligent code generation (through AI coding rules).
Setup
Automatic Setup
When you run npx ultracite init, you’ll be prompted to select which agent files you want to add:
? Which agent files do you want to add (optional)?
◯ Universal (creates AGENTS.md for Codex, Jules, Devin, and more)
◯ Claude (creates .claude/CLAUDE.md)
◯ Replit (creates replit.md)
# ... and more
This will create the relevant rule file(s) in your project directory.
Files that other tools also write to, like AGENTS.md and .claude/CLAUDE.md, get an Ultracite block (starting at # Ultracite Code Standards) added below your own content. Re-running init replaces that block in place, removes any duplicate blocks earlier versions appended, and keeps the file’s line endings. The rules tell agents to run your project’s installed CLI, such as npx ultracite fix or pnpm exec ultracite fix.
Firebender’s rules go in .firebender/rules/ultracite.mdc with alwaysApply: true. Earlier versions wrote them into firebender.json by mistake; if that file still holds only those rules, init resets it to {}.
Manual Setup
If you want to manually set things up, create the rule file for your agent (see Supported Agents below) in your project directory. Then, copy and paste this content into the file.
Supported Agents
Each agent reads its rules from one file. Pass the ID to --agents to write that file:
| File | Agents (--agents ID) |
|---|---|
AGENTS.md |
Codex (codex), Jules (jules), Devin (devin), Lovable (lovable), Zencoder (zencoder), Ona (ona), OpenClaw (openclaw), Continue (continue), Snowflake Cortex (snowflake-cortex), Deepagents (deepagents), Qoder (qoder), Kimi CLI (kimi-cli), MCPJam (mcpjam), Mux (mux), Pi (pi), AdaL (adal), GitHub Copilot (copilot), Cline (cline), AMP (amp), Firebase Studio (firebase-studio), OpenHands (open-hands), Junie (junie), Augment Code (augmentcode), IBM Bob (bob), Kilo Code (kilo-code), Goose (goose), Warp (warp), Droid (droid), OpenCode (opencode), Crush (crush), Qwen Code (qwen), Cursor CLI (cursor-cli), Mistral Vibe (mistral-vibe), Vercel Agent (vercel). Use universal to write it once for all of them. |
.claude/CLAUDE.md |
Claude Code (claude) |
GEMINI.md |
Gemini (gemini) |
replit.md |
Replit Agent (replit) |
.roo/rules/ultracite.md |
Roo Code (roo-code) |
.amazonq/rules/ultracite.md |
Amazon Q CLI (amazon-q-cli) |
.firebender/rules/ultracite.mdc |
Firebender (firebender) |
ultracite.md |
Aider (aider) |
Reusable Skills
If your AI tool supports installable reusable skills, see the Agent Skills guide. The global Ultracite skill gives you the same baseline guidance across repositories while leaving formatting decisions to each repo’s configured linter and formatter.
Benefits
Using Ultracite agent rules provides several advantages:
- Consistency: All AI-generated code follows the same conventions
- Quality: Rules enforce best practices and prevent common mistakes
- Accessibility: Built-in accessibility guidelines ensure inclusive code
- Performance: Rules promote efficient patterns and avoid anti-patterns
- Security: Guidelines help prevent common security vulnerabilities
Customization
While the default rules are comprehensive, you can customize them for your specific needs:
- Modify existing rules: Edit the rule files directly, but keep your changes outside the Ultracite block in shared files like
AGENTS.md, since re-runninginitreplaces it - Add project-specific rules: Append additional guidelines
- Disable rules: Remove or comment out rules that don’t apply to your project