From claude-thesis-writer
Generates figures from placeholders in .tex files using Python matplotlib and TikZ. Maintains shared plot_defaults.py for consistent styling. Flags complex figures for the user. Runs after the writer skill.
How this skill is triggered — by the user, by Claude, or both
Slash command
/claude-thesis-writer:figure-generatorThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
This skill runs after the `writer` skill has produced LaTeX prose. It reads .tex files, finds figure placeholders, and generates actual figures where possible. It replaces `\figurePlaceholder{...}` blocks with `\includegraphics{...}` pointing to generated output.
This skill runs after the writer skill has produced LaTeX prose. It reads .tex files, finds figure placeholders, and generates actual figures where possible. It replaces \figurePlaceholder{...} blocks with \includegraphics{...} pointing to generated output.
writer has produced .tex files containing figure placeholdersBefore generating any figures, check for figures/plot_defaults.py in the document directory. If it does not exist, create it. This file defines all shared styling for consistency across the entire thesis.
# figures/plot_defaults.py
# Shared matplotlib defaults for all thesis figures.
# Edit this file to change styling globally.
import matplotlib.pyplot as plt
import matplotlib as mpl
# --- Colour palette ---
COLOURS = {
'primary': '#1f77b4',
'secondary': '#ff7f0e',
'tertiary': '#2ca02c',
'quaternary': '#d62728',
'grey': '#7f7f7f',
'light_grey': '#c7c7c7',
}
COLOUR_CYCLE = [COLOURS['primary'], COLOURS['secondary'], COLOURS['tertiary'],
COLOURS['quaternary'], COLOURS['grey']]
# --- Figure sizes (inches) ---
SINGLE_COL = (6.5, 4.0)
DOUBLE_COL = (6.5, 3.0) # wide but short
HALF_COL = (3.15, 3.0) # for subfigures
# --- Font and text ---
FONT_FAMILY = 'serif'
FONT_SIZE = 10
LABEL_SIZE = 11
TICK_SIZE = 9
LEGEND_SIZE = 9
# --- Line and marker ---
LINE_WIDTH = 1.5
MARKER_SIZE = 4
# --- Export ---
DPI = 300
FORMATS = ['pdf', 'png'] # pdf for LaTeX, png for preview
def apply():
"""Apply thesis defaults to matplotlib rcParams."""
mpl.rcParams.update({
'font.family': FONT_FAMILY,
'font.size': FONT_SIZE,
'axes.labelsize': LABEL_SIZE,
'axes.titlesize': LABEL_SIZE,
'xtick.labelsize': TICK_SIZE,
'ytick.labelsize': TICK_SIZE,
'legend.fontsize': LEGEND_SIZE,
'figure.figsize': SINGLE_COL,
'figure.dpi': DPI,
'savefig.dpi': DPI,
'savefig.bbox': 'tight',
'lines.linewidth': LINE_WIDTH,
'lines.markersize': MARKER_SIZE,
'axes.prop_cycle': mpl.cycler(color=COLOUR_CYCLE),
})
def savefig(fig, path_stem):
"""Save figure in all configured formats."""
for fmt in FORMATS:
fig.savefig(f'{path_stem}.{fmt}', dpi=DPI, bbox_inches='tight')
Every generated script must:
import plot_defaults; plot_defaults.apply() at the topplot_defaults.savefig(fig, path) to exportplot_defaults.COLOURS, plot_defaults.SINGLE_COL, etc. for sizing and coloursIf plot_defaults.py already exists, read it and respect the author's customisations. Only add missing keys — never overwrite existing choices.
For placeholders that specify data sources, generate Python scripts using matplotlib:
Input (from placeholder):
Output:
figures/scripts/ that reads data and produces the plotfigures/ (PDF and PNG)\includegraphics replacing the placeholderScript requirements:
python script.pyplot_defaults for consistent stylingFor block diagrams, system architectures, signal processing pipelines:
Approach: Generate using TikZ directly in LaTeX, or Python (matplotlib/networkx) for more complex diagrams.
Types:
Some figures cannot be auto-generated:
Action: Keep the placeholder but add a % TODO: MANUAL FIGURE REQUIRED comment explaining what's needed and why it couldn't be auto-generated.
figures/plot_defaults.py\includegraphicsReplace:
\begin{figure}[tb]
\centering
\fbox{\parbox{0.8\textwidth}{
\textbf{FIGURE PLACEHOLDER}\\[1em]
...
}}
\caption{Caption text.}
\label{fig:label}
\end{figure}
With:
\begin{figure}[tb]
\centering
\includegraphics[width=\columnwidth]{figures/fig_label}
\caption{Caption text.}
\label{fig:label}
\end{figure}
writer skill (.tex files with figure placeholders)figures/plot_defaults.py (shared styling for all thesis figures)figures/, Python scripts in figures/scripts/, updated .tex filesformatter skill for final LaTeX polishnpx claudepluginhub ccam80/thesis-writer --plugin thesis-writerGuides completion of development work by verifying tests, detecting environment, and presenting structured options for merge, PR, or cleanup.
Guides creation and editing of skills using test-driven development with pressure scenarios and subagents to verify agent compliance.
Dispatches multiple subagents concurrently for independent tasks without shared state. Use when facing 2+ unrelated failures or subsystems that can be investigated in parallel.