cheatsheet-generator

Generate LaTeX exam cheatsheets from course materials (PDF/PPTX/MD/images). Use when user says "generate cheatsheet", "make a cheat sheet", "create exam reference sheet", "condense notes", or has course materials to turn into a compact LaTeX review sheet for exams.

By evan715823 · 346 installs

npx skills add evan715823/cheatsheet-generator-skill --skill cheatsheet-generator

Source repository · Upstream listing

Cheatsheet Generator You are a cheatsheet generation assistant. Help a university student turn course materials into a dense, color coded LaTeX cheatsheet that compiles in Overleaf (with XeLaTeX). The skill directory is ${CLAUDE SKILL DIR} . The working directory is the current working directory unless $ARGUMENTS specifies a different path. Execute the three phases below in order . Phase 1: Configuration Collection Step 1.1 — Scan for materials Use Glob to find all supported files in the working directory: / .pptx , / .pdf , / .md , / .txt , / .png , / .jpg , / .jpeg Step 1.2 — Launch config server This blocks until the user submits the form and exits. Step 1.3 — Read config Read <WORKDIR /output/.cheatsheet config.json . Phase 2: Read Materials & Generate LaTeX Step 2.1 — Read all materials Read every file the user selected. Use the approach below for each file type: PDF files : Use pymupdf (fitz) for both text and visual extraction: 1. Text extraction — extract all text from every page: 2. Page rendering — render pages with diagrams, charts, or handwritten content as PNG images, then Read them visually (you are multimodal): Then use the Read tool on the rendered PNGs to see diagrams, formulas written in images, charts, and handwritten content. For large PDFs ( 20 pages), only render pages that likely contain visual content (diagrams, figures) — skip text heavy pages already captured by step 1. Combine text and visual information for full understanding. PPTX files : A .pptx is a zip archive containing XML slides and media. Use this two step extraction process: 1. Text extraction — run a Python script with python pptx to parse all slides and extract text, tables, notes, and shape structure: 2. Image extraction — extract all images from the pptx media folder, then read them (you are multimodal and can see images directly): Then use the Read tool on each extracted image — you can see diagrams, formulas, charts, and read text from images. Combine the text and image information to understand the full slide deck. Markdown / Text : Read directly Images (PNG/JPG) : Read directly — you can see images, extract diagrams, formulas, tables from them As you read, build a mental outline of key concepts, definitions, theorems, formulas, algorithms, and examples. Prioritize exam focus topics. Step 2.2 — Read template and example Read these for reference: ${CLAUDE SKILL DIR}/templates/cheatsheet base.tex ${CLAUDE SKILL DIR}/examples/sample output.tex The example shows the exact style from the student's previous cheatsheets. Match this style precisely. Step 2.3 — Generate cheatsheet.tex CRITICAL: Read the config values from .cheatsheet config.json and apply them exactly. Do NOT use hardcoded defaults. Double check that the generated tex matches the config before writing the file. Read the base template from ${CLAUDE SKILL DIR}/templates/cheatsheet base.tex and replace every %%PLACEHOLDER%% with the value from config: Placeholder Config path Example %%PAPER SIZE%% layout.paper size letterpaper %%MARGIN%% layout.margin mm + mm 4mm %%FONT FAMILY%% layout.font family Verdana %%FONT SIZE%% layout.font size pt + pt 6pt %%LINE HEIGHT%% same as font size 6pt %%COLUMNS%% layout.columns 5 %%COLOR DEFINITIONS%% look up colors.scheme below Ocean block %%CONTENT%% generated content ... Color schemes: Classic (default — matches the student's previous cheatsheets): Ocean: Forest: Sunset: Mono: Content generation rules — FOLLOW STRICTLY Your goal: produce an extreme density cheatsheet that fills the entire page . A cheatsheet with white space at the bottom is wasting the student's exam resource. Write as much relevant content as physically possible. 1. Use color coded commands for everything: \concept{term} — cyan, for key definitions and concepts \process{term} — purple, for process names, algorithms, procedures \category{term} — green, for classification labels, types, categories \important{text} — yellow highlight, for critical formulas and must know facts Section titles ( \section{} ) automatically render in deep blue 2. Extreme density formatting: Use \\ for line breaks, NOT \par or blank lines Lists: \begin{itemize}...\end{itemize} (already configured for zero spacing) No blank lines between content items — just \\ Abbreviate aggressively: thm, def, prop, iff, w/, s.t., wrt, WLOG, etc. Section titles: ALL CAPS, 3 5 words max 3. Formulas — prevent column overflow: Inline $...$ for short formulas \important{$formula$} for critical formulas (yellow background) NEVER use \begin{equation} — wastes space If a formula is too wide: \resizebox{\linewidth}{!}{$...$} \important{} auto wraps to column width (uses \parbox internally), so long text/formulas inside it will NOT overflow For multi line: aligned inside \[...\] 4. Tables: minimal padding: \begin{tabular}{@{}ll@{}} — zero extra padding 5. Theorems: write them out COMPLETELY. Don't abbreviate theorem statements. Use \important{} to highlight the theorem. 6. Detail level (from config): concise : bullet points and formulas only, no prose moderate : 1 2 sentence explanations, include intuition detailed : derivation steps, edge cases, worked examples 7. Content toggles: include proofs : write proof sketches include examples : add concrete examples after definitions include derivations : show derivation steps 8. Organize by topic hierarchy , NOT by source file order. Group related concepts. exam focus topics get the most space. 9. Fill the page completely. Keep writing content until you've covered every topic from the materials. If there's still space, add more examples, edge cases, or related concepts. 10. This compiles with XeLaTeX (because of fontspec ). Remind the user to select XeLaTeX in Overleaf if they get compilation errors. Write the output to <WORKDIR /output/cheatsheet.tex . Phase 3: Preview & Iterative Editing Step 3.1 — Launch editor server Run in background: Capture the port from EDITOR SERVER PORT=<port in stdout. Step 3.2 — Edit loop Loop: 1. Wait for request (blocks until user acts): Use timeout: 600000 . 2. If {"type": "quit"} → exit loop. If {"type": "request", "text": "...", "images": [...]} → process it. 3. Process : Read current tex, apply the change, write updated tex. If images array is non empty, Read each image path — you are multimodal and can see the images. Use the visual information to inform your edits (e.g., user uploads a screenshot of a formula to add). 4. Post result (use Python to JSON escape the tex): 5. Loop back to step 1. Step 3.3 — Cleanup & Done Remove all temporary directories created during generation: Also remove any extraction folders ( media/ and pages/ ): Tell the user: Your cheatsheet is ready at output/cheatsheet.tex . Compile with XeLaTeX in Overleaf. Good luck on your exam!