npx ultracite fix to format and fix auto-fixable linting issues. This dual approach ensures both intelligent code generation (through AI rules) and automated code quality (through hooks).
Note: Hooks are separate from AI coding rules. The--agentsflag configures AI coding rules, while the--hooksflag sets up automatic formatting after file edits.
Setup
Some tools like Cursor, Windsurf, and Claude Code support hooks that run after AI agents edit files. Ultracite can configure these hooks automatically.Automatic Setup
When you runnpx ultracite init, you’ll be prompted to select which editor hooks you want to enable:
- Cursor:
.cursor/hooks.json - Windsurf:
.windsurf/hooks.json - Claude Code:
.claude/settings.json
Manual Setup
If you want to manually set things up or add hooks after initialization, run:How It Works
- Automatic Execution: After the AI agent edits a file, the hook automatically runs
npx ultracite fix - Code Formatting: Ultracite formats the edited code according to your linter configuration
- Linting Fixes: Auto-fixable linting issues are resolved automatically
- Seamless Integration: The process happens transparently without interrupting your workflow
Benefits
Using Ultracite editor hooks provides several advantages:- Consistency: All AI-generated code is automatically formatted to match your style
- Quality: Linting issues are fixed immediately after code generation
- Efficiency: No need to manually run formatters or linters after AI edits
- Standards: Ensures AI-generated code always adheres to project standards
- Clean Commits: Code is properly formatted before you even review it
Customization
Ultracite intelligently merges with existing hook configurations:- Preserves existing hooks: All existing hooks and their commands remain intact
- Avoids duplicates: If Ultracite is already configured, it won’t be added again
- Non-destructive: Your existing hook configuration structure is maintained