Evan715823/cheatsheet-generator-skill / skills/cheatsheet-generator
cheatsheet-generator
VerifiedGenerate 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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.7 KB |
| examples/sample_materials/test (1).pdf | binary | 62.0 KB |
| examples/sample_materials/test (2).pdf | binary | 62.7 KB |
| examples/sample_materials/test (3).pdf | binary | 69.9 KB |
| examples/sample_output.tex | other | 9.5 KB |
| examples/screenshots/example_1.png | binary | 1.4 MB |
| examples/screenshots/example_2.png | binary | 1.6 MB |
| examples/screenshots/example_3.png | binary | 1.3 MB |
| scripts/config_server.py | script | 3.6 KB |
| scripts/editor_server.py | script | 8.6 KB |
| templates/cheatsheet_base.tex | other | 1.8 KB |
| templates/config_form.html | other | 34.1 KB |
| templates/editor_ui.html | other | 27.1 KB |
scripts/config_server.py
View on GitHub"""Phase 1: Configuration collection server.
Serves a browser form for cheatsheet configuration.
On submit, writes .cheatsheet_config.json and exits.
"""
import argparse
import json
import os
import socket
import sys
import threading
import webbrowser
from flask import Flask, request, jsonify
app = Flask(__name__)
WORKDIR = ""
TEMPLATE_DIR = ""
def find_free_port():
"""Let OS assign a free port."""
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind(("127.0.0.1", 0))
return s.getsockname()[1]
def scan_files(workdir):
"""Scan workdir for supported material files."""
extensions = {".pptx", ".pdf", ".md", ".txt", ".png", ".jpg", ".jpeg", ".tex"}
files = []
for entry in sorted(os.listdir(workdir)):
ext = os.path.splitext(entry)[1].lower()
if ext in extensions:
files.append({"name": entry, "ext": ext.lstrip(".")})
return files
def get_ext_class(ext):
"""Map file extension to CSS class."""
mapping = {
"pptx": "ext-pptx",
"pdf": "ext-pdf",
"md": "ext-md",
"txt": "ext-txt",
"tex": "ext-txt",
"png": "ext-img",
"jpg": "ext-img",
"jpeg": "ext-img",
}
return mapping.get(ext, "ext-txt")
def build_file_list_html(files):
"""Build HTML for the file checkbox list."""
if not files:
return '<div style="color:#8b8fa3;padding:12px;">No supported files found in directory.</div>'
lines = []
for f in files:
css = get_ext_class(f["ext"])
lines.append(
f'<div class="file-item">'
f'<input type="checkbox" checked data-filename="{f["name"]}">'
f'<span>{f["name"]}</span>'
f'<span class="file-ext {css}">{f["ext"].upper()}</span>'
f"</div>"
)
return "\n".join(lines)
@app.route("/")
def index():
"""Serve the configuration form."""
template_path = os.path.join(TEMPLATE_DIR, "config_form.html")
with open(template_path, "r", encoding="utf-8") as f:
html = f.read()
files = scan_files(WORKDIR)
file_html = build_file_list_html(files)
html = html.replace("%%FILE_LIST%%", file_html)
return html
@app.route("/submit", methods=["POST"])
def submit():
"""Save config and schedule shutdown."""
config = request.get_json()
output_dir = os.path.join(WORKDIR, "output")
os.makedirs(output_dir, exist_ok=True)
config_path = os.path.join(output_dir, ".cheatsheet_config.json")
with open(config_path, "w", encoding="utf-8") as f:
json.dump(config, f, indent=2, ensure_ascii=False)
# Schedule exit after response is sent
threading.Timer(1.0, lambda: os._exit(0)).start()
return jsonify({"status": "ok"})
def main():
parser = argparse.ArgumentParser(description="Cheatsheet config server")
parser.add_argument("--workdir", required=True, help="Working directory with materials")
args = parser.parse_args()
global WORKDIR, TEMPLATE_DIR
WORKDIR = os.path.abspath(args.workdir)
TEMPLATE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "templates")
port = find_free_port()
url = f"http://127.0.0.1:{port}"
# Print port for Claude to capture
print(f"CONFIG_SERVER_PORT={port}", flush=True)
print(f"Opening {url}", flush=True)
# Delay browser open so the server is listening before the request arrives.
# Fixes blank page on macOS where the browser connects faster than Windows.
threading.Timer(1.0, lambda: webbrowser.open(url)).start()
app.run(host="127.0.0.1", port=port, debug=False, use_reloader=False)
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |