lint-and-validate
它能做什么
这个技能让你的 AI 智能体用合适的工具检查自己的代码改动。适合希望检查代码中错误、风格问题和安全问题的开发者。
适用场景
- ✓当你的智能体改动了代码,并希望在工作被称为完成之前进行检查时。
- ✓当你希望对项目运行代码检查或类型检查时。
- ✓当项目没有代码检查配置,而你希望获得建议时。
技能链接
https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/lint-and-validate/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请做这个改动,然后运行代码检查器和类型检查,并修复它们报告的所有问题。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会为你的语言运行代码检查器、类型检查器和安全审核,例如 TypeScript 的 ESLint 和 tsc,或 Python 的 Ruff 和 MyPy。它会修复报告的问题,并重复运行,直到检查通过。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Lint and Validate Skill
MANDATORY: Run appropriate validation tools after EVERY code change. Do not finish a task until the code is error-free.
Procedures by Ecosystem
Node.js / TypeScript
- Lint/Fix:
npm run lintornpx eslint "path" --fix - Types:
npx tsc --noEmit - Security:
npm audit --audit-level=high
Python
- Linter (Ruff):
ruff check "path" --fix(Fast & Modern) - Security (Bandit):
bandit -r "path" -ll - Types (MyPy):
mypy "path"
The Quality Loop
- Write/Edit Code
- Run Audit:
npm run lint && npx tsc --noEmit - Analyze Report: Check the "FINAL AUDIT REPORT" section.
- Fix & Repeat: Submitting code with "FINAL AUDIT" failures is NOT allowed.
Error Handling
- If
lintfails: Fix the style or syntax issues immediately. - If
tscfails: Correct type mismatches before proceeding. - If no tool is configured: Check the project root for
.eslintrc,tsconfig.json,pyproject.tomland suggest creating one.
Strict Rule: No code should be committed or reported as "done" without passing these checks.
Scripts
| Script | Purpose | Command |
|---|---|---|
scripts/lint_runner.py |
Unified lint check | python scripts/lint_runner.py <project_path> |
scripts/type_coverage.py |
Type coverage analysis | python scripts/type_coverage.py <project_path> |
常见问题
涵盖哪些语言?
涵盖 Node.js 和 TypeScript 项目,以及使用 Ruff、Bandit 和 MyPy 的 Python 项目。
如果没有设置代码检查工具怎么办?
智能体会检查项目中的配置文件,并建议创建一个。
它会检查安全吗?
会。它会运行 npm audit 和 Bandit 等安全审核工具。
详情
作者的原始描述
Automatic quality control, linting, and static analysis procedures. Use after every code modification to ensure syntax correctness and project standards. Triggers onKeywords: lint, format, check, validate, types, static analysis.
热度
- GitHub 星标
- 33k
- 排名
- #8775
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
owasp-security
33k教你的智能体掌握面向网页应用、API、移动端、容器和 AI 智能体的 OWASP 安全指南,以便发现常见弱点并提出修复建议。
agent-management
33k让你的智能体使用 AI Maestro 命令行工具创建、列出、休眠、唤醒、重命名和删除 AI 智能体,管理每个智能体的生命周期。
agent-messaging
33k让你的智能体使用智能体消息协议,在 AI 智能体之间发送、接收和回复带签名的消息,大部分在你自己的电脑上完成。
docs-search
33k让你的智能体搜索自动生成的代码文档,查找函数签名、类定义和注释,从而在修改代码之前核对真实的 API。