AgentSkillsCN

fix-lint

代码格式修复流程。触发词:lint、格式化、eslint。

中文原作
SKILL.md
--- frontmatter
name: fix-lint
description: 代码格式修复流程。触发词:lint、格式化、eslint。

/fix-lint

自动修复代码 lint 和格式错误的内部循环命令。

使用场景

  • 提交前修复格式问题
  • CI 失败后快速修复
  • 批量格式化代码

执行步骤

  1. 检测项目类型:识别 package.json / pyproject.toml 等
  2. 运行 lint 检查
    • JS/TS: eslint . --fixbiome check --fix
    • Python: ruff check --fix
    • Go: gofmt -w .
  3. 运行格式化
    • JS/TS: prettier --write .
    • Python: ruff format
  4. 显示修复结果
  5. 调用 zhi 确认是否提交

支持的工具

语言LintFormat
TypeScript/JavaScriptESLint, BiomePrettier, Biome
PythonRuff, Flake8Ruff, Black
Gogolangci-lintgofmt
Rustclippyrustfmt

参数

参数说明默认值
--check只检查不修复false
--staged只处理暂存文件false

示例输出

code
✓ Detected: TypeScript project (biome)
✓ Fixed 5 lint errors
✓ Formatted 12 files
? Commit these fixes? [y/n]