lint-and-validate
在代码上运行 linting 和验证
代码修改通常会引入语法错误或违反项目规范。此技能可自动执行 linting、类型检查和安全审计,以便在提交前发现问题。
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“lint-and-validate”。 Run lint on the project
预期结果:
LINT RUNNER - Project: /app/myproject
Type: node
Linters: 2
Running: npm lint...
[PASS] npm lint
Running: tsc...
[FAIL] tsc
Error: src/utils.ts(15,3): Type 'string' is not assignable to type 'number'
SUMMARY
[PASS] npm lint
[FAIL] tsc
正在使用“lint-and-validate”。 Check type coverage
预期结果:
TYPE COVERAGE CHECKER
[TYPESCRIPT]
[OK] Analyzed 12 TypeScript files
[!] 3 'any' types found (acceptable)
[!] Type coverage: 65 percent (improve)
[PYTHON]
[OK] Analyzed 8 Python files
[OK] Type hints coverage: 82 percent
[OK] No 'Any' types found
TYPE COVERAGE: 1 critical issues
安全审计
低风险Static analyzer flagged 20 patterns but all are false positives. The subprocess.run calls execute known linter commands derived from project configuration, not user input. Markdown documentation examples were incorrectly flagged as shell execution. No cryptographic code exists. The skill is safe for publication with documented external command usage.
低风险问题 (1)
风险因素
⚙️ 外部命令 (1)
质量评分
你能构建什么
提交前的开发者验证
在提交代码前运行全面的 linting,确保所有更改都符合项目规范。
代码审查准备
在提交拉取请求前验证代码更改,以减少审查周期。
遗留代码现代化
在迁移旧代码库时识别类型覆盖缺口和 linting 问题。
试试这些提示
在我的当前项目上运行 lint 和 validate 技能,检查是否有任何问题。
Lint 并验证 src/components 目录中的所有文件,并修复任何可自动修复的问题。
运行包括 lint、类型检查和安全审计的完整验证。生成按严重程度分类的所有发现的摘要报告。
分析整个代码库的类型覆盖情况。识别类型覆盖低于 70% 的文件,并列出需要添加注解的未类型化函数。
最佳实践
- 每次代码修改后都运行 linting,而不仅仅是在提交前
- 在运行验证前,在项目根目录文件中配置 linter 规则
- 立即修复类型错误,而不是累积技术债务
避免
- 为赶截止日期而跳过验证会在生产环境中引入 bug
- 忽略类型检查器错误会导致运行时故障
- 运行 linter 时不使用 --fix 参数会错过自动修复