| name | quality-gates |
| description | Multi-pass quality system for critical outputs. Implements RSI through generate-evaluate-refine loops for billing emails, contracts, customer notifications, and technical documentation. |
| version | 1.0.0 |
| author | CircleTel Engineering |
Quality Gates
"Ship quality, not quantity. Every output should meet a measurable standard."
This skill implements RSI (Recursive Self-Improvement) through multi-pass quality loops. Critical outputs are generated, evaluated against rubrics, and refined until they meet quality thresholds.
When This Skill Activates
This skill activates when generating:
- Billing emails (invoices, payment reminders, receipts)
- Customer notifications (service updates, account alerts)
- Contracts and quotes (B2B documents)
- Technical documentation (API docs, architecture docs)
Keywords: quality, review, evaluate, refine, billing email, customer notification, contract, multi-pass, rubric
The Multi-Pass Quality Loop
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MULTI-PASS QUALITY SYSTEM โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ GENERATE โโโบ EVALUATE โโโบ REFINE โโโบ CHECK CONVERGENCE โ
โ โ โ โ โ โ
โ โ โ โ โ โ
โ โ โผ โ โ โ
โ โ SCORE < 8? โ โ โ
โ โ YES โโโโโโโโโโโโโ โ โ
โ โ โ โ โ
โ โ โ โโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ โ โ
โ โ โ โผ โ
โ โ โ PASSES < 3? โ
โ โ โ YES โโโบ LOOP BACK โ
โ โ โ โ โ
โ โ โ NO โ
โ โ โ โ โ
โ โโโโโโโโโโโโดโโโโโโโโโดโโโโโโโโโโโบ OUTPUT FINAL โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Quick Reference: Output Types
| Output Type | Min Score | Max Passes | Rubric |
|---|
| Billing Email | 8/10 | 3 | rubrics/billing-email.md |
| Customer Notification | 8/10 | 3 | rubrics/customer-notification.md |
| Contract | 9/10 | 3 | rubrics/contract.md |
| Technical Docs | 8/10 | 2 | rubrics/technical-docs.md |
How to Use
Automatic Activation
When generating a qualifying output, the skill activates:
User: "Generate a payment reminder email for customer ABC"
Claude: [Generates draft]
[Applies billing-email rubric]
[Scores: Clarity 9, Accuracy 10, Tone 7, Action 8, Compliance 9 = 8.5]
[Score >= 8, output final version]
Manual Quality Check
Use /quality-check to evaluate existing content:
/quality-check billing-email
Multi-Pass Example
PASS 1:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Generated: "Your invoice is attached. Pay soon."
Evaluation:
- Clarity: 6/10 (vague timing)
- Accuracy: 5/10 (no amount mentioned)
- Tone: 4/10 (too casual)
- Action: 5/10 (unclear CTA)
- Compliance: 8/10 (missing terms)
Total: 5.6/10 โ
PASS 2:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Refined: "Invoice #INV-2024-0042 for R799.00 is due by
February 28, 2026. Click below to pay securely via NetCash.
Questions? Reply to this email or WhatsApp 082 487 3900."
Evaluation:
- Clarity: 9/10 (specific date, amount)
- Accuracy: 10/10 (correct details)
- Tone: 8/10 (professional, friendly)
- Action: 9/10 (clear CTA)
- Compliance: 9/10 (proper format)
Total: 9.0/10 โ
Final output delivered.
Rubric Structure
Each rubric defines:
# Rubric: [Output Type]
**Target**: What this rubric evaluates
**Critical Score**: Minimum to pass (default 8/10)
**Max Passes**: Maximum refinement iterations (default 3)
## Criteria
| Criterion | Weight | Scoring Guide |
|-----------|--------|---------------|
| [Name] | [%] | 10=[best], 5=[average], 1=[worst] |
## Evaluation Prompt
[Template for self-evaluation]
## Convergence Rules
- Stop if score >= [threshold]
- Stop if passes >= [max]
- Stop if delta < 0.5 between passes
Convergence Rules
The loop stops when ANY of these conditions are met:
- Quality Threshold: Score >= minimum required (usually 8/10)
- Max Passes: 3 iterations completed (prevents infinite loops)
- Diminishing Returns: Improvement < 0.5 points between passes
Integration with Billing Service
For billing emails, integrate with lib/billing/paynow-billing-service.ts:
const email = await generatePaymentReminder(customer, invoice)
const qualityScore = await evaluateWithRubric(email, 'billing-email')
if (qualityScore < 8) {
const refined = await refineOutput(email, qualityScore.feedback)
}
Directory Structure
quality-gates/
โโโ SKILL.md # This file
โโโ rubrics/ # Quality criteria per output type
โ โโโ billing-email.md
โ โโโ customer-notification.md
โ โโโ contract.md
โ โโโ technical-docs.md
โโโ evaluators/ # Evaluation prompts
โ โโโ default-evaluator.md
โโโ history/ # Pass history (optional)
โโโ YYYY-MM-DD_output-type.md
Best Practices
- Trust the rubric - Don't skip evaluation for "simple" outputs
- Don't over-refine - If score is 8+, ship it
- Log passes - Track which outputs need multiple passes
- Update rubrics - Add new criteria as patterns emerge
- Check compliance - Especially for billing and contracts
RSI Feedback Loop
Quality gates connect to the broader RSI system:
QUALITY ISSUE DETECTED
โ
โผ
MULTIPLE PASSES NEEDED โโโบ PATTERN?
โ โ
โ โผ
โ ADD TO error-registry
โ (if recurring)
โ โ
โ โผ
โ UPDATE rubric
โ (add new criterion)
โ โ
โโโโโโโโโโโโโโโโโโโโโโโ
IMPROVEMENT
Version: 1.0.0
Last Updated: 2026-02-12
For: CircleTel critical outputs
RSI Integration: error-registry, compound-learnings