Agent skill
mermaid-local
Mermaid diagram creation and debugging for Quarto revealjs slides. Use when creating or editing mermaid diagrams (sequenceDiagram, flowchart, pie, etc.) embedded in .qmd files, previewing with mmdc, or fixing text color issues in revealjs output. Covers %%{init}%% config, CSS overrides, and sequenceDiagram tips.
Install this agent skill to your Project
npx add-skill https://github.com/i9wa4/dotfiles/tree/main/nix/home-manager/agents/skills/mermaid-local
SKILL.md
Mermaid Skill
1. mmdc vs revealjs Rendering Difference
%%{init}%% themeVariables work in mmdc PNG but are overridden by revealjs
CSS at render time. Quarto revealjs injects CSS vars via
mermaid-init.js defaultCSS:
| CSS variable | Targets | Default value |
|---|---|---|
--mermaid-edge-color |
signal text, loop text | #999 (gray) |
--mermaid-label-fg-color |
actor names | #2a76dd (blue) |
--mermaid-node-fg-color |
alt/else labels | #000 (black) |
Result: mmdc shows black text; revealjs shows faint/colored text.
2. Fix: Black Text in revealjs
Add CSS override to YAML include-in-header in .qmd file:
include-in-header:
- existing-header.html
- text: |
<style>
.mermaid text { fill: #000000 !important; }
.mermaid .label { color: #000000 !important; }
</style>
.mermaid texttargets SVG<text>elements.mermaid .labeltargets CSS-positioned labels
3. Verification
mmdc-only is insufficient. Use quarto render + HTML inspection:
mise exec -- quarto render slides/xxx.qmd --to revealjs
# Inspect _site/slides/xxx.html — search for mermaid SVG, check fill attributes
Or use the webapp-testing skill (Playwright) to screenshot the rendered slide.
4. sequenceDiagram Tips
4.1. %%{init}%% Config
%%{init: {'theme': 'base', 'themeVariables': {'textColor': '#000000', ...}, 'sequence': {'mirrorActors': false}}}%%
mirrorActors: false— hides the duplicate bottom actor row, saves ~3 lines
4.2. Slide Capacity
~20 diagram content lines fit on a 1920x1080 revealjs slide with
scrollable: true without overflow.
5. mmdc Command
Run mermaid CLI via nix comma operator:
, mmdc -i input.mmd -o output.png
Requires system Chrome:
PUPPETEER_EXECUTABLE_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" , mmdc -i input.mmd -o output.png
NOTE: Strip code fence markers — mmdc needs raw mermaid syntax (no
```{mermaid} wrapper).
6. revealjs Text Color Fix
%%{init}%% themeVariables do NOT work in revealjs — revealjs applies its own
CSS variables after SVG generation, overriding any inline settings.
Working fix: override the CSS variables at :root level in YAML
include-in-header:
:root {
--mermaid-edge-color: #000000 !important; /* signal text */
--mermaid-label-fg-color: #000000 !important; /* actor names */
--mermaid-node-fg-color: #000000 !important; /* alt/loop labels */
}
Do NOT use .mermaid text { fill: #000000 !important; } — it is ineffective
because revealjs renders mermaid client-side and CSS vars take precedence over
static SVG fill.
Why [alt/else labels] appear black by default: they use
--mermaid-node-fg-color which defaults to #000 — while signal text and actor
names use different vars.
7. Coloring alt/loop/actor in sequenceDiagram (revealjs)
CSS class names (sourced from mermaid-init.js defaultCSS):
| Element | CSS class | Example color |
|---|---|---|
| Actor boxes | rect.actor |
#dbeafe (light blue) |
| alt/loop section bg | .loopLine |
#fef3c7 (amber) |
| alt/loop label boxes | .labelBox |
#e0e7ff (pale indigo) |
IMPORTANT limitation: alt and loop blocks share the same .loopLine CSS
class. They cannot be styled with different colors without more invasive CSS.
Apply via include-in-header <style> block with !important.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
subagent-review
Argument-driven code/design review wrapper. Invokes reviewer sub-skills for each specified engine+tier label. Defaults to 'cc cx' (10 reviewers) if no arguments given. Argument format: space-separated labels from {cc, cc-deep, cx, cx-deep} Examples: 'cc cx' (default), 'cc-deep cx-deep', 'cc', 'cx-deep' Use when: - Running code reviews on PRs, commits, or branches - Running design reviews on issues or documents - Need multi-perspective review (security, architecture, code, QA, historian)
brainstorming
Ambiguity-reduction workflow for requests that are not yet plan-ready or implementation-ready. Use when there are multiple plausible approaches, the task is user-facing or design-shaping, requirements are fuzzy, or Codex needs to compare 2-3 options with trade-offs before choosing a direction.
databricks-local
Databricks local additions - Queries API, VARIANT/JSON, Dashboard API, dbt integration, Jupyter kernel Supplements the official `databricks` skill with project-specific patterns. Use when: - Working with Databricks Queries API (saved queries) - Handling VARIANT type or JSON operations - Working with Lakeview Dashboard API - Integrating dbt with Databricks JSON/VARIANT columns - Running Jupyter notebooks with Databricks kernel
codex-prompting-local
Portable Codex prompt, review-contract, and resume-handoff guidance adapted from codex-plugin-cc for this repo's Nix-managed Codex CLI and Claude Code setup. Use when: - Composing prompts for Codex or GPT-5.4-based subagents - Designing structured review or adversarial-review prompt contracts - Writing resumable task prompts or result handoffs - Re-expressing useful old slash-command workflows on the skills side instead of reviving slash commands
nix
Nix commands and package management guide. Use when: - Using nurl for hash acquisition
bigquery-local
BigQuery local additions - cost-aware query patterns and project conventions. Supplements general BigQuery knowledge with guardrails. Use when: - Running bq commands - Writing GoogleSQL queries - Designing partitioned/clustered tables
Didn't find tool you were looking for?