New Diagram
Scaffold a new TikZ diagram from the snippet gallery with prevention rules pre-applied...
Install
npx skills add pedrohcgs/claude-code-my-workflow --skill new-diagram -g -a claude-code -y- Repository
- pedrohcgs/claude-code-my-workflow1.7k
- Category
- Engineering
- Updated
- 1mo ago
- License
- MIT
- Context cost
- Mediumabout 1,642 tokens
- Runs scripts
- No, instructions only
What it does
Scaffold a new TikZ diagram from the snippet gallery with prevention rules pre-applied (explicit node dimensions, coordinate map, directional edge labels). Compiles standalone, invokes tikz-reviewer with citations from tikz-measurement.md, and loops on revisions until APPROVED.
Create a New TikZ Diagram
Scaffold a diagram from templates/tikz-snippets/, check it against the prevention rules, compile standalone, run the reviewer with measurement citations, and loop until the diagram passes. Use this instead of writing TikZ from scratch; the snippets embed the invariants that tikz-prevention.md requires.
Inputs
$0(optional), snippet name (without.tex). One of the filenames intemplates/tikz-snippets/. If omitted, list the gallery and ask the user to pick.$1(optional), output path. Defaults toFigures/new_diagram.tex, ask the user if this target exists so we don't clobber.
Workflow
Step 1: Pick a snippet
ls -1 templates/tikz-snippets/*.tex
Current gallery (see templates/tikz-snippets/README.md for descriptions):
dag-basic, 3-node causal DAG (X → Y with confounder U)dag-mediation, X → M → Y with direct pathdid-two-period, two-period difference-in-differencesevent-study, event-time coefficients with 95% CIstimeline, horizontal timeline with staggered eventsregression-scatter, scatter + OLS fit + confidence bandflowchart-3step, vertical flow with decision diamondsupply-demand, supply/demand with shifted demand
If $0 is not one of these, or is omitted, ask the user which to use.
Step 2: Copy the snippet to the output path
SRC="templates/tikz-snippets/$0.tex"
DST="${1:-Figures/new_diagram.tex}"
# Confirm before overwriting
if [ -f "$DST" ]; then
echo "Output path already exists: $DST"
# Ask the user whether to overwrite. Do NOT clobber silently.
fi
mkdir -p "$(dirname "$DST")"
cp "$SRC" "$DST"
Step 3: Edit the content to fit the user's intent
Ask the user what the diagram should show. Edit $DST with the Edit tool:
