算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
diagram-generator【设计与创意】Generate diagrams of any kind from a description, ticket, spec, or file. Outputs Mermaid syntax (renders natively in GitHub, Notion, Confluence, Obsidian, Slack with apps) plus an optional single-file HTML preview that renders the diagram in the browser. Use this skill when the user says: - "draw a flowchart", "create a diagram", "visualize this flo…
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: diagram-generator description: | Generate diagrams of any kind from a description, ticket, spec, or file. Outputs Mermaid syntax (renders natively in GitHub, Notion, Confluence, Obsidian, Slack with apps) plus an optional single-file HTML preview that renders the diagram in the browser.
Use this skill when the user says:
Turn any input into a clean diagram. Supports the full Mermaid diagram set so one skill handles flowcharts, sequence diagrams, state machines, ER diagrams, journeys, mindmaps, timelines, gantt charts, sankey, quadrants, class diagrams, and git graphs.
If the input is unambiguous, pick directly. Otherwise ask which fits best:
| User intent | Mermaid type |
|---|---|
| Process flow, decision tree, "if X then Y" | flowchart |
| API calls, message passing, who-talks-to-whom over time | sequenceDiagram |
| Object lifecycle, finite-state machine | stateDiagram-v2 |
| Database schema, entities + relationships | erDiagram |
| End-to-end customer/user experience with sentiment | journey |
| Hierarchical brainstorm, taxonomy, idea tree | mindmap |
| Dated events, milestones | timeline |
| Project schedule with durations + dependencies | gantt |
| Flow of quantity between sources/targets | sankey-beta |
| 2x2 categorization (importance/urgency, effort/impact) | quadrantChart |
| OOP class hierarchy with methods | classDiagram |
| Git branching strategy | gitGraph |
From the input, pull out the right primitives for the chosen type:
If multiple distinct scenarios exist (e.g., happy path + error path), produce SEPARATE diagrams rather than one mega-diagram.
Always wrap output in:
```mermaid
{type-specific code}
```
Follow the type-specific rules below.
After printing the Mermaid block, ask: "Want me to generate a single-file HTML preview that renders this locally?"
If yes, write diagram.html to the current directory using the template under "HTML preview template" below.
<br>, NEVER \n.([text]) — start / end (stadium)[text] — action / process{text} — decision[[text]] — subroutine[(text)] — database((text)) — circle (event)flowchart TD for processes, flowchart LR for timelines/pipelines.-- text --> for conditional paths.style lines at the end):
fill:#4CAF50,color:#fff — success / start (green)fill:#EF5350,color:#fff — error / blocked (red)fill:#FF9800,color:#fff — warning / modified (orange)fill:#2196F3,color:#fff — informational (blue)subgraph Name ... end.participant X as Display Name to set readable labels.->> for sync, -->> for async, --x for failed.Note over X,Y: text for callouts.loop, alt / else, par, opt for control flow.activate X / deactivate X to show lifelines.[*] --> StateName for start, StateName --> [*] for end.state ChoiceName <<choice>> for branching.state Group { ... }.||--o{ (one-to-many), }o--o{ (many-to-many), ||--|| (one-to-one).{type} attributeName "comment".Task name: <score 1-5>: Actor1, Actor2.section Name.((text)), [text], (text), {{text}}.section Name then events as : YYYY : event text.dateFormat YYYY-MM-DD.Name :status, id, start, duration or Name :status, id, after otherId, duration.done, active, crit.Source,Target,42.title, x-axis Low --> High, y-axis Low --> High, four quadrant labels.Item Name: [x, y] where x and y are 0-1.Class : +method() for public, - private, # protected.<|-- inherits, *-- composition, o-- aggregation, --> association.commit, branch name, checkout name, merge name.## {Diagram Title}
**Summary:** {one-line description of what the diagram shows}
```mermaid
{code}
Key callouts:
If multiple diagrams (e.g., happy + error paths), use a header per diagram and render each separately.
## HTML preview template
When the user asks for a local preview, write this single file (no build, no npm; mermaid loaded from CDN):
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Diagram preview</title>
<style>
body{margin:0;padding:48px;font:16px/1.5 system-ui,sans-serif;background:#F5F1EA;color:#15140F}
.wrap{max-width:1100px;margin:0 auto}
h1{font-weight:500;font-size:28px;margin:0 0 24px}
.mermaid{background:#fff;border:1px solid #D8D2C5;border-radius:10px;padding:24px;overflow:auto}
</style>
</head>
<body>
<div class="wrap">
<h1>{TITLE}</h1>
<pre class="mermaid">
{MERMAID_CODE}
</pre>
</div>
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: true, theme: 'base', themeVariables: {
primaryColor: '#F5F1EA', primaryTextColor: '#15140F', primaryBorderColor: '#15140F',
lineColor: '#15140F', fontFamily: 'system-ui, sans-serif'
}});
</script>
</body>
</html>
Replace {TITLE} and {MERMAID_CODE} with the actual content. Preview opens directly in the browser (file:// works; no server needed).
\n for line breaks in flowchart node labels — always <br>.style lines on flowcharts — color coding makes diagrams scannable.interactive-flowchart-builder skill instead.)