con un clic
qa-quarto
// Adversarial QA workflow comparing Quarto HTML against Beamer PDF benchmark. Iterates between critic (finds issues) and fixer (applies fixes) until APPROVED or max iterations reached.
// Adversarial QA workflow comparing Quarto HTML against Beamer PDF benchmark. Iterates between critic (finds issues) and fixer (applies fixes) until APPROVED or max iterations reached.
| name | qa-quarto |
| description | Adversarial QA workflow comparing Quarto HTML against Beamer PDF benchmark. Iterates between critic (finds issues) and fixer (applies fixes) until APPROVED or max iterations reached. |
| disable-model-invocation | true |
| argument-hint | [LectureN, e.g., Lecture6] |
| allowed-tools | ["Read","Bash","Task","Grep","Glob"] |
Compare Quarto HTML slides against their Beamer PDF benchmark using an iterative critic/fixer loop.
Philosophy: The Beamer PDF is the gold standard. The Quarto translation must be at least as good in every dimension. The critic assumes Quarto is guilty until proven innocent.
┌─────────────────────────────────────────────────────────────┐
│ /qa-quarto LectureX │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Phase 0: Pre-flight Verification │
│ • Verify Beamer PDF exists and is recent │
│ • Verify Quarto HTML exists and is recent │
│ • Check file freshness (modification times) │
└─────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Phase 1: Initial Audit (quarto-critic agent) │
│ • Compare Beamer vs Quarto comprehensively │
│ • Check hard gates (overflow, content parity, etc.) │
│ • Produce detailed report with actionable fixes │
│ • May delegate to sub-agents (e.g. slide-auditor) │
└─────────────────────────────────────────────────────────────┘
│
▼
┌───────────────┐
│ Verdict? │
└───────────────┘
/ \
APPROVED NEEDS REVISION / REJECTED
│ │
▼ ▼
┌─────────────────────┐ ┌─────────────────────────────────────┐
│ Done! │ │ Phase 2: Fix Cycle (quarto-fixer) │
│ Save final report │ │ • Apply critical issues first │
│ Celebrate 🎉 │ │ • Then major, then minor │
└─────────────────────┘ │ • Re-render slides │
│ • Verify fixes compiled │
└─────────────────────────────────────┘
│
▼
┌─────────────────────────────────────┐
│ Phase 3: Re-Audit (quarto-critic) │
│ • Check if fixes worked │
│ • Update verdict │
│ • Identify any new issues │
└─────────────────────────────────────┘
│
▼
┌───────────────┐
│ Verdict? │
└───────────────┘
/ \
APPROVED NEEDS REVISION
│ │
▼ │
┌─────────────────┐ │
│ Done! │ │
└─────────────────┘ │
│
┌─────────┘
│ (Loop back to Phase 2)
│ Max 5 iterations
▼
┌─────────────────────────┐
│ After 5 rounds: │
│ Escalate to user with │
│ remaining issues │
└─────────────────────────┘
These conditions MUST pass for APPROVED verdict:
| Gate | Condition | Consequence if Failed |
|---|---|---|
| Overflow | NO content cut off or requiring scroll | REJECTED |
| Plot Quality | Plotly charts ≥ Beamer static plots in readability | REJECTED |
| Content Parity | No missing slides, equations, or key text | REJECTED |
| Visual Regression | Quarto ≥ Beamer in all visual dimensions | REJECTED |
| Slide Centering | Content centered, no jumping between slides | REJECTED |
Before launching the critic, verify the inputs exist:
Parse $ARGUMENTS to determine lecture number (e.g., "Lecture6" → 6).
Find the files:
Slides/Lecture0X_Topic.pdf or Slides/LectureX_Topic.pdfSlides/Lecture0X_Topic.tex or Slides/LectureX_Topic.texQuarto/LectureX_Topic.qmddocs/slides/LectureX_Topic.html# Example file discovery
ls -la Slides/Lecture*$ARGUMENTS*.tex Slides/Lecture*$ARGUMENTS*.pdf 2>/dev/null
ls -la Quarto/Lecture*$ARGUMENTS*.qmd 2>/dev/null
ls -la docs/slides/Lecture*$ARGUMENTS*.html 2>/dev/null
Compare modification times:
./scripts/sync_to_docs.sh $ARGUMENTS
ls -la Figures/Lecture*$ARGUMENTS*/tikz_exact_*.svg 2>/dev/null
If SVGs exist, they should match the current Beamer source (this is checked in detail by the critic).
Launch the quarto-critic agent with the Task tool:
Launch quarto-critic agent to compare:
- Beamer source: Slides/LectureXX_Topic.tex
- Quarto source: Quarto/LectureX_Topic.qmd
- This is Round 1
Produce report at: quality_reports/LectureX_Topic_qa_critic_round1.md
Wait for the critic to finish and produce a verdict:
Launch the quarto-fixer agent with the Task tool:
Launch quarto-fixer agent to:
- Read critic report: quality_reports/LectureX_Topic_qa_critic_round[N].md
- Apply fixes to: Quarto/LectureX_Topic.qmd
- Re-render slides
- This is Round [N]
Produce report at: quality_reports/LectureX_Topic_qa_fixer_round[N].md
Wait for the fixer to finish.
Launch the quarto-critic agent again:
Launch quarto-critic agent to:
- Re-compare after fixes from Round [N]
- Check if fixes resolved the issues
- Identify any new issues introduced
- This is Round [N+1]
Produce report at: quality_reports/LectureX_Topic_qa_critic_round[N+1].md
Check verdict and loop back to Phase 2 if needed.
| Round | Action |
|---|---|
| 1 | Initial audit |
| 2 | First fix cycle + re-audit |
| 3 | Second fix cycle + re-audit |
| 4 | Third fix cycle + re-audit |
| 5 | Fourth fix cycle + re-audit |
| 6+ | STOP — Escalate to user |
After 5 fix rounds (6 total critic rounds), if still not APPROVED:
After APPROVED verdict (or escalation), create final summary:
Save to: quality_reports/[Lecture]_qa_final.md
# QA Final Report: [Lecture Name]
**Status:** APPROVED / ESCALATED TO USER
**Total rounds:** [N]
**Date:** [YYYY-MM-DD]
## Files Audited
- Beamer: `Slides/LectureXX_Topic.tex`
- Quarto: `Quarto/LectureX_Topic.qmd`
- HTML: `docs/slides/LectureX_Topic.html`
## Hard Gate Status (Final)
| Gate | Status |
|------|--------|
| Overflow | ✅ |
| Plot Quality | ✅ |
| Content Parity | ✅ |
| Visual Regression | ✅ |
| Slide Centering | ✅ |
## Iteration Summary
| Round | Critic Verdict | Issues (C/M/m) | Fixer Status |
|-------|---------------|----------------|--------------|
| 1 | NEEDS REVISION | 3/5/2 | Fixed 3C, 4M |
| 2 | NEEDS REVISION | 0/2/3 | Fixed 2M |
| 3 | APPROVED | 0/0/2 | — |
## Issues Resolved
[Summary of all issues found and fixed]
## Remaining Issues (if escalated)
[List of issues user needs to address]
## Quality Metrics
- Beamer frames: [N]
- Quarto slides: [M]
- Content parity: [%]
- CSS environments: [all present / missing X]
- Plotly charts: [count]
- TikZ SVGs: [count]
All reports saved to quality_reports/:
| Report | Purpose |
|---|---|
LectureX_qa_critic_round1.md | Initial audit findings |
LectureX_qa_fixer_round1.md | First fix application |
LectureX_qa_critic_round2.md | Re-audit after fixes |
LectureX_qa_fixer_round2.md | Second fix application |
| ... | ... |
LectureX_qa_final.md | Final summary |
At each phase, inform the user:
Example messages:
If critic takes too long:
If render fails:
If fixer reports "fixed" but critic still finds issue:
Escalate with full context:
Convert a PDF (or any document) to clean markdown so Claude can read it efficiently. Tries Microsoft MarkItDown first; falls back to OpenDataLoader-PDF for complex layouts (multi-column papers, dense tables, math). Use when user says "convert this PDF", "make this document readable", "turn paper.pdf into markdown", "preprocess this document", or before reading any PDF for analysis.
Enforce the replication-protocol.md rule by cross-checking numeric claims in a manuscript against the actual R / Stata / Python outputs. Report PASS/FAIL per claim against tolerance thresholds. Use before submission and before releasing a replication package.
Comprehensive slide excellence review combining visual audit, pedagogical review, and proofreading. Produces three reports and a combined summary.
Run holistic pedagogical review on lecture slides. Checks narrative arc, PhD student prerequisites, worked examples, notation clarity, and deck pacing.
Perform adversarial visual audit of Quarto or Beamer slides checking for overflow, font consistency, box fatigue, and layout issues.