Auto-fix
claudelint can automatically fix certain validation issues. Fixes use atomic file writes and can be previewed before applying.
Usage
Preview Fixes
See what would be fixed without modifying files:
bash
claudelint check-all --fix-dry-runOutput:
text
Previewing 3 fixes...
Proposed changes:
Index: .claude/skills/my-skill/test.sh
===================================================================
--- .claude/skills/my-skill/test.sh original
+++ .claude/skills/my-skill/test.sh fixed
@@ -1,1 +1,2 @@
+#!/usr/bin/env bash
echo "Hello"
✓ 3 fixes would be applied to 3 filesApply Fixes
bash
claudelint check-all --fixFix by Severity
bash
# Fix only errors
claudelint check-all --fix --fix-type errors
# Fix only warnings
claudelint check-all --fix --fix-type warnings
# Fix all (default)
claudelint check-all --fix --fix-type allFixable Rules
Not all rules support auto-fix — only mechanical changes that don't require human judgment. To see which rules are fixable:
bash
claudelint list-rules --fixableYou can also browse the Rules Reference — fixable rules are tagged with a green "Fixable" badge.
Recommended Workflow
bash
claudelint check-all --fix-dry-run # 1. Preview changes
claudelint check-all --fix # 2. Apply fixes
claudelint check-all # 3. Verify remaining issuesTips
- Preview first — always use
--fix-dry-runbefore--fix - Commit first — ensure you can
git checkout .to revert if needed - Fix in batches — use
--fix-type warningsor--fix-type errorsfor easier review - Re-validate — always run
claudelint check-allafter fixing - Caching is disabled during
--fixruns (fix functions can't be serialized), so expect slightly slower runs
Limitations
- Some rules require human judgment and can't be auto-fixed (e.g.,
skill-missing-comments,import-circular) - Fixes are applied sequentially per file — later fixes see the result of earlier ones
For troubleshooting auto-fix issues, see Troubleshooting.
See Also
- Rules Reference - See which rules are fixable
- Configuration - Configure validation rules
- CLI Reference - All command-line options
- CI/CD Integration - Using auto-fix in CI pipelines