Agent skill
lint-fix
Iteratively run linters, apply auto-fixes, and resolve remaining issues using Trunk.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/lint-fix
SKILL.md
Lint & Fix with Trunk
Purpose
This skill provides an autonomous loop for identifying, fixing, and verifying linting and formatting issues using trunk. Use this when you need to ensure the codebase adheres to project standards or when fixing specific lint errors.
Loop Logic
- Auto-Format: Run
trunk fmt(ortrunk fmt -a) to apply automatic formatting fixes. - Discovery: Run
trunk check -y(ortrunk check -a -yfor all files) to list current linting issues. - Analyze: For any remaining issues from Step 2:
- Examine the error message and the failing code.
- Identify the specific rule being violated (e.g., Ruff
E501, ShellcheckSC2086).
- Fix: Apply the minimum necessary change to resolve the manual fix required.
- Verify: Re-run
trunk check -yon the affected file(s).- If passed: Move to next issue.
- If failed: Analyze the new failure and repeat the loop.
Termination Criteria
- No more errors reported by
trunk check -y. - Reached max iteration limit (default: 5).
Common Commands
| Task | Command |
|---|---|
| Check changed files | trunk check -y |
| Check all files | trunk check -a -y |
| Format changed files | trunk fmt |
| Format all files | trunk fmt -a |
| Check specific file | trunk check -y <path> |
| Format specific file | trunk fmt <path> |
Examples
Scenario: Fixing Python Lint Errors
trunk check -yreportsruff: D103(missing docstring) inscripts/utils.py(after auto-fixing unused imports).- Agent adds the missing docstring in
scripts/utils.py. trunk check -y scripts/utils.pypasses.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?