AGENT SKILL

drawing-mermaid-diagrams

Writes, edits, and debugs Mermaid diagrams (flowchart, sequence, class, state, ER, Gantt, pie, mindmap, timeline, quadrant, git graph, XY, Sankey, architecture, journey, kanban, block). Use when the user says "draw a diagram", or when the user asks for a diagram, flowchart, ERD, or Mermaid code, or when a Mermaid diagram fails to parse or render.

License 许可
MIT
最近更新
2026-11-15
Stars
★ 2
Forks
0

01 前言 Front Matter

name
drawing-mermaid-diagrams
description
Writes, edits, and debugs Mermaid diagrams (flowchart, sequence, class, state, ER, Gantt, pie, mindmap, timeline, quadrant, git graph, XY, Sankey, architecture, journey, kanban, block). Use when the user says "draw a diagram", or when the user asks for a diagram, flowchart, ERD, or Mermaid code, or when a Mermaid diagram fails to parse or render.

02 资源文件 1

03 SKILL.md 正文

Mermaid Diagrams

A diagram is done when it renders without error and its layout reads clearly. Pick the type that matches the content (process, messages, schema, schedule, hierarchy, and so on); a flowchart is not the answer to everything.

Renderer support

  • Each host (GitHub, GitLab, a docs site, an IDE preview) bundles its own Mermaid release, often older than the latest.
  • -beta keywords (xychart-beta, sankey-beta, architecture-beta, block-beta) and recent types such as kanban may fail there.
  • When the target renderer is unknown, prefer a core type, or ask which renderer will display the diagram.

Default to a frontmatter config: block before the diagram keyword. Fall back to a first-line %%{init: {...}}%% directive only for a renderer too old to read frontmatter config.

Validate by rendering

Write the diagram to <out>/diagram.mmd in a scratch directory and render it:

npx -y @mermaid-js/mermaid-cli@12.0.0 -i <out>/diagram.mmd -o <out>/diagram.png

For a Markdown file, -i doc.md -o <out>/doc.md renders every mermaid block. Fix each Parse error on line N or Lexical error and render again until it succeeds. When layout matters, open the PNG and check direction, overlaps, and label text. Only then put the code in its destination.

If mmdc cannot find Chrome, write {"executablePath": "<path to an installed Chrome or Chromium>"} to <out>/puppeteer.json and add -p <out>/puppeteer.json. If Node, network, or a browser is unavailable, do not install one without asking; check the diagram against the gotchas below and tell the user it was not rendered.

A successful CLI render uses the Mermaid release bundled with the CLI, so it does not prove an older host renders the diagram.

Gotchas

Several of these fail silently rather than with a parse error.

  • Labels containing (), [], {}, :, ;, or # are wrapped in "..."; inner quotes are written #quot;, < and > as #lt; and #gt;.
  • A lowercase end as a flowchart node ID or bare label breaks the parse; use End or ["end"].
  • A node ID beginning with o or x right after a link (A---oB) silently becomes a circle or cross edge; add a space or capitalize.
  • %% comments sit on their own line; a trailing comment is a parse error.
  • Block diagrams have no ==> or ::: shorthand.
  • Indentation is significant in mindmap and kanban.
  • Styling not applying: the config block must come first, themeVariables need theme: base, and hex colors in frontmatter must be quoted (an unquoted # is a YAML comment and the color is silently dropped).
  • Renders in the CLI but not on the host: the host's Mermaid is older; replace a -beta or recent type, or switch frontmatter config to %%{init}.

04 同仓库更多 Skills

bostonaholic
bostonaholic/skills

writing-system-prompts

Writes and reviews system prompts for AI tools, agents, chatbots, and LLM products using a fixed section order and a quality checklist. Use when the user says "write a system prompt", or when drafting a system prompt or auditing one for missing stop criteria, tool rules, constraints, or examples. Not for compressing an existing prompt; use improving-prompts.

★ 2
bostonaholic
bostonaholic/skills

writing-prose

Writes and edits prose for people in a plain, conversational, short house style with no em dashes. Use when the user says "write this up", or when drafting or revising documentation, READMEs, explanations, blog posts, or other human-facing prose. Not for prompts written for agents; use writing-system-prompts or composing-agent-prompts.

★ 2
bostonaholic
bostonaholic/skills

writing-acceptance-criteria

Writes or rewrites acceptance criteria until each is provable: one observable outcome with a named check that can fail. Use when the user says "write acceptance criteria", or asks to write, rewrite, or tighten acceptance criteria or a definition of done. Not for proving work meets them; use proving-claims.

★ 2
bostonaholic
bostonaholic/skills

summarizing-shipped-work

Summarizes the user's merged GitHub PRs for a timeframe into a grouped, linked shipped-work report with highlights, and offers to update a brag document. Use when the user says "what shipped?", or when asked what the user shipped (this week, last month, a quarter, since a date), for a status update, or to update a brag doc.

★ 2
bostonaholic
bostonaholic/skills

running-retros

Mines a session transcript, past agent sessions, or named sources such as PR review comments for durable learnings, then proposes approval-gated edits to skills, AGENTS.md, or docs and tracker issues. Use when the user says "retro", or when the user explicitly asks for a retrospective. Never infer from session end or friction.

★ 2
bostonaholic
bostonaholic/skills

learning-from-mistakes

Codifies the latest correction or mistake in the conversation as a short imperative rule in the project or global CLAUDE.md or AGENTS.md, after the user approves it. Use when the user says "learn from this mistake", or when the user asks to learn from a mistake, remember a lesson for next time, add a rule to CLAUDE.md, or not repeat a behavior. Not for a whole session; use running-retros.

★ 2