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 asked which agents you use:
? Which agents do you use (optional)?
◯ Universal (creates AGENTS.md for Codex, Jules, Devin, and more)
◯ Claude Code (creates AGENTS.md, imported from your CLAUDE.md)
◯ Replit Agent (creates AGENTS.md and replit.md)
◯ Aider (creates AGENTS.md and .aider.conf.yml)
◯ Gemini CLI (creates AGENTS.md and .gemini/settings.json)
Every choice writes the rules to AGENTS.md, the file nearly every coding agent reads. The other options are for the agents that need one more file to see it (see below).
If AGENTS.md already exists, the rules go in an Ultracite block (starting at # Ultracite Code Standards) 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.
Manual Setup
To set things up by hand, copy the rules into AGENTS.md at your project root, then follow the step below for your agent if it has one.
Supported Agents
Every agent reads the rules from AGENTS.md. Pass its ID to --agents, or universal to write AGENTS.md alone:
Codex (codex), Jules (jules), Devin (devin), Lovable (lovable), Zencoder (zencoder), Ona (ona), OpenClaw (openclaw), Snowflake CoCo (snowflake-coco), Deep Agents (deepagents), Qoder (qoder), Kimi Code CLI (kimi-code), Xum (xum), Pi (pi), AdaL (adal), GitHub Copilot (copilot), Cline (cline), Amp (amp), 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), Kiro CLI (kiro-cli), Firebender (firebender), Cursor CLI (cursor-cli), Mistral Vibe (mistral-vibe), Vercel Agent (vercel), fx (fx), Antigravity CLI (antigravity), Grok Build (grok), Claude Code (claude), Gemini CLI (gemini), Aider (aider) and Replit Agent (replit).
Agents That Need One More Step
| Agent | What init adds |
|---|---|
Claude Code (claude) |
Claude Code reads AGENTS.md only when the project has no CLAUDE.md. If yours has one, init adds an @AGENTS.md import to it. |
Gemini CLI (gemini) |
Gemini CLI reads GEMINI.md unless told otherwise, so init adds AGENTS.md to context.fileName in .gemini/settings.json, keeping GEMINI.md. |
Aider (aider) |
Aider loads no instructions file on its own, so init points .aider.conf.yml at AGENTS.md and has it lint each edit (see Aider). |
Replit Agent (replit) |
Replit Agent reads only replit.md, which it also writes itself, so init adds a copy of the rules there. |
Settings files are merged, not replaced: only the keys above change, and your own settings and comments stay.
Aider
Aider loads only the files .aider.conf.yml lists under read. So for Aider, init merges two keys into .aider.conf.yml:
read: AGENTS.md
lint-cmd: npx ultracite fix
Aider lints every file it edits, so lint-cmd makes it run ultracite fix on each one. When problems are left, Aider shows them to the model and asks it to fix them before moving on. If your config already sets lint-cmd to another linter, init leaves it alone: a lint-cmd without a language replaces Aider’s per-language linters.
Upgrading From Per-Agent Files
Earlier versions wrote the rules into each agent’s own file: .claude/CLAUDE.md, GEMINI.md, .firebender/rules/ultracite.mdc and Aider’s ultracite.md. Run init again and the rules move to AGENTS.md: init takes Ultracite’s block out of those files, removes any file left with nothing else in it, and adds the import or settings the agent needs. That happens whenever one of those files still holds the rules, whichever agents you pick, because a leftover .claude/CLAUDE.md would stop Claude Code from reading AGENTS.md.
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