claude/skills/qmd-math/SKILL.md
--- name: qmd-math description: Math notation conventions for Quarto/EPQ documents rendered via lualatex. Use when: writing or adding a formula, equation, or mathematical expression to a .qmd file; asked about display math, inline math, or LaTeX notation in a QMD/Quarto context; defining a where-clause or variable definitions for an equation; converting prose variable descriptions into structured math notation; fixing math that renders badly in a PDF; using \lvert, \begin{aligned}, \tfrac, \text
npx skillsauth add lanej/dotfiles claude/skills/qmd-mathInstall 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.
Use $$...$$ display blocks for any equation with more than one operation. Inline $...$ is for single-symbol references in prose only.
<!-- WRONG — hard to scan, subscript stacking mangles copy-paste from PDF -->
The formula is $\text{NRE}_f = \frac{r_i}{8} \cdot \frac{5}{7} \sum_{\text{seg}} \frac{\Delta t_{\text{seg}}}{\lvert\mathcal{F}_{\text{seg},i}\rvert}$ where ...
<!-- CORRECT — opening and closing $$ each on their own line -->
$$
\text{NRE}_f = \frac{r_i}{8} \cdot \frac{5}{7} \sum_{\text{seg}} \frac{\Delta t_{\text{seg}}}{\lvert\mathcal{F}_{\text{seg},i}\rvert}
$$
Preferred: inline \text{where} with \begin{aligned} — keeps definitions inside the math block, aligned at =, no list markup needed. Use when definitions are short phrases.
$$
\text{NRE}_f = \frac{r_i}{8} \cdot \frac{5}{7} \sum_{\text{seg}} \frac{\Delta t_{\text{seg}}}{\lvert\mathcal{F}_{\text{seg},i}\rvert}
\quad \text{where} \quad
\begin{aligned}
r_i/8 &= \text{assignee hourly rate (daily rate} \div 8\text{)} \\
\Delta t_{\text{seg}} &= \text{wall-clock hours in segment} \\
\lvert\mathcal{F}_{\text{seg},i}\rvert &= \text{distinct carrier families active in that segment} \\
5/7 &= \text{wall-clock to business-day conversion}
\end{aligned}
$$
This renders as: equation left · "where" center · aligned definitions right. No overflow on a 6.5in text block if definitions stay under ~40 chars. Verified in lualatex/scrartcl letter.
Fallback: bulleted list — use when definitions are long phrases that would overflow inline.
$$
\text{NRE}_f = \frac{r_i}{8} \cdot \frac{5}{7} \sum_{\text{seg}} \frac{\Delta t_{\text{seg}}}{\lvert\mathcal{F}_{\text{seg},i}\rvert}
$$
where:
- $r_i / 8$ — assignee hourly rate (daily rate ÷ 8 hours)
- $\Delta t_{\text{seg}}$ — wall-clock hours in sweep segment
- $\lvert\mathcal{F}_{\text{seg},i}\rvert$ — distinct carrier families with open pre-first-label tickets in that segment
- $5/7$ — wall-clock to business-day conversion
Each bullet: symbol (inline math) — plain-English definition. One line per term. No nesting.
Never: run-on prose embedding symbols — where $\Delta t$ is the wall-clock hours... $\lvert\mathcal{F}\rvert$ is the count...
When a second formula shares terms with a previous one, use a two-row \begin{aligned} where-block: one row for the new term, one back-reference row for the shared terms.
$$
C_{\text{maint},f} = \frac{r_i}{8} \cdot \frac{5}{7} \sum_{\text{seg} \geq t_{0,f}} \frac{\Delta t_{\text{seg}}}{\lvert\mathcal{F}_{\text{seg},i}\rvert}
\quad \text{where} \quad
\begin{aligned}
t_{0,f} &= \text{first label date for carrier family } f \\
r_i/8,\, \Delta t_{\text{seg}},\, \lvert\mathcal{F}_{\text{seg},i}\rvert &= \text{as defined above}
\end{aligned}
$$
When a where-term is itself derived from other quantities, define it with a formula row — don't flatten it to prose. Use \tfrac (text-fraction) instead of \frac for compact inline fractions within an aligned block, and add the secondary definition on the same row after a \quad:
$$
\text{NRE}_f = w_i \sum_{\text{seg}} \frac{\Delta t_{\text{seg}}}{\lvert\mathcal{F}_{\text{seg},i}\rvert}
\quad \text{where} \quad
\begin{aligned}
w_i &= \tfrac{5 r_i}{56}, \quad r_i = \text{assignee daily rate} \\
\Delta t_{\text{seg}} &= \text{wall-clock hours in segment} \\
\lvert\mathcal{F}_{\text{seg},i}\rvert &= \text{distinct carrier families active in that segment}
\end{aligned}
$$
When a second formula reuses a named term (w_i), the where-block only needs to define what's new — everything else is already established:
$$
C_{\text{maint},f} = w_i \sum_{\text{seg} \geq t_{0,f}} \frac{\Delta t_{\text{seg}}}{\lvert\mathcal{F}_{\text{seg},i}\rvert}
\quad \text{where} \quad
t_{0,f} = \text{first label date for carrier family } f
$$
Single-term where-clauses don't need \begin{aligned} — inline \quad \text{where} \quad term = definition is sufficient.
\texttt Inside Math BlocksThe epq audit flags \texttt{...} anywhere in QMD source, including inside $$ blocks. Use \mathtt{...} for monospace in math mode, or just \text{...} (non-monospace). Better: avoid font commands in math entirely and reference the variable symbol instead.
\lvert\rvert Over |...|For absolute value and set cardinality, always use \lvert...\rvert. The bare | is a fixed-height fence — it mismatches tall fractions.
<!-- WRONG — bars don't scale with the fraction -->
|\mathcal{F}_{\text{seg},i}|
<!-- CORRECT — scales to match the numerator/denominator height -->
\lvert\mathcal{F}_{\text{seg},i}\rvert
\text{} — _{\text{seg}}, _{\text{maint}}. Unwrapped subscripts render as italicized variable sequences (seg → s·e·g)._i, _f.\mathcal{} — \mathcal{F} for a set of families.Safe in prose (renders correctly):
$\Delta t_{\text{seg}}$, $r_i$, $5/7$$r_i / 8$$\div$, $\times$ operators$4\times$ (e.g., "capped at $4\times$")Breaks in lualatex prose (renders as literal dollar signs or garbles):
$\geq$, $\leq$ — use Unicode ≥, ≤ or plain English ("at least", "no more than")$\to$, $\rightarrow$ — use → (Unicode) or plain arrow proseSafe Unicode in lualatex prose (Latin Modern font supports these):
≥ ≤ ≠ ≈ → ÷
Unsafe Unicode (not in Latin Modern, will fail):
× (multiplication sign U+00D7) — write "times" or use $\times$ in math mode only.
$$...$$ display block (opening and closing $$ on their own lines)\begin{aligned} preferred; bulleted list as fallback for long definitions)\lvert...\rvert not |...|\text{}$\geq$ / $\leq$ in prose — Unicode or plain English insteaddata-ai
Delegate research and context-gathering tasks to a sub-agent to protect the primary context window. Use when the user asks to "research X", "look into X", "find out about X", "gather context on X", or any investigative framing where answering requires 2+ searches or multiple sources. Also use proactively before starting substantive work when prior context is unknown. Never run research inline — always delegate.
development
Trim a prose document (README, design doc, blog post, notes) for readability by cutting redundancy, filler, and dead weight in the author's own words. Invoke with /trim [file path], or /trim alone to be prompted for a file. Not for source code, data files, or summarization.
business
Query and analyze Josh Lane's org headcount from the staffing DuckDB at ~/workspace/areas/staffing/staffing.duckdb. Use when asked about headcount counts, org structure, direct reports, team breakdown, hiring/attrition trends, international employees, salary/pay grade distribution, offboarding lag, or any question about people in Josh's org. Triggers on questions about how many people, who reports to whom, headcount by team/country/level, who joined or left, org size, staffing, headcount trend.
tools
Figure engineering patterns, gotchas, and reusable helpers for matplotlib. Use when directly building standalone figure scripts, diagram generators, or canvas visuals outside the epq render pipeline — e.g., generate_layer_icons.py, vision project banners, morning-brief charts, competitive analysis figures. Covers shape boundary math, arrow/edge geometry, series consistency, font registration, zorder, Unicode rendering, and canvas clipping. Distinct from the epq skill (which covers the Quarto/LaTeX analysis pipeline). Load alongside epq when figure work involves both the pipeline and standalone diagram construction.