fix-quality
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/fix-quality
/fix-quality
Fix the highest priority quality infrastructure gap.
修复最高优先级的代码质量基础设施短板。
What This Does
功能说明
- Invoke to audit quality gates
/check-quality - Identify highest priority gap
- Fix that one issue
- Verify the fix
- Report what was done
This is a fixer. It fixes one issue at a time. Run again for next issue. Use for full setup.
/quality-gates- 调用/check-quality审核代码质量门禁
- 识别最高优先级的短板
- 修复该问题
- 验证修复效果
- 报告处理内容
这是一个修复工具,每次仅修复一个问题。如需处理下一个问题,请再次运行。使用/quality-gates进行完整配置。
Process
操作流程
1. Run Primitive
1. 运行基础命令
Invoke skill to get prioritized findings.
/check-quality调用/check-quality工具获取按优先级排序的问题列表。
2. Fix Priority Order
2. 修复优先级顺序
Fix in this order:
- P0: Missing test runner, missing CI workflow
- P1: Coverage, git hooks, linting, strict TypeScript
- P2: Commitlint, coverage in PRs
- P3: Tool upgrades
按以下顺序修复:
- P0:缺失测试运行器、缺失CI工作流
- P1:测试覆盖率、Git Hooks、代码检查、严格模式TypeScript
- P2:Commitlint、PR中的覆盖率检查
- P3:工具版本升级
3. Execute Fix
3. 执行修复
No test runner (P0):
bash
pnpm add -D vitest @vitest/coverage-v8Create :
vitest.config.tstypescript
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
globals: true,
environment: 'node',
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
},
},
});Add scripts to package.json:
json
{
"scripts": {
"test": "vitest",
"test:run": "vitest run",
"coverage": "vitest run --coverage"
}
}No CI workflow (P0):
Create :
.github/workflows/ci.ymlyaml
name: CI
on: [push, pull_request]
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install
- run: pnpm typecheck
- run: pnpm lint
- run: pnpm test:runNo git hooks (P1):
bash
pnpm add -D lefthook
pnpm lefthook installCreate :
lefthook.ymlyaml
pre-commit:
parallel: true
commands:
lint:
glob: "*.{ts,tsx}"
run: pnpm eslint {staged_files}
typecheck:
run: pnpm tsc --noEmit
pre-push:
commands:
test:
run: pnpm test:runTypeScript not strict (P1):
Update :
tsconfig.jsonjson
{
"compilerOptions": {
"strict": true
}
}无测试运行器(P0):
bash
pnpm add -D vitest @vitest/coverage-v8Create :
vitest.config.tstypescript
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
globals: true,
environment: 'node',
coverage: {
provider: 'v8',
reporter: ['text', 'json', 'html'],
},
},
});在package.json中添加脚本:
json
{
"scripts": {
"test": "vitest",
"test:run": "vitest run",
"coverage": "vitest run --coverage"
}
}无CI工作流(P0):
创建:
.github/workflows/ci.ymlyaml
name: CI
on: [push, pull_request]
jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: 'pnpm'
- run: pnpm install
- run: pnpm typecheck
- run: pnpm lint
- run: pnpm test:run无Git Hooks(P1):
bash
pnpm add -D lefthook
pnpm lefthook install创建:
lefthook.ymlyaml
pre-commit:
parallel: true
commands:
lint:
glob: "*.{ts,tsx}"
run: pnpm eslint {staged_files}
typecheck:
run: pnpm tsc --noEmit
pre-push:
commands:
test:
run: pnpm test:runTypeScript未启用严格模式(P1):
更新:
tsconfig.jsonjson
{
"compilerOptions": {
"strict": true
}
}4. Verify
4. 验证修复
After fix:
bash
undefined修复完成后:
bash
undefinedTest runner works
测试运行器正常工作
pnpm test --run
pnpm test --run
Hooks installed
Hooks已安装
[ -f ".git/hooks/pre-commit" ] && echo "✓ pre-commit hook"
[ -f ".git/hooks/pre-commit" ] && echo "✓ pre-commit hook"
CI file exists
CI文件已存在
[ -f ".github/workflows/ci.yml" ] && echo "✓ CI workflow"
undefined[ -f ".github/workflows/ci.yml" ] && echo "✓ CI workflow"
undefined5. Report
5. 报告示例
Fixed: [P0] No test runner configured
Installed:
- vitest
- @vitest/coverage-v8
Created:
- vitest.config.ts
- Added test scripts to package.json
Verified: pnpm test runs successfully
Next highest priority: [P0] No CI workflow
Run /fix-quality again to continue.已修复:[P0] 未配置测试运行器
已安装:
- vitest
- @vitest/coverage-v8
已创建:
- vitest.config.ts
- 已在package.json中添加测试脚本
验证结果:pnpm test运行成功
下一个最高优先级问题:[P0] 无CI工作流
再次运行/fix-quality继续处理。Branching
分支管理
Before making changes:
bash
git checkout -b infra/quality-$(date +%Y%m%d)修改前执行:
bash
git checkout -b infra/quality-$(date +%Y%m%d)Single-Issue Focus
单问题聚焦
This skill fixes one issue at a time. Benefits:
- Small, reviewable changes
- Easy to verify each fix
- Clear commit history
Run repeatedly to work through the backlog.
/fix-quality该工具每次仅修复一个问题,优势如下:
- 更改内容小,便于代码评审
- 易于验证每个修复效果
- 提交历史清晰
重复运行/fix-quality逐步处理所有问题。
Related
相关工具
- - The primitive (audit only)
/check-quality - - Create issues without fixing
/log-quality-issues - - Full quality setup workflow
/quality-gates
- - 基础工具(仅审核)
/check-quality - - 仅记录问题不修复
/log-quality-issues - - 完整的代码质量配置流程
/quality-gates