用途:这是一个通用 linter 技能,用于在项目中自动检测语言并运行对应的代码检查工具,适合多语言(polyglot)仓库、提交前一次性 lint,以及查找各语言的自动修复命令。
主要能力:根据项目文件(package.json、pyproject.toml、setup.py、Cargo.toml、go.mod)和 .pre-commit-config.yaml 判断项目类型,然后运行相应工具。Python 使用 ruff check、ty check、ruff format、bandit;JavaScript/TypeScript 使用 npm run lint(ESLint)、prettier、tsc --noEmit;Rust 使用 cargo clippy、cargo fmt、cargo check;Go 使用 gofmt、go vet、staticcheck。若配置了 pre-commit,则运行 pre-commit run --all-files。多语言项目会分别检测并汇总结果。
使用方式:参数 $1 为检查路径(默认当前目录),$2 为 --fix 自动修复,$3 为 --format 同时运行格式化。也可运行脚本:bash "${CLAUDE_PLUGIN_ROOT}/skills/code-lint/scripts/detect-and-fix.sh",加 --check-only 仅检查。脚本会检测 biome、eslint、prettier、ruff、black、clippy、rustfmt、gofmt、golangci-lint、shellcheck 并报告修改文件。
自动修复参考:TypeScript/JS 用 npx @biomejs/biome check --write . 或 format --write .;Python 用 ruff check --fix . 与 ruff format .;Rust 用 cargo clippy --fix --allow-dirty 与 cargo fmt;Go 用 gofmt -w . 与 go mod tidy;Shell 的 shellcheck 无自动修复,需手动处理。
适用场景:提交前 lint、按语言查找 autofix 命令、多语言仓库统一检查。
限制:若需检测结构性反模式应改用 code-antipatterns;代码质量与架构审查用 code-review;专门扫描被吞掉的错误用 code-hidden-failures --track errors。当修复需要理解业务逻辑、涉及多文件协同改动、警告可能是潜在 bug、涉及安全规则或类型错误需要改接口时,应停止自动修复。若无可用 linter,会检查 Makefile 的 make lint 或 npm run lint,并建议通过 /deps:install --dev 安装、/configure:linting 配置。检查后若存在无法修复的问题,建议使用 /code:refactor;全部通过则可进入 /git:smartcommit。