Verification Loop Skill
A comprehensive verification system to ensure code quality before commits and pull requests.
Activation Conditions
- •After completing feature development or code changes
- •Before creating a PR
- •After refactoring
- •When quality gate verification is needed
Verification Phases
Phase 1: Build Verification
bash
# Run project build (adapt command to your package manager) npm run build 2>&1 | tail -30 # or: yarn build, pnpm build, make build, etc.
If build fails, STOP - fix errors before proceeding to the next phase.
Phase 2: Type Check
bash
# TypeScript type checking npx tsc --noEmit 2>&1 | head -30 # For monorepos, check specific packages npx tsc --noEmit -p packages/core/tsconfig.json
Report type errors - fix critical errors before proceeding.
Phase 3: Lint Check
bash
# Run your project's linter (ESLint, Biome, etc.) npm run lint 2>&1 | head -50 # Auto-fix if available npm run lint:fix
Note: Adapt commands to your project's linting tool configuration.
Phase 4: Test Execution
bash
# Run tests npm test 2>&1 | tail -50 # Run specific test patterns npm test -- --testPathPattern=user # Run with coverage npm test -- --coverage
Test result report:
- •Total tests: X
- •Passed: X
- •Failed: X
- •Coverage: X% (target: 80%+)
Phase 5: Security Check
bash
# Check for hardcoded secrets grep -rn "sk-" --include="*.ts" src/ 2>/dev/null | head -10 grep -rn "api_key\s*=" --include="*.ts" src/ 2>/dev/null | head -10 grep -rn "password\s*=" --include="*.ts" src/ 2>/dev/null | grep -v ".spec.ts" | head -10 # Check for console.log (excluding test files) grep -rn "console.log" --include="*.ts" src/ 2>/dev/null | grep -v ".spec.ts" | head -10 # Check if .env files are being committed git status | grep -E "\.env"
Phase 6: Schema Change Check
bash
# Check for database schema changes git diff --name-only | grep -E "(schema|migration|\.sql)" # Check for ORM schema file changes git diff --name-only | grep -E "(drizzle|prisma|typeorm)"
If schema changes are detected, use schema-designer agent to review:
- •Data type selection
- •Relationship design
- •Index planning
- •Naming conventions
- •Migration safety
Phase 7: Diff Review
bash
# Check changed files git diff --stat git diff HEAD~1 --name-only # Review specific file changes git diff HEAD~1 -- src/
Review each changed file for:
- •Unintended changes
- •Missing error handling
- •Edge case handling
Output Format
After completing all phases, generate a verification report:
code
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) Schema: [PASS/FAIL/N/A] (changes detected: yes/no) Diff: [X files changed] Overall: [READY/NOT READY] for PR Issues to Fix: 1. ... 2. ...
Quick Commands
bash
# Full verification at once npm run build && npm run lint && npm test # Quick verification (build + lint only) npm run build && npm run lint # Auto-fix then verify npm run lint:fix && npm run build
Continuous Mode
For long sessions, run verification every 15 minutes or after major changes:
code
Checkpoint triggers: - After completing each feature - After component implementation - Before starting next task Run: /verify
Common Issues and Solutions
| Issue | Cause | Solution |
|---|---|---|
| Build failure | Type errors, missing imports | Run tsc --noEmit to identify |
| Lint errors | Formatting, rule violations | Run lint with --fix flag |
| Test failure | Logic errors, missing fixtures | Check error messages in test output |
| console.log warning | Debug code not removed | Delete the lines |
| Schema issues | Improper types, missing indexes | Use schema-designer agent |
Hooks Integration
This skill works with PostToolUse hooks:
- •Hook: Immediate problem detection (auto-format after Edit)
- •Skill: Comprehensive final verification (before PR)
Related Agents
- •build-error-resolver: Automatically resolve build errors
- •code-reviewer: Code quality review
- •security-reviewer: Deep security analysis
- •schema-designer: Database schema design and review (use when schema changes detected)
Universal verification workflow for quality assurance