math-video-tutor
Skill5 starsChanged 3 months agoApache-2.0View on GitHub
Generate teaching video explanations for elementary math problems. Takes a math problem (with answer and solution steps) and produces a 2-3 minute MP4 video with dark-themed slides and TTS narration, suitable for 5th graders. Use when asked to create math teaching videos, explain math problems to kids, or generate video tutorials for math exercises. Supports batch processing for multiple questions.
In this repository54 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- agent-teamsSkill
- bilibili-channelSkill
- bot-configSkill
- browser-cliSkill
- bwrap-bypassSkill
- cc-pages-backupSkill
- chat-styleSkill
- chinese-dictationSkill
- code-wiki-reconSkill
- deck-builderSkill
- docx-form-fillerSkill
- evolutionSkill
- explainer-distillSkill
- feishu-bitableSkill
- feishu-docSkill
- feishu-mailSkill
- feishu-sheetSkill
- feishu-user-msgSkill
- fireworks-tech-graphSkill
- frontend-slidesSkill
- gemini-ui-reviewerSkill
- hk-busSkill
- hk-share-award-tax-dipn38Skill
- imagen-generatorSkill
- issue-handlerSkill
- lecture-videoSkill
- lecture-voiceSkill
- lesson-read-aloudSkill
- live-canvasSkill
- lustre-mounterSkill
- manim-teaching-figuresSkill
- memory-gcSkill
- memory-lintSkill
- multimodal-explainerSkill
- music-generatorSkill
- notifySkill
- page-styleSkill
- paper-explainerSkill
- session-handoffSkill
- skill-creatorSkill
- smoke-testSkill
- study-materialSkill
- tmux-installerSkill
- tmux-orchestratorSkill
- tpuguruSkill
- tts-generatorSkill
- veo-generatorSkill
- vscode-referenceSkill
- weather-forecastSkill
- wechat-readerSkill
- wikiSkill
- youtube-channelSkill
- zsh-installerSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 3 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
Write a 500-1500 character teaching script as if speaking to a 5th grader:
- Distinctive: line 31
Read the problem aloud with natural phrasing
- Very specific: line 42
Use highlight classes in content_html: hl-blue (given values), hl-green (intermediate), hl-amber (key quantities), hl-rose (answers), …
- Distinctive: line 125
When a problem involves visual/spatial concepts, the slides MUST include actual SVG diagrams — text descriptions alone are NOT sufficient.
- Very specific: line 140
Create slides with inline <svg> elements in the slide content
- Very specific: line 141
Use the same color scheme: #38bdf8 (blue), #34d399 (green), #fb7185 (rose), #a78bfa (purple), #fbbf24 (amber)
- Very specific: line 142
Use .two-col layout for diagram + text side-by-side:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Math Video Tutor
Generate teaching videos from math problems: dark-themed animated slides + TTS voice narration → MP4.
Pipeline
Math problem → [Claude generates content] → JSON + narration.txt
→ gen_slides.py → HTML slides
→ screenshot_slides.js → PNG sequence (1920×1080)
→ tts-generate.py (charon voice) → OGG audio
→ compose_video.sh (ffmpeg) → MP4 video
→ gcloud storage cp → CC Pages URLStep-by-Step Workflow
Step 1: Generate Content (Claude)
For each math problem, generate two files:
1a. Narration script (content/q{N}_narration.txt)
Write a 500-1500 character teaching script as if speaking to a 5th grader:
- Start with "同学们,我们来看第N题"
- Read the problem aloud with natural phrasing
- Walk through each step, explaining WHY not just WHAT
- State the answer clearly
- End with a method summary
1b. Slides JSON (content/q{N}_slides.json)
See references/slides-schema.md for the full schema.
Key fields: q_num, topic, problem_text, answer, steps[] (3-5 steps with badge, title, content_html), summary_when, summary_how, tip.
Use highlight classes in content_html: hl-blue (given values), hl-green (intermediate), hl-amber (key quantities), hl-rose (answers), hl-purple (totals). Wrap math in <div class="math-block">.
Step 2: Run the Pipeline
Single question:
SKILL_DIR=~/.claude/skills/math-video-tutor/scripts
WORKDIR=/tmp/math-video
# Generate HTML slides
python3 $SKILL_DIR/gen_slides.py content/q1_slides.json slides/q1_slides.html
# Screenshot
node $SKILL_DIR/screenshot_slides.js slides/q1_slides.html slides/q1/
# TTS
NARRATION=$(cat content/q1_narration.txt | tr '\n' ' ')
OGG=$(~/.claude/skills/tts-generator/scripts/tts-generate.py \
--voice charon "[温和亲切,像老师给小学生讲题] $NARRATION")
cp "$OGG" audio/q1_narration.ogg
# Compose video
bash $SKILL_DIR/compose_video.sh slides/q1/ audio/q1_narration.ogg videos/q01_explanation.mp4Batch (all questions):
bash $SKILL_DIR/batch_process.sh /tmp/math-video 1 25Step 3: Upload to CC Pages
gcloud storage cp videos/q01_explanation.mp4 \
gs://chris-pgp-host-asia/cc-pages/assets/video-name.mp4URL: https://cc.higcp.com/assets/video-name.mp4
Step 4: Embed in HTML (optional)
<div class="video-player">
<div class="video-label">🎬 視頻講解</div>
<video controls preload="none">
<source src="https://cc.higcp.com/assets/video-name.mp4" type="video/mp4">
</video>
</div>Parallelization
For batch content generation, use the Agent tool to spawn 4 agents, each handling a range of questions (e.g., Q1-6, Q7-12, Q13-18, Q19-25). Each agent writes content/q{N}_slides.json + content/q{N}_narration.txt.
Then run batch_process.sh which handles TTS and video composition with 4-way parallelism internally.
Dependencies
- playwright (npm) + chromium — slide screenshots
- ffmpeg — video composition
- tts-generator skill — TTS audio (Gemini Flash,
charonvoice) - gcloud CLI — upload to GCS/CC Pages
- Noto Sans SC font — loaded via Google Fonts CDN in slide HTML
Scripts
| Script | Purpose |
scripts/gen_slides.py | JSON → HTML slide deck |
scripts/screenshot_slides.js | HTML → PNG screenshots (Playwright) |
scripts/compose_video.sh | PNGs + audio → MP4 (ffmpeg) |
scripts/batch_process.sh | Full pipeline for a range of questions |
Slide Design
- Dark theme:
#0f172abase, gradient backgrounds per slide type - 1920×1080 resolution, Noto Sans SC font
- 5 slide types: title, problem, step (N), answer, summary
- Color-coded math highlights, bottom gradient bar
- Step icons cycle through blue/purple/amber/green/rose
Visual Diagrams (CRITICAL)
When a problem involves visual/spatial concepts, the slides MUST include actual SVG diagrams — text descriptions alone are NOT sufficient. Students cannot understand these problems without seeing the figures.
When to include diagrams
- Venn diagrams (韦恩图/容斥原理): Draw overlapping circles with labeled regions and values
- Geometric figures: Draw shapes, angles, auxiliary lines
- Adjacency/coloring problems: Draw the regions/blocks showing which areas share borders
- Number lines, tables, grids: Render as SVG, not text
- Tree diagrams, flowcharts: For counting/probability problems
How to implement
For problems requiring diagrams, bypass gen_slides.py and write custom HTML directly:
- Copy the CSS from an existing generated slide deck (dark theme, 1920×1080)
- Create slides with inline
<svg>elements in the slide content - Use the same color scheme:
#38bdf8(blue),#34d399(green),#fb7185(rose),#a78bfa(purple),#fbbf24(amber) - Use
.two-collayout for diagram + text side-by-side:<div class="two-col"> <div class="col-diagram"><svg>...</svg></div> <div class="col-text"><div class="step-body">...</div></div> </div> - Include the diagram on multiple slides: first as a blank/partial version (with unknowns), then as a completed version (with answer filled in)
Example: Venn diagram slide
<svg viewBox="0 0 800 550" width="900" height="620">
<circle cx="320" cy="240" r="190" fill="rgba(56,189,248,0.12)" stroke="#38bdf8" stroke-width="3"/>
<circle cx="480" cy="240" r="190" fill="rgba(52,211,153,0.12)" stroke="#34d399" stroke-width="3"/>
<circle cx="400" cy="380" r="190" fill="rgba(251,113,133,0.12)" stroke="#fb7185" stroke-width="3"/>
<text x="400" y="290" font-size="42" fill="#fbbf24" font-weight="900" text-anchor="middle">x = ?</text>
</svg>Quality Checklist
- Narration uses natural spoken Chinese, not written style
- Numbers read aloud (两百零一, not 201)
- Each step explains reasoning, not just calculation
problem_textfits on one slide (abbreviate if needed)- 3-5 steps per problem (not too many, not too few)
- Tip uses memorable phrasing (rhyme or mnemonic)
- Visual problems MUST have SVG diagrams — never describe a figure with text only
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

