| name | quality |
| description | AI code quality checks. The Big 5: input validation, edge cases, error handling, duplication, complexity. Triggers: quality, big 5, ai code, review, validate. |
| allowed-tools | Read, Grep, Bash |
AI code is 1.7x buggier. These 5 checks catch 80% of issues.
Load this skill for any review, validation, or implementation work.
Verbose research: skills/quality/reference/quality-research.md
Every endpoint has Zod/Pydantic schema. Parameterized queries only.
Handle: null, empty array, zero-length string, timeout, unicode.
No empty catch. Errors logged with context. User messages generic.
Same logic in 3+ places = extract to utility.
Functions under 30 lines. No nested ternaries > 2 levels.
<quick_checks>
grep -r "req\.body" --include="*.ts" --include="*.js" | grep -v "parse\|validate\|z\." | head -5
grep -r "catch.*{}" --include="*.ts" --include="*.js" | head -5
grep -rE "SELECT.*\$\{|INSERT.*\$\{" --include="*.ts" --include="*.js" | head -5
</quick_checks>
Any Big 5 violation = NOT READY
Fix before commit. No exceptions.
<r_factor>
Composite quality score replacing binary pass/fail.
R = (0.20 * test_pass_rate) +
(0.20 * acceptance_rate) +
(0.15 * scope_accuracy) +
(0.15 * security_clean_rate) +
(0.15 * budget_compliance) +
(0.15 * first_try_rate)
Range: 0.0 to 1.0
thresholds:
>= 0.85: production-ready
>= 0.70: good (ship with monitoring)
>= 0.50: acceptable (ship with caveats)
< 0.50: not ready (fix before shipping)
rule: R-factor is informational, not a hard gate. Use thresholds as guidelines.
rule: Track R-factor over time to measure improvement, not as a one-time score.
reference: skills/quality/reference/quality-research.md (measurement definitions, usage notes)
</r_factor>
Proactive deviation detection. Don't wait for bugs — detect behavioral anomalies.
cycle:
anomaly: deviation from baseline (token spike, unusual files, scope creep)
detection: automated on every checkpoint (compare to historical averages)
suppression: block progression, alert human, quarantine work
recovery: critical = human review required. medium = auto-retry after fix
thresholds:
warning: > 1.5x baseline
anomaly: > 2x baseline
critical: > 3x baseline
rule: anomaly = pause and ask, not auto-abort.
rule: build baselines from at least 10 historical data points before enforcing.
reference: skills/quality/reference/quality-research.md (baselines, integration points)
<on_complete>
agentdb write-end '{"skill":"quality","big5_checked":true,"violations":N,"r_factor":0.00}'
</on_complete>