verification-loop

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Verification Loop Skill

验证循环Skill

A comprehensive verification system for Claude Code sessions.
一款适用于Claude Code会话的全链路验证系统。

When to Use

适用场景

Invoke this skill:
  • After completing a feature or significant code change
  • Before creating a PR
  • When you want to ensure quality gates pass
  • After refactoring
在以下场景调用该技能:
  • 完成功能开发或重大代码变更后
  • 创建PR之前
  • 需要确保质量门禁全部通过时
  • 重构代码之后

Verification Phases

验证阶段

Phase 1: Build Verification

阶段1:构建验证

bash
undefined
bash
undefined

Python projects (uv)

Python projects (uv)

uv build 2>&1 | tail -20
uv build 2>&1 | tail -20

OR

OR

python -m build 2>&1 | tail -20
python -m build 2>&1 | tail -20

Node.js projects

Node.js projects

npm run build 2>&1 | tail -20
npm run build 2>&1 | tail -20

OR

OR

pnpm build 2>&1 | tail -20

If build fails, STOP and fix before continuing.
pnpm build 2>&1 | tail -20

如果构建失败,请立即停止流程,修复问题后再继续。

Phase 2: Type Check

阶段2:类型检查

bash
undefined
bash
undefined

TypeScript projects

TypeScript projects

npx tsc --noEmit 2>&1 | head -30
npx tsc --noEmit 2>&1 | head -30

Python projects

Python projects

pyright . 2>&1 | head -30

Report all type errors. Fix critical ones before continuing.
pyright . 2>&1 | head -30

上报所有类型错误,继续下一步之前优先修复严重错误。

Phase 3: Lint Check

阶段3:Lint检查

bash
undefined
bash
undefined

JavaScript/TypeScript

JavaScript/TypeScript

npm run lint 2>&1 | head -30
npm run lint 2>&1 | head -30

Python

Python

ruff check . 2>&1 | head -30
undefined
ruff check . 2>&1 | head -30
undefined

Phase 4: Test Suite

阶段4:测试套件执行

bash
undefined
bash
undefined

Python projects

Python projects

pytest --cov=src --cov-report=term-missing 2>&1 | tail -50
pytest --cov=src --cov-report=term-missing 2>&1 | tail -50

Node.js projects

Node.js projects

npm run test -- --coverage 2>&1 | tail -50

Report:
- Total tests: X
- Passed: X
- Failed: X
- Coverage: X%
npm run test -- --coverage 2>&1 | tail -50

需要上报的信息:
- 总测试用例数: X
- 用例通过数: X
- 用例失败数: X
- 测试覆盖率: X%

Phase 5: Security Scan

阶段5:安全扫描

bash
undefined
bash
undefined

Python: Check for secrets

Python: 检查密钥泄露

grep -rn "sk-" --include=".py" . 2>/dev/null | head -10 grep -rn "api_key" --include=".py" . 2>/dev/null | head -10 pip-audit
grep -rn "sk-" --include=".py" . 2>/dev/null | head -10 grep -rn "api_key" --include=".py" . 2>/dev/null | head -10 pip-audit

Node.js: Check for secrets

Node.js: 检查密钥泄露

grep -rn "sk-" --include=".ts" --include=".js" . 2>/dev/null | head -10 grep -rn "api_key" --include=".ts" --include=".js" . 2>/dev/null | head -10
grep -rn "sk-" --include=".ts" --include=".js" . 2>/dev/null | head -10 grep -rn "api_key" --include=".ts" --include=".js" . 2>/dev/null | head -10

Check for debug statements

检查调试语句残留

grep -rn "print(" --include=".py" src/ 2>/dev/null | head -10 grep -rn "console.log" --include=".ts" --include="*.tsx" src/ 2>/dev/null | head -10
undefined
grep -rn "print(" --include=".py" src/ 2>/dev/null | head -10 grep -rn "console.log" --include=".ts" --include="*.tsx" src/ 2>/dev/null | head -10
undefined

Phase 6: Diff Review

阶段6:差异审查

bash
undefined
bash
undefined

Show what changed

展示变更内容

git diff --stat git diff HEAD~1 --name-only

Review each changed file for:
- Unintended changes
- Missing error handling
- Potential edge cases
git diff --stat git diff HEAD~1 --name-only

逐个检查变更文件是否存在以下问题:
- 非预期的修改
- 缺失错误处理逻辑
- 潜在的边界场景问题

Output Format

输出格式

After running all phases, produce a verification report:
VERIFICATION REPORT
==================

Build:     [PASS/FAIL]
Types:     [PASS/FAIL] (X errors)
Lint:      [PASS/FAIL] (X warnings)
Tests:     [PASS/FAIL] (X/Y passed, Z% coverage)
Security:  [PASS/FAIL] (X issues)
Diff:      [X files changed]

Overall:   [READY/NOT READY] for PR

Issues to Fix:
1. ...
2. ...
跑完所有验证阶段后,生成如下验证报告:
VERIFICATION REPORT
==================

Build:     [PASS/FAIL]
Types:     [PASS/FAIL] (X errors)
Lint:      [PASS/FAIL] (X warnings)
Tests:     [PASS/FAIL] (X/Y passed, Z% coverage)
Security:  [PASS/FAIL] (X issues)
Diff:      [X files changed]

Overall:   [READY/NOT READY] for PR

Issues to Fix:
1. ...
2. ...

Continuous Mode

持续验证模式

For long sessions, run verification every 15 minutes or after major changes:
markdown
Set a mental checkpoint:
- After completing each function
- After finishing a component
- Before moving to next task

Run: /verify
对于长时间会话,每15分钟或者完成重大变更后执行一次验证:
markdown
设置心理检查点:
- 完成每个函数开发后
- 写完一个组件后
- 切换到下一个任务前

执行命令:/verify

Integration with Hooks

与钩子的集成

This skill complements PostToolUse hooks but provides deeper verification. Hooks catch issues immediately; this skill provides comprehensive review.
该技能是PostToolUse钩子的补充,可提供更深度的验证能力。钩子会即时捕获问题,而该技能提供全面的全局审查。