exam-cheatsheet-builder

Builds, formats, verifies, audits, and exports exhaustive, high-yield exam cheatsheets and revision materials from lecture slides, PDFs, and exercise banks. Enforces strict zero-table formatting (Canva clipboard ready), zero LaTeX dollar signs (preventing clipboard text doubling bugs), punchy single-sentence explanations, step-by-step arithmetic calculations, ~1,200-line (1-page) to ~2,500-line (2-page) master markdown depth targets, automated assembly, inter-step slide parity & regression audit scripts, a mandatory 100% content-coverage gate (every slide term verified in the cheatsheet), and mandatory zero-loss fixed-page A4 PDF packing (default 1 page, minimum 3.0pt font via binary-searched font sizing). Use whenever creating or updating exam cheatsheets, study guides, formula cards, slide solution banks, or printable cram-sheet PDFs ("make this md a 1-page PDF", "make this md a 2-page PDF", "fit all of it on N pages", "ทำชีทสอบ", "ย่อให้เหลือ 1 หน้า").

¿Qué es exam-cheatsheet-builder?

exam-cheatsheet-builder is a Claude Code agent skill that builds, formats, verifies, audits, and exports exhaustive, high-yield exam cheatsheets and revision materials from lecture slides, PDFs, and exercise banks. Enforces strict zero-table formatting (Canva clipboard ready), zero LaTeX dollar signs (preventing clipboard text doubling bugs), punchy single-sentence explanations, step-by-step arithmetic calculations, ~1,200-line (1-page) to ~2,500-line (2-page) master markdown depth targets, automated assembly, inter-step slide parity & regression audit scripts, a mandatory 100% content-coverage gate (every slide term verified in the cheatsheet), and mandatory zero-loss fixed-page A4 PDF packing (default 1 page, minimum 3.0pt font via binary-searched font sizing). Use whenever creating or updating exam cheatsheets, study guides, formula cards, slide solution banks, or printable cram-sheet PDFs ("make this md a 1-page PDF", "make this md a 2-page PDF", "fit all of it on N pages", "ทำชีทสอบ", "ย่อให้เหลือ 1 หน้า").

Compatible con~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Triple3Pww/exam-cheatsheet-builder/tree/HEAD

Installed? Explore more Productividad y colaboración skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Exam Cheatsheet Builder

A systematic, production-grade skill for turning complex lecture slide decks, syllabus PDFs, and problem sets into exhaustive, high-density exam cheatsheets optimized for quick memorization, exam-room retrieval, and flawless Canva copy-pasting.


Core Tenets & Non-Negotiable Constraints

  1. Zero Markdown Tables (| ... |):
    • Why: Markdown tables break column alignment, wrap awkwardly, and overflow when pasted into Canva text boxes (T).
    • Enforcement: All tabular comparisons must be converted into clean hierarchical bullet points with bold sub-keys or monospace formatted blocks.
  2. Zero LaTeX Dollar Signs ($ / $$):
    • Why: Browser clipboard rendering copies both raw LaTeX and formatted math (the notorious p=17 p=17 duplication bug).
    • Enforcement: Use plain Unicode math symbols (mod, ^, *, /, XOR, !=, <=, >=, ->, ~=). Never include literal $ characters anywhere in output files (use %VAR% or [VAR] for code/env variables).
  3. Punchy, Single-Sentence Bullet Format:
    • Why: Multi-clause paragraphs and narrative fluff reduce scan speed during timed exams.
    • Enforcement: Every concept must be expressed in 1-2 concise, high-yield sentences: - **Term / Concept:** Clear, direct definition and key mechanism.
  4. Complete Step-by-Step Calculation Walkthroughs:
    • Why: Students need exact arithmetic steps in the exam room to verify intermediate numbers.
    • Enforcement: Show full divisions, quotients, remainders, bit-by-bit truth tables, matrix lookups, and memory offset formulas.
  5. No Exercise Shadowing / Numbering Collisions:
    • Why: Inserting newly discovered slide exercises into existing numbering can accidentally overwrite original exercises.
    • Enforcement: Always append and reconcile against the canonical source database; maintain strict sequential ordering across all modules.

The 6-Phase End-to-End Workflow (with Inter-Step Slide Parity Gates)

[Phase 1: Discovery]   --> Extract slide text + render visual/diagram/handwritten slides via pymupdf
  |-- Gate 1->2: Confirm image-only, table, and diagram slides were visually inspected
[Phase 2: Drafting]    --> Write modular chapters (~280-350 lines/deck; ~2,500 lines full course)
[Phase 3: Solutions]   --> Detail full step-by-step walkthroughs for all slide exercises & examples
  |-- Gate 3->4: Audit every intermediate step & slide number against source slides before assembly
[Phase 4: Assembly]    --> Automatically build MASTER, ALL-IN-ONE, and EXERCISE BANK compilations
[Phase 5: Audit]       --> Run automated regex + slide-parity audit (0 tables, 0 dollars, 100% slide match)
  |-- Gate 5->6: 100% CONTENT-COVERAGE GATE -- every slide term is in the cheatsheet or waived with a reason
[Phase 6: PDF Export]  --> ALWAYS pack compiled .md into fixed N-page A4 PDF (default 1 page) with 0 missing tokens

Two gates together prove zero loss end to end: the Coverage Gate proves slides -> cheatsheet is 100%; the Phase 6 completeness check proves cheatsheet -> PDF is 100%. A run is not done until both pass.


Phase 1: Material Discovery & Source Extraction

  1. Locate and Extract Slide PDFs (needs pip install pypdf pymupdf):
    python scripts/extract_slides.py --input-dir . --output-dir scratch/extracted_slides
    
    • Text: reads each slide's typed text layer (pypdf): headers, bullets, typed code, captions. It does not read text inside pictures (no OCR), and tables come out as flattened words without rows/columns.
    • Visuals: pymupdf reads each slide's drawing instructions and marks it ## Slide N [HAS IMAGE] when it has non-template pictures covering >= 5% of the slide, >= 3 non-template pictures (icon-built diagrams), >= 10 more drawn shapes than the deck's typical slide (PowerPoint-shape diagrams), or no text at all. The logo/background is ignored automatically (any image on >= 50% of slides).
    • Every [HAS IMAGE] slide is rendered to scratch/extracted_slides/<deck>_images/slide_NNN.png, and the summary lists them all.
    • Why it over-flags on purpose: decorative stock photos get flagged too. One extra look costs seconds; a missed diagram costs exam marks. (Tested on 2 real decks, 112 slides: 0 diagrams missed.)
    • If it prints WARNING: pymupdf not found, stop and install it. Without it, no visual slide is detected and the Coverage Gate cannot protect diagrams.
  2. Visual Inspection Gate (Before Phase 2 Drafting):
    • Open every PNG listed under Slides With Visual Content [HAS IMAGE], and capture its diagram labels, arrows/flow order, numbers, screenshot data, and handwritten notes into the module as bullets or steps.
    • For each one, add an (image) line to Cheatsheet/coverage_waivers.md saying what it showed and where you captured it (the Coverage Gate fails without it).
    • Tables are not auto-detected. When a slide's extracted text reads like a grid (repeated short cells, ✓/✗ columns), open that slide in the PDF and rebuild the table as hierarchical bullets.
  3. Parse Ground-Truth Exercise Tables:
    • Check for existing CSV or question dumps (Canva_CSV/*Exercises*.csv).
    • Create a single master checklist of every question, slide reference number, and expected solution.

Phase 2: Modular Chapter Drafting & Formatting

Draft each lecture module as an independent file (01_Lecture1...md to 08_Lecture8...md).

  • Follow the formatting rules and depth standards in references/formatting_rules.md.
  • Target Line-Count & Exhaustiveness Note (~1,200 lines for 1-page / ~2,500 lines for 2-page):
    • Target ~1,200 lines in MASTER_EXAM_CHEATSHEET.md when packing onto 1 A4 landscape page at >= 3.0pt (e.g., ~600 lines/deck for 2-deck sets), or ~2,500 lines (~280–350 lines per module across 7–8 decks) for 2 A4 landscape pages.
    • Achieve target line depth through high-density coverage and hierarchical decomposition, never narrative fluff:
      • Convert every slide table into one hierarchical sub-bullet per attribute (instead of packing 6 attributes onto one semicolon-separated line).
      • Include complete code snippets, CLI/Docker commands, configuration XML/rules, protocol step-by-step message flows, and exact numbers/thresholds/dates from every slide (render image-only diagram/code slides with pymupdf if extract_slides.py returns blank text).
      • Turn every slide example, case study, and in-class activity into a numbered ### Exercise X.Y block with full trace steps.
      • Keep 2-space nested indentation (- Parent -> - Child -> - Subchild) so CommonMark renders nested lists cleanly both in Markdown and inline in Phase 6 PDFs.
  • Structure each chapter into:
    • Top header with Canva copy-paste guide note.
    • Numbered concept sections covering all slide topics.
    • Dedicated final section: ## N. Worked Slide Exercises & Verified Solutions (Lecture X).

Example Concept Bullet:

- **Base & Bounds Registers (Dynamic Relocation):**
  - **Base Register:** Stores the physical starting address of the active user process in RAM.
  - **Bounds (Limit) Register:** Stores the maximum allowable memory length allocated to the process.
  - **Hardware Check:** MMU verifies `0 <= Logical Address < Bounds`; if valid, computes `Physical Address = Base + Logical Address`; if invalid, triggers a segmentation fault trap.

Phase 3: Detailed Step-by-Step Exercise Engineering

For every calculation or conceptual exercise:

  1. Provide the exact problem statement and slide reference ((Slide Z) or (Slides X-Y)).
  2. Follow standard derivation templates from references/calculation_templates.md.
  3. Walk through all arithmetic and state transitions step-by-step:
    • Modulo Arithmetic: Show dividend, divisor, quotient, remainder, and positive wrap for negative numbers (-3 mod 26 = 23).
    • Bitwise XOR: Show 8-bit or 48-bit binary truth tables with bit-by-bit evaluations.
    • S-Box Lookups: High nibble (row hex) and low nibble (column hex) coordinate mapping.
    • Memory Layouts: Exact byte offsets (Buffer + Padding + Saved EBP = Offset to EIP).
    • Network/Switching Traces: Show every intermediate hop, port, VCI/VPI swap, MAC table snapshot, stream order, and step letter (a, b, c...) matching the slide diagram.
  4. End with a bold Verified Final Answer block for rapid verification.
  5. Inter-Step Parity Gate (Before Phase 4 Assembly):
    • Cross-check each module against scratch/extracted_slides/*_extracted.md and rendered slide PNGs (python scripts/audit_cheatsheet.py --dir Cheatsheet/ --slides-dir scratch/extracted_slides) before assembling master files; resolve any missing numbers, diagram labels, or step mismatches first.

Phase 4: Automated Cheatsheet Assembly

Never manually copy-paste chapters into the master files; always use the automated assembly script to guarantee 100% synchronization:

python scripts/assemble_cheatsheet.py --input-dir Cheatsheet/

Outputs generated:

  • MASTER_EXAM_CHEATSHEET.md: Full combined cheatsheet across all modules.
  • ALL_IN_ONE_MASTER_CHEATSHEET.md: Mirror copy for different export targets.
  • ALL_SLIDE_EXERCISES_AND_SOLUTIONS.md: Dedicated problem bank containing all worked exercises and calculations.

Phase 5: Deep Regression & Slide-Parity Audit

Run the automated verification script to validate every file against formatting constraints, exercise step structure, and slide-by-slide parity before delivering to the user:

python scripts/audit_cheatsheet.py --dir Cheatsheet/ --slides-dir scratch/extracted_slides --strict-slides

Verification Checklist:

  • Table line count == 0 (| ... | check).
  • Dollar sign count == 0 ($ check).
  • Every canonical exercise from source CSVs / flagged slides is present, sequentially numbered, and includes Slide Ref + Problem Statement + Step-by-Step walkthrough + Verified Final Answer.
  • Every non-boilerplate slide's key technical terms, numbers, units, and diagram/handwritten values match the cheatsheet (--slides-dir audit).
  • No dropped or shadowed exercises.
  • Compiled MASTER_EXAM_CHEATSHEET.md meets depth target (~2,500 lines for full multi-lecture courses, unless user requests a shorter summary or fewer decks).
  • Always pass --strict-slides so numeric/acronym gaps fail the audit instead of printing [INFO].

Gate 5->6: 100% Content-Coverage Verification (Mandatory)

Why: The Phase 5 slide-parity audit only checks numbers and ALL-CAPS acronyms, so a dropped concept like "Kerckhoffs" or "avalanche effect" passes silently. This gate checks every content term on every slide against the compiled cheatsheet, so "100% of the content is in the cheatsheet" is measured, not assumed.

python scripts/verify_coverage.py --slides-dir scratch/extracted_slides \
    --cheatsheet Cheatsheet/MASTER_EXAM_CHEATSHEET.md \
    --waivers Cheatsheet/coverage_waivers.md \
    --report scratch/coverage_report.md

What it checks:

  • Every number, acronym, and non-stopword word (>= 4 letters, lightly stemmed so encrypts matches encryption) on each slide must appear in the compiled cheatsheet.
  • Every [HAS IMAGE] slide and every no-text slide must carry an (image) waiver, which is your written confirmation that you opened its PNG, inspected it, and captured its content. Text extraction cannot see diagrams, so this cannot be skipped. [HAS IMAGE] slides are also text-checked: the waiver covers the picture, not the typed words.
  • Only quote-of-the-day / break / good-luck / related-video slides are skipped automatically, and each skip is listed in the report.
  • Exits 1 unless coverage is 100.00% with 0 incomplete slides.

Fixing a failure: for each missing term, either (a) add the fact to the cheatsheet (the default; this is what the gate exists for), or (b) waive it in Cheatsheet/coverage_waivers.md only when it is truly not exam content, with the reason after --:

- Lecture3 slide 12: (image) -- Feistel round diagram inspected, captured in Exercise 3.4
- Lecture3 slide 7: instructor, office, hours -- admin info, not exam content
- * slide *: copyright, reserved -- footer on every slide
  • Never waive a term just to make the gate pass. Waiving a real concept reintroduces the exact loss this gate prevents.
  • Re-run until [COVERAGE PASSED], then re-run Phase 4 assembly if you edited modules, and re-run the gate on the fresh MASTER.
  • Delete any waiver the script flags as [WARN] ... matched nothing (stale?).
  • Thai-script words are not auto-tokenized. Check Thai-only slide text visually and waive it as (image) with a note.

Report to the user: Coverage: 100.00% | N content terms | X in cheatsheet | Y waived, plus the list of waived terms so they can see what was left out and why.


Phase 6: Zero-Loss Fixed-Page A4 PDF Export (Mandatory)

Always finish by packing the compiled Markdown into an N-page A4 PDF with zero information loss using scripts/build_cheatsheet_pdf.py. Do this even if the user didn't ask for a PDF: the printable sheet is the deliverable, and its completeness check is the second half of the zero-loss proof. Use the user's page budget when given ("make this md a 1-page PDF", "fit all of it on 2 pages", "ย่อให้เหลือ 1 หน้า"); otherwise default to --pages 1, and step up to --pages 2 only when 1 page cannot fit at the 3.0pt floor:

python scripts/build_cheatsheet_pdf.py Cheatsheet/MASTER_EXAM_CHEATSHEET.md --pages 1

How It Works (markdown-it-py + pymupdf + headless Chrome/Edge):

  1. CommonMark Parsing (markdown-it): Preserves 2-space nested lists and code fences inside lists (unlike python-markdown).
  2. Dense Multi-Column Packing: Uses Arial Narrow, pre-wrap + word-break: break-all code blocks, and inline nested lists (parent ▸ child • subchild) with literal ordered-list numbers (1.).
  3. Binary-Search Font Sizing: Searches --min-font (default 3.0pt) to --max-font (9.0pt) in 0.05pt steps for the largest font size that fits strictly within --pages N.
  4. Word-for-Word Completeness Gate: Counts every alphanumeric token in the Markdown source and verifies 0 missing tokens in the rendered PDF text (exits 1 if anything is missing).

Key Flags:

  • --pages N (default 1): Target page budget.
  • --cols N (default 5): 5 columns suits A4 landscape (~1,200-line cheatsheets fit on 1 page at >= 3.0pt; ~2,500-line cheatsheets fit on 2 pages at ~3.0–3.5pt); try 6 if it barely overflows, or 3–4 with --portrait.
  • --min-font (default 3.0): Enforces minimum 3.0pt font floor so printouts stay legible.
  • --portrait: Switch from A4 landscape (default) to A4 portrait.
  • --line-height (default 1.07): Raise only if there is vertical slack.
  • --drop-blockquotes: Omit > meta notes (e.g., Canva copy-paste banners) ONLY when they hold no exam facts—always report to the user what was dropped.

Post-Export Verification & User Handoff:

  • Confirm completeness: X source tokens, 0 missing before reporting success. A non-zero count or exit 1 means the run is not done: fix it (more pages, --cols 6, or tighter source) and rebuild.
  • If --drop-blockquotes was used, first confirm the dropped > notes hold no slide content (re-run the Coverage Gate against the cheatsheet with the blockquotes removed), so the PDF is still 100% of the slide content.
  • Render a 300-dpi crop via pymupdf (page.get_pixmap(dpi=300, clip=Rect(...))) and visually inspect to catch glyph/CSS glitches.
  • Tell the user the final font size (e.g., 3.49pt), page orientation (A4 landscape or portrait), and instruct them to print at 100% / Actual size (fit-to-page shrinks text further).

Editor Buffer Caching Notice

When external scripts update master cheatsheet files, open editor tabs (VS Code, Notepad, browser previews) may retain cached memory buffers:

  • Instruct the user to close and reopen the file tab or reload their editor to see updated line counts and contents.

Skills relacionados