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
调用此Skill的场景:
  • 完成某个功能或重大代码变更后
  • 创建PR之前
  • 希望确保质量门禁通过时
  • 重构完成后

Verification Phases

验证阶段

Phase 1: Build Verification

阶段1:构建验证

bash
undefined
bash
undefined

Check if project builds

Check if project builds

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:代码规范检查

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

Run tests with coverage

Run tests with coverage

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

Check coverage threshold

Check coverage threshold

Target: 80% minimum

Target: 80% minimum


Report:
- Total tests: X
- Passed: X
- Failed: X
- Coverage: X%

报告内容:
- 测试总数:X
- 通过数:X
- 失败数:X
- 覆盖率:X%

Phase 5: Security Scan

阶段5:安全扫描

bash
undefined
bash
undefined

Check for secrets

Check for secrets

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 console.log

Check for console.log

grep -rn "console.log" --include=".ts" --include=".tsx" src/ 2>/dev/null | head -10
undefined
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

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
Set a mental checkpoint:
- After completing each function
- After finishing a component
- Before moving to next task

Run: /verify

Integration with Hooks

与Hooks的集成

This skill complements PostToolUse hooks but provides deeper verification. Hooks catch issues immediately; this skill provides comprehensive review.
此Skill是PostToolUse Hooks的补充,可提供更深入的验证。 Hooks可即时发现问题;而此Skill可提供全面审查。