Scan mode checks formatter setup; run mode formats all project files. Works with the claude-foundations formatter infrastructure. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2.5 KiB
2.5 KiB
name, description, user_invocable
| name | description | user_invocable |
|---|---|---|
| linter | Audit and manage project formatters/linters. Scan mode checks setup; run mode formats all files. | true |
/linter Skill
linter
You are running the /linter skill. Parse the arguments to determine the mode:
/linteror/linter scan→ Scan mode (default)/linter run→ Run mode (format all files)/linter cleanup→ Clean up orphaned.pre-lintfiles
Scan Mode (default)
Audit the current project's formatter setup:
- Find file types — Use
findorGlobto identify all file extensions in the project (exclude.git/,node_modules/,vendor/, etc.) - Check formatters/ directory — Does it exist? What symlinks are present?
- Check tool availability — For each formatter, verify the required tool is installed (
ruff,shfmt,shellcheck,biome,sqlfluff,prettier) - Check config files — For each formatter, check if the project has the expected config file (
pyproject.toml,.editorconfig,biome.json,.sqlfluff,.prettierrc) - Check pre-commit hook — Is
pre-commit-lint.shinstalled as a git pre-commit hook? - Check orphaned
.pre-lintfiles — Any leftover checkpoint files from interrupted lint runs?
Present results as a table:
Extension | Files | Formatter | Tool | Config | Status
----------|-------|-----------|------|--------|-------
.py | 12 | ✓ py | ✓ ruff | ✓ pyproject.toml | Ready
.sh | 8 | ✓ sh | ✓ shfmt, ✓ shellcheck | ✗ .editorconfig | Missing config
.ts | 0 | ✗ | - | - | No files
Then suggest commands to fix any issues:
- Missing formatters:
setup-formatters.sh <project> <ext> ... - Missing tools: install commands
- Missing configs: create minimal config files
- Orphaned
.pre-lintfiles: list them and offer to clean up
Run Mode (/linter run)
Format and lint all files in the project:
- Verify
formatters/exists - Create a git stash checkpoint:
git stash push -m "pre-linter-run" - Find all files with matching formatters
- Run each formatter on matching files
- Collect and report errors
- Show
git diff --statsummary of changes - If errors remain, list them and suggest fixes
Cleanup Mode (/linter cleanup)
Find and remove orphaned .pre-lint files:
- Search for
*.pre-lintfiles in the project - List them with their age
- Remove them (they're just blob SHA references or file copies)