Lint and Fix
Purpose
This skill provides an autonomous loop to identify, fix, and verify linter violations in the codebase using the project's make lint command (which runs pre-commit).
Loop Logic
- Identify: Run
make lintfrom the workspace root to list current violations. - Analyze: Examine the linter output to understand which files and rules are failing.
- Fix: Apply targeted fixes for the identified violations.
- Many linters in
pre-commit(likeblack,ruff,prettier) can auto-fix issues. - If
pre-commitauto-fixes files, review the changes. - If manual fixes are required, apply the minimum necessary change to resolve each error.
- Verify: Re-run
make lint.
- If all checks pass: Termination.
- If new or remaining failures exist: Analyze the failure and repeat the loop.
Termination Criteria
make lintexits with code 0 (all checks passed).- Reached max iteration limit of 5 attempts.
- No progress being made (same errors persisting despite fix attempts).
Examples
Scenario: Fixing formatting and imports
make lintfails withruffandblackerrors.- Agent runs
make lintagain (some linters auto-fix). - Agent reviews auto-fixed changes.
make lintpasses.