Comprehensive truth scoring, code quality verification, and automatic rollback system with 0.95 accuracy threshold for ensuring high-quality agent outputs and codebase reliability.
Before writing ANY code, you MUST check:
.claude/library/catalog.json.claude/docs/inventories/LIBRARY-PATTERNS-GUIDE.mdD:\Projects\*| Match | Action |
|---|---|
| Library >90% | REUSE directly |
| Library 70-90% | ADAPT minimally |
| Pattern exists | FOLLOW pattern |
| In project | EXTRACT |
| No match | BUILD (add to library after) |
Use this skill when:
Do NOT use this skill for:
This skill succeeds when:
Handle these edge cases carefully:
CRITICAL RULES - ALWAYS FOLLOW:
Use multiple validation perspectives:
Validation Threshold: Findings require 2+ confirming signals before flagging as violations.
This skill integrates with:
This skill provides a comprehensive verification and quality assurance system that ensures code quality and correctness through:
npx claude-flow@alpha)# View current truth scores
npx claude-flow@alpha truth
# Run verification check
npx claude-flow@alpha verify check
# Verify specific file with custom threshold
npx claude-flow@alpha verify check --file src/app.js --threshold 0.98
# Rollback last failed verification
npx claude-flow@alpha verify rollback --last-good
Use this skill when:
Do NOT use this skill for:
This skill succeeds when:
Handle these edge cases carefully:
CRITICAL RULES - ALWAYS FOLLOW:
Use multiple validation perspectives:
Validation Threshold: Findings require 2+ confirming signals before flagging as violations.
This skill integrates with:
Display comprehensive quality and reliability metrics for your codebase and agent tasks.
Basic Usage:
# View current truth scores (default: table format)
npx claude-flow@alpha truth
# View scores for specific time period
npx claude-flow@alpha truth --period 7d
# View scores for specific agent
npx claude-flow@alpha truth --agent coder --period 24h
# Find files/tasks below threshold
npx claude-flow@alpha truth --threshold 0.8
Output Formats:
# Table format (default)
npx claude-flow@alpha truth --format table
# JSON for programmatic access
npx claude-flow@alpha truth --format json
# CSV for spreadsheet analysis
npx claude-flow@alpha truth --format csv
# HTML report with visualizations
npx claude-flow@alpha truth --format html --export report.html
Real-time Monitoring:
# Watch mode with live updates
npx claude-flow@alpha truth --watch
# Export metrics automatically
npx claude-flow@alpha truth --export .claude-flow/metrics/truth-$(date +%Y%m%d).json
Example dashboard output:
š Truth Metrics Dashboard
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Overall Truth Score: 0.947 ā
Trend: āļø +2.3% (7d)
Top Performers:
verification-agent 0.982 ā
code-analyzer 0.971 ā
test-generator 0.958 ā
Needs Attention:
refactor-agent 0.821 ā ļø
docs-generator 0.794 ā ļø
Recent Tasks:
task-456 0.991 ā
"Implement auth"
task-455 0.967 ā
"Add tests"
task-454 0.743 ā "Refactor API"
Truth Scores (0.0-1.0):
1.0-0.95: Excellent ā (production-ready)0.94-0.85: Good ā
(acceptable quality)0.84-0.75: Warning ā ļø (needs attention)<0.75: Critical ā (requires immediate action)Trend Indicators:
Statistics:
Execute comprehensive verification checks on code, tasks, or agent outputs.
File Verification:
# Verify single file
npx claude-flow@alpha verify check --file src/app.js
# Verify directory recursively
npx claude-flow@alpha verify check --directory src/
# Verify with auto-fix enabled
npx claude-flow@alpha verify check --file src/utils.js --auto-fix
# Verify current working directory
npx claude-flow@alpha verify check
Task Verification:
# Verify specific task output
npx claude-flow@alpha verify check --task task-123
# Verify with custom threshold
npx claude-flow@alpha verify check --task task-456 --threshold 0.99
# Verbose output for debugging
npx claude-flow@alpha verify check --task task-789 --verbose
Batch Verification:
# Verify multiple files in parallel
npx claude-flow@alpha verify batch --files "*.js" --parallel
# Verify with pattern matching
npx claude-flow@alpha verify batch --pattern "src/**/*.ts"
# Integration test suite
npx claude-flow@alpha verify integration --test-suite full
The verification system evaluates:
Code Correctness
Best Practices
Security
Performance
Documentation
# Get structured JSON output
npx claude-flow@alpha verify check --json > verification.json
# Example JSON structure:
{
"overallScore": 0.947,
"passed": true,
"threshold": 0.95,
"checks": [
{
"name": "code-correctness",
"score": 0.98,
"passed": true
},
{
"name": "security",
"score": 0.91,
"passed": false,
"issues": [...]
}
]
}
Automatically revert changes that fail verification checks.
Basic Rollback:
# Rollback to last known good state
npx claude-flow@alpha verify rollback --last-good
# Rollback to specific commit
npx claude-flow@alpha verify rollback --to-commit abc123
# Interactive rollback with preview
npx claude-flow@alpha verify rollback --interactive
Smart Rollback:
# Rollback only failed files (preserve good changes)
npx claude-flow@alpha verify rollback --selective
# Rollback with automatic backup
npx claude-flow@alpha verify rollback --backup-first
# Dry-run mode (preview without executing)
npx claude-flow@alpha verify rollback --dry-run
Rollback Performance:
Create detailed verification reports with metrics and visualizations.
Report Formats:
# JSON report
npx claude-flow@alpha verify report --format json
# HTML report with charts
npx claude-flow@alpha verify report --export metrics.html --format html
# CSV for data analysis
npx claude-flow@alpha verify report --format csv --export metrics.csv
# Markdown summary
npx claude-flow@alpha verify report --format markdown
Time-based Reports:
# Last 24 hours
npx claude-flow@alpha verify report --period 24h
# Last 7 days
npx claude-flow@alpha verify report --period 7d
# Last 30 days with trends
npx claude-flow@alpha verify report --period 30d --include-trends
# Custom date range
npx claude-flow@alpha verify report --from 2025-01-01 --to 2025-01-31
Report Content:
Run interactive web-based verification dashboard with real-time updates.
# Launch dashboard on default port (3000)
npx claude-flow@alpha verify dashboard
# Custom port
npx claude-flow@alpha verify dashboard --port 8080
# Export dashboard data
npx claude-flow@alpha verify dashboard --export
# Dashboard with auto-refresh
npx claude-flow@alpha verify dashboard --refresh 5s
Dashboard Features:
Set verification preferences in .claude-flow/config.json:
{
"verification": {
"threshold": 0.95,
"autoRollback": true,
"gitIntegration": true,
"hooks": {
"preCommit": true,
"preTask": true,
"postEdit": true
},
"checks": {
"codeCorrectness": true,
"security": true,
"performance": true,
"documentation": true,
"bestPractices": true
}
},
"truth": {
"defaultFormat": "table",
"defaultPeriod": "24h",
"warningThreshold": 0.85,
"criticalThreshold": 0.75,
"autoExport": {
"enabled": true,
"path": ".claude-flow/metrics/truth-daily.json"
}
}
}
Adjust verification strictness:
# Strict mode (99% accuracy required)
npx claude-flow@alpha verify check --threshold 0.99
# Lenient mode (90% acceptable)
npx claude-flow@alpha verify check --threshold 0.90
# Set default threshold
npx claude-flow@alpha config set verification.threshold 0.98
Per-environment thresholds:
{
"verification": {
"thresholds": {
"production": 0.99,
"staging": 0.95,
"development": 0.90
}
}
}
GitHub Actions:
name: Quality Verification
on: [push, pull_request]
jobs:
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: npm install
- name: Run Verification
run: |
npx claude-flow@alpha verify check --json > verification.json
- name: Check Truth Score
run: |
score=$(jq '.overallScore' verification.json)
if (( $(echo "$score < 0.95" | bc -l) )); then
echo "Truth score too low: $score"
exit 1
fi
- name: Upload Report
uses: actions/upload-artifact@v3
with:
name: verification-report
path: verification.json
GitLab CI:
verify:
stage: test
script:
- npx claude-flow@alpha verify check --threshold 0.95 --json > verification.json
- |
score=$(jq '.overallScore' verification.json)
if [ $(echo "$score < 0.95" | bc) -eq 1 ]; then
echo "Verification failed with score: $score"
exit 1
fi
artifacts:
paths:
- verification.json
reports:
junit: verification.json
Run verification automatically during swarm operations:
# Swarm with verification enabled
npx claude-flow@alpha swarm --verify --threshold 0.98
# Hive Mind with auto-rollback
npx claude-flow@alpha hive-mind --verify --rollback-on-fail
# Training pipeline with verification
npx claude-flow@alpha train --verify --threshold 0.99
Enable real-time verification during collaborative development:
# Pair with verification
npx claude-flow@alpha pair --verify --real-time
# Pair with custom threshold
npx claude-flow@alpha pair --verify --threshold 0.97 --auto-fix
Monitor codebase continuously during development:
# Watch directory for changes
npx claude-flow@alpha verify watch --directory src/
# Watch with auto-fix
npx claude-flow@alpha verify watch --directory src/ --auto-fix
# Watch with notifications
npx claude-flow@alpha verify watch --notify --threshold 0.95
Send metrics to external monitoring systems:
# Export to Prometheus
npx claude-flow@alpha truth --format json | \
curl -X POST https://pushgateway.example.com/metrics/job/claude-flow \
-d @-
# Send to DataDog
npx claude-flow@alpha verify report --format json | \
curl -X POST "https://api.datadoghq.com/api/v1/series?api_key=${DD_API_KEY}" \
-H "Content-Type: application/json" \
-d @-
# Custom webhook
npx claude-flow@alpha truth --format json | \
curl -X POST https://metrics.example.com/api/truth \
-H "Content-Type: application/json" \
-d @-
Automatically verify before commits:
# Install pre-commit hook
npx claude-flow@alpha verify install-hook --pre-commit
# .git/hooks/pre-commit example:
#!/bin/bash
npx claude-flow@alpha verify check --threshold 0.95 --json > /tmp/verify.json
score=$(jq '.overallScore' /tmp/verify.json)
if (( $(echo "$score < 0.95" | bc -l) )); then
echo "ā Verification failed with score: $score"
echo "Run 'npx claude-flow@alpha verify check --verbose' for details"
exit 1
fi
echo "ā
Verification passed with score: $score"
Verification Speed:
Rollback Speed:
Dashboard Performance:
Low Truth Scores:
# Get detailed breakdown
npx claude-flow@alpha truth --verbose --threshold 0.0
# Check specific criteria
npx claude-flow@alpha verify check --verbose
# View agent-specific issues
npx claude-flow@alpha truth --agent <agent-name> --format json
Rollback Failures:
# Check git status
git status
# View rollback history
npx claude-flow@alpha verify rollback --history
# Manual rollback
git reset --hard HEAD~1
Verification Timeouts:
# Increase timeout
npx claude-flow@alpha verify check --timeout 60s
# Verify in batches
npx claude-flow@alpha verify batch --batch-size 10
Verification commands return standard exit codes:
0: Verification passed (score ā„ threshold)1: Verification failed (score < threshold)2: Error during verification (invalid input, system error)npx claude-flow@alpha pair - Collaborative development with verificationnpx claude-flow@alpha train - Training with verification feedbacknpx claude-flow@alpha swarm - Multi-agent coordination with quality checksnpx claude-flow@alpha report - Generate comprehensive project reports/docs/truth-scoring.md/docs/verification-criteria.md/examples/verification//docs/api/verification.mdVerification and Quality Assurance operates on 3 fundamental principles:
Quality is measurable through statistical reliability metrics that provide objective assessment of code correctness and agent performance.
In practice:
Quality thresholds should be enforced automatically with immediate reversion of changes that fail verification rather than allowing bad code to persist.
In practice:
Quality verification is not a one-time gate but a continuous process providing real-time feedback during development.
In practice:
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Manual-Only Verification | Relying on developers to remember to run verification checks before committing | Install pre-commit hooks that automatically verify changes; integrate verification into CI/CD pipeline |
| Ignoring Low Scores | Seeing truth scores below threshold but merging anyway due to deadlines or "it looks fine" | Enforce quality gates strictly; use automatic rollback for failed verification; track exceptions with explicit justification |
| One-Dimensional Quality Metrics | Focusing only on test coverage or only on linting while ignoring security, performance, or documentation | Use comprehensive verification criteria covering correctness, security, performance, best practices, and documentation |
| Late-Stage Verification | Running verification only at PR submission, creating merge delays and context loss | Enable watch mode during development for immediate feedback; run verification continuously, not just at checkpoints |
| Ignoring Quality Trends | Focusing only on current scores without noticing gradual quality degradation | Track trends over time; set alerts for declining quality metrics; review quality reports regularly |
| Overly Lenient Thresholds | Setting thresholds too low (e.g., 0.75) allowing low-quality code to pass | Use strict thresholds (0.95-0.99) for production code; adjust thresholds based on criticality and risk tolerance |
Verification and Quality Assurance with truth scoring and automatic rollback transforms code quality from a subjective judgment into an objective, measurable, and enforceable standard. By quantifying quality through statistical reliability metrics and automatically blocking or reverting changes that fall below thresholds, this skill ensures that only high-quality code enters the codebase while providing developers with clear, actionable feedback for improvement.
Use this skill as a continuous quality monitoring system throughout the development lifecycle, not just at release gates. The combination of truth scoring for quantified quality assessment, comprehensive verification checks across multiple dimensions, and instant rollback for failed changes creates a safety net that catches quality issues early while maintaining development velocity. The real-time feedback through watch mode and live dashboards enables developers to fix issues immediately rather than discovering them days later during code review.
The integration with CI/CD pipelines, pre-commit hooks, and external monitoring systems means verification becomes an automatic part of the development workflow rather than a manual step that gets skipped under pressure. When combined with functionality-audit for execution verification, theater-detection for placeholder elimination, and code-review for human oversight, this skill completes a comprehensive quality ecosystem that delivers production-ready code with measurable confidence in its correctness, security, and reliability.