跳到正文
Skillpedia
测试33k · #8775

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。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/development/lint-and-validate/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 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

  1. Lint/Fix: npm run lint or npx eslint "path" --fix
  2. Types: npx tsc --noEmit
  3. Security: npm audit --audit-level=high

Python

  1. Linter (Ruff): ruff check "path" --fix (Fast & Modern)
  2. Security (Bandit): bandit -r "path" -ll
  3. Types (MyPy): mypy "path"

The Quality Loop

  1. Write/Edit Code
  2. Run Audit: npm run lint && npx tsc --noEmit
  3. Analyze Report: Check the "FINAL AUDIT REPORT" section.
  4. Fix & Repeat: Submitting code with "FINAL AUDIT" failures is NOT allowed.

Error Handling

  • If lint fails: Fix the style or syntax issues immediately.
  • If tsc fails: Correct type mismatches before proceeding.
  • If no tool is configured: Check the project root for .eslintrc, tsconfig.json, pyproject.toml and 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.

repo: davila7/claude-code-templates

热度

GitHub 星标
33k
排名
#8775
许可证
MIT
更新时间
2026/11/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能