extract-tikz
Extract TikZ diagrams from Beamer `.tex` source, compile each to a standalone PDF, and convert to SVG with 0-based indexing. Use when user says "extract the tikz", "regenerate the diagrams", "rebuild the SVGs", "sync tikz to quarto", or after editing TikZ blocks in a Beamer deck that also has a Quarto mirror.
Unsigned, install at your own risk
UnverifiedThis skill has no cryptographic signature attached. We can't verify the contents match what the publisher intended.
Install this skill
No account required. Pick your tool, or use the command that detects it for you.
Run in your terminal. It detects your AI tool.
npx @skills-hub-ai/cli install claude-code-my-workflow-claude-extract-tikzManual setup by platform
Claude Code
~/.claude/skills/claude-code-my-workflow-claude-extract-tikz/SKILL.md
Instructions
Extract TikZ Diagrams to SVG
Extract TikZ diagrams from the Beamer source, compile to multi-page PDF, and convert each page to SVG for use in Quarto slides.
Creating a brand-new diagram instead of extracting? Use
/new-diagram— it scaffolds fromtemplates/tikz-snippets/with the prevention rules pre-applied.
Steps
Step 0: Freshness Check (MANDATORY)
Before compiling, verify that extract_tikz.tex matches the current Beamer source.
- Find the Beamer source:
ls Slides/$ARGUMENTS*.tex - Extract all
\begin{tikzpicture}blocks from Beamer - Compare with
Figures/$ARGUMENTS/extract_tikz.tex - If ANY difference exists: update extract_tikz.tex from the Beamer source
- If extract_tikz.tex doesn't exist: create it from scratch
Step 1: Prevention pre-check (MANDATORY — halt on violation)
Before compiling, verify every \begin{tikzpicture} block in Figures/$ARGUMENTS/extract_tikz.tex satisfies the prevention rules in .claude/rules/tikz-prevention.md. The pre-check is a small Python script shared with /new-diagram so both skills enforce identical behavior:
python3 scripts/check-tikz-prevention.py "Figures/$ARGUMENTS/extract_tikz.tex"
What it checks:
- P3 —
scale=Xwithout node scaling. Barescale=shrinks coordinates but not text. Allowed forms:scale=X, every node/.style={scale=X}orscale=X, transform shape. The checker parses the full\begin{tikzpicture}[...]options block even when it spans multiple lines. - P4 — Directional keyword on edge labels. Every edge label (
nodeinside a\draw) must carryabove,below,left,right, or a compound (e.g.above left).midwayalone is a path position, not a direction. The checker scans the full\draw ...;statement so\drawon one line andnode[...]{...}on the next line are still linked.
Note what the pre-check does NOT enforce: P1 (boxed-node explicit dimensions) and P2 (coordinate-map comment) are structural and get flagged by tikz-reviewer in Step 8, not here.
Exit codes: 0 = all files pass, 1 = one or more P3/P4 violations (stderr lists file, line, snippet, rule), 2 = usage error.
If exit is non-zero: halt, report the offending lines, and ask the user to fix the Beamer source (single source of truth). Do NOT compile.
Step 2: Navigate to the lecture's Figures directory
cd Figures/$ARGUMENTS
Step 3: Compile the extract_tikz.tex file
TEXINPUTS=../../Preambles:$TEXINPUTS xelatex -interaction=nonstopmode extract_tikz.tex
Step 4: Count the number of pages
pdfinfo extract_tikz.pdf | grep "Pages:"
Step 5: Convert each page to SVG using 0-BASED INDEXING
CRITICAL: PDF pages are 1-indexed, but output SVG files are 0-indexed!
PAGES=$(pdfinfo extract_tikz.pdf | grep "Pages:" | awk '{print $2}')
for i in $(seq 1 $PAGES); do
idx=$(printf "%02d" $((i-1)))
pdf2svg extract_tikz.pdf tikz_exact_$idx.svg $i
done
Step 6: Sync to docs/ for deployment
cd ../..
./scripts/sync_to_docs.sh $ARGUMENTS
Step 7: Verify SVG files
- Read 2-3 SVG files to confirm they contain valid SVG markup
- Confirm file sizes are reasonable (not 0 bytes)
Step 8: Visual Quality Review (tikz-reviewer)
Spawn the tikz-reviewer agent (via the Agent tool with subagent_type=tikz-reviewer) on the TikZ source blocks to catch label overlaps, geometric errors, and visual inconsistencies. The reviewer cites specific passes and formulas from .claude/rules/tikz-measurement.md. If it returns NEEDS REVISION or REJECTED, loop:
- Apply the recommended fixes to the Beamer
.texsource (single source of truth). - Re-copy the updated block to
extract_tikz.tex. - Re-run the prevention pre-check (Step 1) and compile.
- Regenerate SVGs, re-sync.
- Re-invoke tikz-reviewer.
Stop when tikz-reviewer returns APPROVED (max 5 rounds).
Step 9: Report results
Source of Truth Reminder
TikZ diagrams MUST be edited in the Beamer .tex file first, then copied verbatim to extract_tikz.tex. See .claude/rules/single-source-of-truth.md.
Security
Reviews (0)
Related skills
Browse all →More from claude-code-my-workflow
View source →More Build skills
Browse category →Frequently asked questions about extract-tikz
What does the extract-tikz skill do?
Extract TikZ diagrams from Beamer `.tex` source, compile each to a standalone PDF, and convert to SVG with 0-based indexing. Use when user says "extract the tikz", "regenerate the diagrams", "rebuild the SVGs", "sync tikz to quarto", or after editing TikZ blocks in a Beamer deck that also has a Quarto mirror. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.
How do I install the extract-tikz skill?
Run `npx @skills-hub-ai/cli install claude-code-my-workflow-claude-extract-tikz` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/claude-code-my-workflow-claude-extract-tikz/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.
Which AI tools does extract-tikz work with?
extract-tikz runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.
Is the extract-tikz skill free?
Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.
How do I use extract-tikz after installing it?
In Claude Code, type `/claude-code-my-workflow-claude-extract-tikz` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.
Can I share the extract-tikz skill with my team?
Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.