.claude/skills/extract-tikz/SKILL.md
Extract TikZ diagrams from Beamer source, compile to PDF, convert to SVG with 0-based indexing. Use when updating TikZ diagrams for Quarto slides.
npx skillsauth add pedrohcgs/claude-code-my-workflow extract-tikzInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
Before compiling, verify that extract_tikz.tex matches the current Beamer source.
ls Slides/$ARGUMENTS*.tex\begin{tikzpicture} blocks from BeamerFigures/$ARGUMENTS/extract_tikz.texBefore 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:
scale=X without node scaling. Bare scale= shrinks coordinates but not text. Allowed forms: scale=X, every node/.style={scale=X} or scale=X, transform shape. The checker parses the full \begin{tikzpicture}[...] options block even when it spans multiple lines.node inside a \draw) must carry above, below, left, right, or a compound (e.g. above left). midway alone is a path position, not a direction. The checker scans the full \draw ...; statement so \draw on one line and node[...]{...} 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.
cd Figures/$ARGUMENTS
TEXINPUTS=../../Preambles:$TEXINPUTS xelatex -interaction=nonstopmode extract_tikz.tex
pdfinfo extract_tikz.pdf | grep "Pages:"
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
cd ../..
./scripts/sync_to_docs.sh $ARGUMENTS
Spawn the tikz-reviewer agent (via Task 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:
.tex source (single source of truth).extract_tikz.tex.Stop when tikz-reviewer returns APPROVED (max 5 rounds).
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.
testing
Stage, commit, push, open a PR, and merge to main. Use ONLY on explicit commit intent — user says "commit", "ship it", "push this", "open a PR", "merge to main", "let's commit this", or prefixes with `/commit`. Do NOT auto-invoke on vague end-of-task phrases ("we're done", "wrap up") — those require explicit confirmation first. Runs the standard commit-PR-merge cycle; never force-pushes or skips hooks.
testing
Perform adversarial visual audit of Quarto or Beamer slides checking for overflow, font consistency, box fatigue, and layout issues.
testing
Validate bibliography entries against citations in all lecture files. Structural checks (missing/unused entries, malformed fields) by default; `--semantic` adds citation-drift detection, DOI verification, and style-consistency checks.
testing
Translate Beamer LaTeX to Quarto RevealJS. Multi-phase workflow with TikZ extraction and QA.