[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7FD2AC2V1ZZFDA1FYAKT7J2":3,"skill-same:01M7FD2AC2V1ZZFDA1FYAKT7J2":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7FD2AC2V1ZZFDA1FYAKT7J2","mermaid-diagram",null,"Generate Mermaid diagrams from user requirements. Supports flowcharts, sequence diagrams, class diagrams, ER diagrams, Gantt charts, and 18 more diagram types.","CZX-LBJ\u002Fdeepseek-science","CZX-LBJ","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F204594689?v=4","01M7FC59WQ9PFXT04MKGJDCFFT","czx","01M7FC59XB2GW0BKWN9JTDBQS7",1,"MIT","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Faris\u002Fskills\u002Fmermaid-diagram\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: mermaid-diagram\ndescription: \"Generate Mermaid diagrams from user requirements. Supports flowcharts, sequence diagrams, class diagrams, ER diagrams, Gantt charts, and 18 more diagram types.\"\nargument-hint: \"[diagram description or requirements]\"\nallowed-tools: Bash(*), Read, Write, Edit, Glob, Grep\n---\n\n# Mermaid Diagram Generator\n\nGenerate high-quality Mermaid diagram code based on user requirements, with file output and verification.\n\n## Constants\n\n- **OUTPUT_DIR = `figures\u002F`** — Output directory for all generated files\n- **MAX_ITERATIONS = 3** — Maximum refinement rounds for syntax errors\n\n## Workflow: MUST EXECUTE ALL STEPS\n\n### Step 0: Pre-flight Check\n\n```bash\n# Create output directory\nmkdir -p figures\n```\n\n### Step 1: Understand Requirements & Select Diagram Type\n\nParse the input: **$ARGUMENTS**\n\n1. Analyze user description to determine the most suitable diagram type\n2. Read the corresponding syntax reference documentation (see Step 2 below)\n3. **If the diagram involves mathematical notation** (formulas, equations, Greek letters, subscripts, superscripts, fractions, matrices, etc.), apply the math syntax rules from the **Math Formulas in Diagrams** section below\n4. Identify all components, connections, and data flow\n5. Plan the diagram structure\n\n### Step 2: Read Documentation\n\nSelect the appropriate diagram type based on the use case. Use your built-in knowledge of Mermaid syntax, or fetch up-to-date docs via the context7 MCP server if needed.\n\n| Type | Use Cases |\n| ---- | --------- |\n| Flowchart | Processes, decisions, steps |\n| Sequence Diagram | Interactions, messaging, API calls |\n| Class Diagram | Class structure, inheritance, associations |\n| State Diagram | State machines, state transitions |\n| ER Diagram | Database design, entity relationships |\n| Gantt Chart | Project planning, timelines |\n| Pie Chart | Proportions, distributions |\n| Mindmap | Hierarchical structures, knowledge graphs |\n| Timeline | Historical events, milestones |\n| Git Graph | Branches, merges, versions |\n| Quadrant Chart | Four-quadrant analysis |\n| Requirement Diagram | Requirements traceability |\n| C4 Diagram | System architecture (C4 model) |\n| Sankey Diagram | Flow, conversions |\n| XY Chart | Line charts, bar charts |\n| Block Diagram | System components, modules |\n| Packet Diagram | Network protocols, data structures |\n| Kanban | Task management, workflows |\n| Architecture Diagram | System architecture |\n| Radar Chart | Multi-dimensional comparison |\n| Treemap | Hierarchical data visualization |\n| User Journey | User experience flows |\n| ZenUML | Sequence diagrams (code style) |\n\n### Configuration & Themes\n\n- **Theming** - Custom colors and styles\n- **Directives** - Diagram-level configuration\n- **Layouts** - Layout direction and spacing\n- **Configuration** - Global settings\n- **Math** - LaTeX math support (see Math Formulas in Diagrams section below)\n\n### Step 3: Generate Mermaid Code & Save Files\n\nGenerate the Mermaid code following the reference specification, then save TWO files:\n\n#### File 1: `figures\u002F\u003Cdiagram-name>.mmd` — Raw Mermaid source\n\nThe `.mmd` file contains ONLY the raw Mermaid code (no markdown fences). Example:\n\n```\nflowchart TD\n    A[Start] --> B{Condition}\n    B -->|Yes| C[Execute]\n    B -->|No| D[End]\n    C --> D\n```\n\n#### File 2: `figures\u002F\u003Cdiagram-name>.md` — Markdown with embedded Mermaid\n\nThe `.md` file wraps the same code in a mermaid code block for preview rendering, plus a title and description. Example:\n\n```markdown\n# Diagram Title\n\nBrief description of what this diagram shows.\n\n​```mermaid\nflowchart TD\n    A[Start] --> B{Condition}\n    B -->|Yes| C[Execute]\n    B -->|No| D[End]\n    C --> D\n​```\n```\n\n**Naming convention**: Use a descriptive kebab-case name derived from the user's request (e.g., `auth-flow`, `system-architecture`, `database-er`).\n\n### Step 4: Verify Mermaid Syntax (MANDATORY)\n\n**Claude MUST verify the generated Mermaid code by running the Mermaid CLI (`mmdc`).**\n\n```bash\n# Check if mermaid-cli is available\nif command -v mmdc &> \u002Fdev\u002Fnull; then\n    # Render to PNG to verify syntax is correct\n    mmdc -i figures\u002F\u003Cdiagram-name>.mmd -o figures\u002F\u003Cdiagram-name>.png -b transparent \\\n        && echo \"✅ Syntax valid — PNG rendered to figures\u002F\u003Cdiagram-name>.png\"\nelse\n    # Try npx as fallback\n    npx -y @mermaid-js\u002Fmermaid-cli@latest -i figures\u002F\u003Cdiagram-name>.mmd -o figures\u002F\u003Cdiagram-name>.png -b transparent \\\n        && echo \"✅ Syntax valid — PNG rendered to figures\u002F\u003Cdiagram-name>.png\"\nfi\n```\n\n**If the verification fails:**\n1. Read the error message carefully\n2. Fix the syntax issue in both `.mmd` and `.md` files\n3. Re-run verification\n4. Repeat up to MAX_ITERATIONS (3) times\n\n### Step 5: Claude STRICT Visual Review & Scoring (MANDATORY)\n\nAfter successful rendering, Claude MUST read the generated PNG and perform a STRICT review:\n\n```markdown\n## Claude's STRICT Review of \u003Cdiagram-name>\n\n### What I See\n[Describe the rendered diagram in DETAIL - every block, every arrow, every label]\n\n### Files Generated\n- `figures\u002F\u003Cdiagram-name>.mmd` — Raw Mermaid source\n- `figures\u002F\u003Cdiagram-name>.md` — Markdown with embedded diagram\n- `figures\u002F\u003Cdiagram-name>.png` — Rendered PNG (if mmdc available)\n\n### ═══════════════════════════════════════════════════════════════\n### STRICT VERIFICATION CHECKLIST (ALL must pass for score ≥ 9)\n### ═══════════════════════════════════════════════════════════════\n\n#### A. File Correctness\n- [ ] `.mmd` file contains valid Mermaid syntax (no markdown fences)\n- [ ] `.md` file has the mermaid code wrapped in ```mermaid``` fences\n- [ ] `.mmd` and `.md` contain IDENTICAL Mermaid code\n- [ ] Diagram renders without errors (via mmdc)\n\n#### B. Arrow Correctness Verification (CRITICAL - any failure = score ≤ 6)\nCheck EACH arrow:\n- [ ] Arrow 1: [Source] → [Target] — Does it point to the CORRECT target?\n- [ ] Arrow 2: [Source] → [Target] — Does it point to the CORRECT target?\n- [ ] ... (check ALL arrows)\n\n#### C. Block Content Verification (any failure = score ≤ 7)\nCheck EACH block\u002Fnode:\n- [ ] Block 1 \"[Name]\": Has correct label? Content correct?\n- [ ] Block 2 \"[Name]\": Has correct label? Content correct?\n- [ ] ... (check ALL blocks)\n\n#### D. Completeness\n- [ ] All components from user requirements are present\n- [ ] All connections\u002Farrows are correct\n- [ ] Node labels are meaningful and match requirements\n\n#### E. Visual Quality\n- [ ] Layout is clean and readable\n- [ ] Color scheme is professional (not rainbow)\n- [ ] Text is readable at normal zoom\n- [ ] Proper spacing (not cramped, not sparse)\n- [ ] Data flow is traceable in 5 seconds\n\n### ═══════════════════════════════════════════════════════════════\n\n### Issues Found (BE SPECIFIC)\n1. [Issue 1]: [EXACTLY what is wrong] → [How to fix]\n2. [Issue 2]: [EXACTLY what is wrong] → [How to fix]\n\n### Score: X\u002F10\n\n### Score Breakdown Guide:\n- **10**: Perfect. No issues. Publication-ready.\n- **9**: Excellent. Minor issues that don't affect understanding.\n- **8**: Good but has noticeable issues (layout, styling).\n- **7**: Usable but has clear problems (wrong arrows, missing labels).\n- **6**: Has arrow direction errors or missing major components.\n- **1-5**: Major issues. Unacceptable.\n\n### Verdict\n[ ] ACCEPT (score ≥ 9 AND all critical checks pass)\n[ ] FIX (score \u003C 9 OR any critical check fails — list EXACT fixes needed)\n```\n\n**If FIX: apply corrections to both `.mmd` and `.md` files, re-render, and re-verify. Loop until ACCEPT or MAX_ITERATIONS reached.**\n\n### Step 6: Final Output Summary\n\nWhen accepted, present to user:\n\n```\n✅ Mermaid diagram generated successfully!\n\nFiles:\n  figures\u002F\u003Cdiagram-name>.mmd  — Raw Mermaid source (use with mmdc, editors, CI)\n  figures\u002F\u003Cdiagram-name>.md   — Markdown preview (renders on GitHub, VS Code, etc.)\n  figures\u002F\u003Cdiagram-name>.png  — Rendered image (if mmdc was available)\n\nTo re-render manually:\n  mmdc -i figures\u002F\u003Cdiagram-name>.mmd -o figures\u002F\u003Cdiagram-name>.png\n```\n\n## Architecture Diagram Best Practices\n\nWhen generating `architecture-beta` diagrams, apply these layout techniques for complex diagrams:\n\n### Use Junctions for Layout Control\n\nThink of the diagram as an invisible grid. Use `junction` nodes as virtual anchor points on that grid to precisely control where each component is placed. This is especially useful when a direct edge between two services produces unexpected positioning.\n\nInstead of connecting services directly:\n\n```\nlb:R --> L:scim\nlb:R --> L:webapi\n```\n\nRoute through junctions to control vertical\u002Fhorizontal placement:\n\n```\njunction j_lb_r\nlb:R -- L:j_lb_r\njunction j_scim_l\nj_lb_r:T -- B:j_scim_l\nj_scim_l:R --> L:scim\njunction j_webapi_l\nj_lb_r:B -- T:j_webapi_l\nj_webapi_l:R --> L:webapi\n```\n\nPlace junctions on all four sides of components to anchor them logically on the grid.\n\n### Use Edges out of Groups for Floating Components\n\nFor services that have no logical connection to other nodes (e.g. a deployment tool, a monitoring agent), use a junction combined with the `{group}` modifier to position them without adding a semantically incorrect edge:\n\n```\njunction j_acd_t\nj_algolia_proc_b{group}:B -- T:j_acd_t\nj_acd_t:B -- T:acd\n```\n\nThis anchors `acd` below its intended neighbor without implying a real relationship.\n\n## CVPR\u002FICLR\u002FNeurIPS Style Guide (for Academic Diagrams)\n\nWhen the diagram is intended for academic papers, apply these style standards:\n\n### Visual Standards\n- **Clean white background** — No decorative patterns or gradients (unless subtle)\n- **Sans-serif fonts** — Arial, Helvetica, or Computer Modern; minimum 14pt\n- **Subtle color palette** — Not rainbow colors; use 3-5 coordinated colors\n- **Print-friendly** — Must be readable in grayscale (many reviewers print papers)\n- **Professional borders** — Thin (2-3px), solid colors, not flashy\n\n### Layout Standards\n- **Horizontal flow** — Left-to-right is the standard for pipelines\n- **Clear grouping** — Use subtle background boxes to group related modules\n- **Consistent sizing** — Similar components should have similar sizes\n- **Balanced whitespace** — Not cramped, not sparse\n\n### Arrow Standards (MOST CRITICAL)\n- **Thick strokes** — 4-6px minimum (thin arrows disappear when printed)\n- **Clear arrowheads** — Large, filled triangular heads\n- **Dark colors** — Black or dark gray (#333333); avoid colored arrows\n- **Labeled** — Every arrow should indicate what data flows through it\n- **No crossings** — Reorganize layout to avoid arrow crossings\n- **CORRECT DIRECTION** — Arrows must point to the RIGHT target!\n\n### Color Palette (Academic Professional)\n- **Inputs**: Green (#10B981 \u002F #34D399)\n- **Encoders**: Blue (#2563EB \u002F #3B82F6)\n- **Fusion**: Purple (#7C3AED \u002F #8B5CF6)\n- **Outputs**: Orange (#EA580C \u002F #F97316)\n- **Arrows**: Black or dark gray (#333333 \u002F #1F2937)\n- **Background**: Pure white (#FFFFFF)\n\n### What to AVOID\n- Rainbow color schemes (too many colors)\n- Thin, hairline arrows\n- Heavy drop shadows or glowing effects\n- 3D effects \u002F perspective\n- Excessive decorative icons\n- Small text that's unreadable when printed\n\n## Math Formulas in Diagrams (KaTeX)\n\nMermaid supports rendering mathematical expressions via KaTeX (v10.9.0+). **When the diagram content involves math** (formulas, equations, Greek letters, subscripts\u002Fsuperscripts, fractions, matrices, operators, etc.), use KaTeX notation instead of plain-text approximations.\n\n### Supported Diagram Types for Math\n\nMath rendering with `$$...$$` is supported in:\n- **Flowcharts** (`flowchart` \u002F `graph`) — in node labels and edge labels\n- **Sequence Diagrams** — in participant aliases, messages, and notes\n\n### Syntax Rules\n\n1. **Wrap math expressions in `$$` delimiters** inside quoted strings:\n   ```\n   A[\"$$x^2$$\"] -->|\"$$\\sqrt{x+3}$$\"| B(\"$$\\frac{1}{2}$$\")\n   ```\n\n2. **Node labels with math MUST be quoted** — use `[\"$$...$$\"]` or `(\"$$...$$\")`:\n   ```\n   scaledDot[\"$$\\text{softmax}\\left(\\frac{QK^T}{\\sqrt{d_k}}\\right)V$$\"]\n   ```\n\n3. **Mix text and math** by placing `$$` only around the math portion:\n   ```\n   layer1[\"Linear Layer $$W_1 x + b_1$$\"]\n   ```\n\n4. **Use `\\text{}`** for non-math text inside a `$$` block:\n   ```\n   node[\"$$\\text{Attention}(Q, K, V)$$\"]\n   ```\n\n### Common Math Patterns for ML\u002FScience Diagrams\n\n| Concept | KaTeX Syntax | Renders As |\n| ------- | ------------ | ---------- |\n| Subscript | `$$W_Q$$` | W_Q |\n| Superscript | `$$x^2$$` | x² |\n| Fraction | `$$\\frac{QK^T}{\\sqrt{d_k}}$$` | QK^T \u002F sqrt(d_k) |\n| Greek letters | `$$\\alpha, \\beta, \\gamma$$` | α, β, γ |\n| Square root | `$$\\sqrt{d_k}$$` | √d_k |\n| Summation | `$$\\sum_{i=1}^{n} x_i$$` | Σx_i |\n| Matrix | `$$\\begin{bmatrix} a & b \\\\ c & d \\end{bmatrix}$$` | 2x2 matrix |\n| Softmax | `$$\\text{softmax}(z_i)$$` | softmax(z_i) |\n| Norm | `$$\\|\\|x\\|\\|_2$$` | ‖x‖₂ |\n| Hat\u002Ftilde | `$$\\hat{y}, \\tilde{x}$$` | ŷ, x̃ |\n\n### Example: Attention Mechanism with Math\n\n```\nflowchart TD\n    Q[\"$$Q \\in \\mathbb{R}^{n \\times d_k}$$\"]\n    K[\"$$K \\in \\mathbb{R}^{n \\times d_k}$$\"]\n    V[\"$$V \\in \\mathbb{R}^{n \\times d_v}$$\"]\n    scores[\"$$\\frac{QK^T}{\\sqrt{d_k}}$$\"]\n    softmax[\"$$\\text{softmax}(\\cdot)$$\"]\n    output[\"$$\\text{Attention}(Q,K,V)$$\"]\n\n    Q --> scores\n    K --> scores\n    scores --> softmax\n    softmax --> weighted[\"$$\\alpha V$$\"]\n    V --> weighted\n    weighted --> output\n```\n\n### When to Use Math vs Plain Text\n\n- **Use math** when the diagram is for academic\u002Ftechnical audiences and precision matters (papers, lectures, technical docs)\n- **Use plain text** (`\u003Cbr\u002F>` for line breaks) when the diagram is for general audiences or when math would add visual clutter without improving clarity\n- **Default behavior**: If the user's request contains mathematical notation, equations, or Greek symbols, automatically use KaTeX math rendering. Otherwise, use plain text labels.\n\n### Gotchas\n\n- The `$$` delimiters must be **inside quoted strings** — unquoted `$$` will break parsing\n- Backslashes in KaTeX (`\\frac`, `\\sqrt`, etc.) work normally in Mermaid strings\n- Very long formulas may overflow node boxes — break them with `\\\\` (newline in KaTeX) or simplify\n- **Always verify rendering** with `mmdc` — some KaTeX expressions may not render in all environments\n\n## Code Quality Rules\n\nGenerated Mermaid code MUST:\n\n1. Have correct syntax that renders directly\n2. Have clear structure with proper line breaks and indentation\n3. Use semantic node naming (not `A`, `B`, `C` — use `authServer`, `userDB`, etc.)\n4. Include styling when needed to improve visual appearance\n5. Use `\u003Cbr\u002F>` for line breaks inside node labels — never use `\\n`, which renders as literal text\n6. Avoid special characters in labels that break Mermaid parsing (wrap in quotes if needed)\n\n## Output Structure\n\n```\nfigures\u002F\n├── \u003Cdiagram-name>.mmd    # Raw Mermaid source (no markdown fences)\n├── \u003Cdiagram-name>.md     # Markdown with embedded mermaid block\n└── \u003Cdiagram-name>.png    # Rendered PNG (if mmdc available)\n```\n\n## Key Rules (MUST FOLLOW)\n\n1. **ALWAYS save files to `figures\u002F` directory** — Never just output code in chat\n2. **ALWAYS generate BOTH `.mmd` and `.md` files** — They must contain identical Mermaid code\n3. **ALWAYS read the reference documentation** before generating code for a diagram type\n4. **ALWAYS verify syntax** — Run mmdc or manually validate before accepting\n5. **ALWAYS review the rendered PNG** — Read the image and perform STRICT scoring\n6. **NEVER accept score \u003C 9** — Keep refining until excellence\n7. **VERIFY EVERY ARROW DIRECTION** — Wrong direction = automatic fail (score ≤ 6)\n8. **VERIFY EVERY BLOCK CONTENT** — Wrong content = automatic fail (score ≤ 7)\n9. **BE SPECIFIC in feedback** — \"Arrow from A to B points wrong\" not \"arrow is wrong\"\n10. **FIX errors before accepting** — Do not deliver broken diagrams\n11. **Use descriptive file names** — kebab-case derived from the diagram content\n\n---\n\nUser requirements: $ARGUMENTS\n","# Mermaid Diagram Generator\n\nGenerate high-quality Mermaid diagram code based on user requirements, with file output and verification.\n\n## Constants\n\n- **OUTPUT_DIR = `figures\u002F`** — Output directory for all generated files\n- **MAX_ITERATIONS = 3** — Maximum refinement rounds for syntax errors\n\n## Workflow: MUST EXECUTE ALL STEPS\n\n### Step 0: Pre-flight Check\n\n```bash\n# Create output directory\nmkdir -p figures\n```\n\n### Step 1: Understand Requirements & Select Diagram Type\n\nParse the input: **$ARGUMENTS**\n\n1. Analyze user description to determine the most suitable diagram type\n2. Read the corresponding syntax reference documentation (see Step 2 below)\n3. **If the diagram involves mathematical notation** (formulas, equations, Greek letters, subscripts, superscripts, fractions, matrices, etc.), apply the math syntax rules from the **Math Formulas in Diagrams** section below\n4. Identify all components, connections, and data flow\n5. Plan the diagram structure\n\n### Step 2: Read Documentation\n\nSelect the appropriate diagram type based on the use case. Use your built-in knowledge of Mermaid syntax, or fetch up-to-date docs via the context7 MCP server if needed.\n\n| Type | Use Cases |\n| ---- | --------- |\n| Flowchart | Processes, decisions, steps |\n| Sequence Diagram | Interactions, messaging, API calls |\n| Class Diagram | Class structure, inheritance, associations |\n| State Diagram | State machines, state transitions |\n| ER Diagram | Database design, entity relationships |\n| Gantt Chart | Project planning, timelines |\n| Pie Chart | Proportions, distributions |\n| Mindmap | Hierarchical structures, knowledge graphs |\n| Timeline | Historical events, milestones |\n| Git Graph | Branches, merges, versions |\n| Quadrant Chart | Four-quadrant analysis |\n| Requirement Diagram | Requirements traceability |\n| C4 Diagram | System architecture (C4 model) |\n| Sankey Diagram | Flow, conversions |\n| XY Chart | Line charts, bar charts |\n| Block Diagram | System components, modules |\n| Packet Diagram | Network protocols, data structures |\n| Kanban | Task management, workflows |\n| Architecture Diagram | System architecture |\n| Radar Chart | Multi-dimensional comparison |\n| Treemap | Hierarchical data visualization |\n| User Journey | User experience flows |\n| ZenUML | Sequence diagrams (code style) |\n\n### Configuration & Themes\n\n- **Theming** - Custom colors and styles\n- **Directives** - Diagram-level configuration\n- **Layouts** - Layout direction and spacing\n- **Configuration** - Global settings\n- **Math** - LaTeX math support (see Math Formulas in Diagrams section below)\n\n### Step 3: Generate Mermaid Code & Save Files\n\nGenerate the Mermaid code following the reference specification, then save TWO files:\n\n#### File 1: `figures\u002F\u003Cdiagram-name>.mmd` — Raw Mermaid source\n\nThe `.mmd` file contains ONLY the raw Mermaid code (no markdown fences). Example:\n\n```\nflowchart TD\n    A[Start] --> B{Condition}\n    B -->|Yes| C[Execute]\n    B -->|No| D[End]\n    C --> D\n```\n\n#### File 2: `figures\u002F\u003Cdiagram-name>.md` — Markdown with embedded Mermaid\n\nThe `.md` file wraps the same code in a mermaid code block for preview rendering, plus a title and description. Example:\n\n```markdown\n# Diagram Title\n\nBrief description of what this diagram shows.\n\n​```mermaid\nflowchart TD\n    A[Start] --> B{Condition}\n    B -->|Yes| C[Execute]\n    B -->|No| D[End]\n    C --> D\n​```\n```\n\n**Naming convention**: Use a descriptive kebab-case name derived from the user's request (e.g., `auth-flow`, `system-architecture`, `database-er`).\n\n### Step 4: Verify Mermaid Syntax (MANDATORY)\n\n**Claude MUST verify the generated Mermaid code by running the Mermaid CLI (`mmdc`).**\n\n```bash\n# Check if mermaid-cli is available\nif command -v mmdc &> \u002Fdev\u002Fnull; then\n    # Render to PNG to verify syntax is correct\n    mmdc -i figures\u002F\u003Cdiagram-name>.mmd -o figures\u002F\u003Cdiagram-name>.png -b transparent \\\n        && echo \"✅ Syntax valid — PNG rendered to figures\u002F\u003Cdiagram-name>.png\"\nelse\n    # Try npx as fallback\n    npx -y @mermaid-js\u002Fmermaid-cli@latest -i figures\u002F\u003Cdiagram-name>.mmd -o figures\u002F\u003Cdiagram-name>.png -b transparent \\\n        && echo \"✅ Syntax valid — PNG rendered to figures\u002F\u003Cdiagram-name>.png\"\nfi\n```\n\n**If the verification fails:**\n1. Read the error message carefully\n2. Fix the syntax issue in both `.mmd` and `.md` files\n3. Re-run verification\n4. Repeat up to MAX_ITERATIONS (3) times\n\n### Step 5: Claude STRICT Visual Review & Scoring (MANDATORY)\n\nAfter successful rendering, Claude MUST read the generated PNG and perform a STRICT review:\n\n```markdown\n## Claude's STRICT Review of \u003Cdiagram-name>\n\n### What I See\n[Describe the rendered diagram in DETAIL - every block, every arrow, every label]\n\n### Files Generated\n- `figures\u002F\u003Cdiagram-name>.mmd` — Raw Mermaid source\n- `figures\u002F\u003Cdiagram-name>.md` — Markdown with embedded diagram\n- `figures\u002F\u003Cdiagram-name>.png` — Rendered PNG (if mmdc available)\n\n### ═══════════════════════════════════════════════════════════════\n### STRICT VERIFICATION CHECKLIST (ALL must pass for score ≥ 9)\n### ═══════════════════════════════════════════════════════════════\n\n#### A. File Correctness\n- [ ] `.mmd` file contains valid Mermaid syntax (no markdown fences)\n- [ ] `.md` file has the mermaid code wrapped in ```mermaid``` fences\n- [ ] `.mmd` and `.md` contain IDENTICAL Mermaid code\n- [ ] Diagram renders without errors (via mmdc)\n\n#### B. Arrow Correctness Verification (CRITICAL - any failure = score ≤ 6)\nCheck EACH arrow:\n- [ ] Arrow 1: [Source] → [Target] — Does it point to the CORRECT target?\n- [ ] Arrow 2: [Source] → [Target] — Does it point to the CORRECT target?\n- [ ] ... (check ALL arrows)\n\n#### C. Block Content Verification (any failure = score ≤ 7)\nCheck EACH block\u002Fnode:\n- [ ] Block 1 \"[Name]\": Has correct label? Content correct?\n- [ ] Block 2 \"[Name]\": Has correct label? Content correct?\n- [ ] ... (check ALL blocks)\n\n#### D. Completeness\n- [ ] All components from user requirements are present\n- [ ] All connections\u002Farrows are correct\n- [ ] Node labels are meaningful and match requirements\n\n#### E. Visual Quality\n- [ ] Layout is clean and readable\n- [ ] Color scheme is professional (not rainbow)\n- [ ] Text is readable at normal zoom\n- [ ] Proper spacing (not cramped, not sparse)\n- [ ] Data flow is traceable in 5 seconds\n\n### ═══════════════════════════════════════════════════════════════\n\n### Issues Found (BE SPECIFIC)\n1. [Issue 1]: [EXACTLY what is wrong] → [How to fix]\n2. [Issue 2]: [EXACTLY what is wrong] → [How to fix]\n\n### Score: X\u002F10\n\n### Score Breakdown Guide:\n- **10**: Perfect. No issues. Publication-ready.\n- **9**: Excellent. Minor issues that don't affect understanding.\n- **8**: Good but has noticeable issues (layout, styling).\n- **7**: Usable but has clear problems (wrong arrows, missing labels).\n- **6**: Has arrow direction errors or missing major components.\n- **1-5**: Major issues. Unacceptable.\n\n### Verdict\n[ ] ACCEPT (score ≥ 9 AND all critical checks pass)\n[ ] FIX (score \u003C 9 OR any critical check fails — list EXACT fixes needed)\n```\n\n**If FIX: apply corrections to both `.mmd` and `.md` files, re-render, and re-verify. Loop until ACCEPT or MAX_ITERATIONS reached.**\n\n### Step 6: Final Output Summary\n\nWhen accepted, present to user:\n\n```\n✅ Mermaid diagram generated successfully!\n\nFiles:\n  figures\u002F\u003Cdiagram-name>.mmd  — Raw Mermaid source (use with mmdc, editors, CI)\n  figures\u002F\u003Cdiagram-name>.md   — Markdown preview (renders on GitHub, VS Code, etc.)\n  figures\u002F\u003Cdiagram-name>.png  — Rendered image (if mmdc was available)\n\nTo re-render manually:\n  mmdc -i figures\u002F\u003Cdiagram-name>.mmd -o figures\u002F\u003Cdiagram-name>.png\n```\n\n## Architecture Diagram Best Practices\n\nWhen generating `architecture-beta` diagrams, apply these layout techniques for complex diagrams:\n\n### Use Junctions for Layout Control\n\nThink of the diagram as an invisible grid. Use `junction` nodes as virtual anchor points on that grid to precisely control where each component is placed. This is especially useful when a direct edge between two services produces unexpected positioning.\n\nInstead of connecting services directly:\n\n```\nlb:R --> L:scim\nlb:R --> L:webapi\n```\n\nRoute through junctions to control vertical\u002Fhorizontal placement:\n\n```\njunction j_lb_r\nlb:R -- L:j_lb_r\njunction j_scim_l\nj_lb_r:T -- B:j_scim_l\nj_scim_l:R --> L:scim\njunction j_webapi_l\nj_lb_r:B -- T:j_webapi_l\nj_webapi_l:R --> L:webapi\n```\n\nPlace junctions on all four sides of components to anchor them logically on the grid.\n\n### Use Edges out of Groups for Floating Components\n\nFor services that have no logical connection to other nodes (e.g. a deployment tool, a monitoring agent), use a junction combined with the `{group}` modifier to position them without adding a semantically incorrect edge:\n\n```\njunction j_acd_t\nj_algolia_proc_b{group}:B -- T:j_acd_t\nj_acd_t:B -- T:acd\n```\n\nThis anchors `acd` below its intended neighbor without implying a real relationship.\n\n## CVPR\u002FICLR\u002FNeurIPS Style Guide (for Academic Diagrams)\n\nWhen the diagram is intended for academic papers, apply these style standards:\n\n### Visual Standards\n- **Clean white background** — No decorative patterns or gradients (unless subtle)\n- **Sans-serif fonts** — Arial, Helvetica, or Computer Modern; minimum 14pt\n- **Subtle color palette** — Not rainbow colors; use 3-5 coordinated colors\n- **Print-friendly** — Must be readable in grayscale (many reviewers print papers)\n- **Professional borders** — Thin (2-3px), solid colors, not flashy\n\n### Layout Standards\n- **Horizontal flow** — Left-to-right is the standard for pipelines\n- **Clear grouping** — Use subtle background boxes to group related modules\n- **Consistent sizing** — Similar components should have similar sizes\n- **Balanced whitespace** — Not cramped, not sparse\n\n### Arrow Standards (MOST CRITICAL)\n- **Thick strokes** — 4-6px minimum (thin arrows disappear when printed)\n- **Clear arrowheads** — Large, filled triangular heads\n- **Dark colors** — Black or dark gray (#333333); avoid colored arrows\n- **Labeled** — Every arrow should indicate what data flows through it\n- **No crossings** — Reorganize layout to avoid arrow crossings\n- **CORRECT DIRECTION** — Arrows must point to the RIGHT target!\n\n### Color Palette (Academic Professional)\n- **Inputs**: Green (#10B981 \u002F #34D399)\n- **Encoders**: Blue (#2563EB \u002F #3B82F6)\n- **Fusion**: Purple (#7C3AED \u002F #8B5CF6)\n- **Outputs**: Orange (#EA580C \u002F #F97316)\n- **Arrows**: Black or dark gray (#333333 \u002F #1F2937)\n- **Background**: Pure white (#FFFFFF)\n\n### What to AVOID\n- Rainbow color schemes (too many colors)\n- Thin, hairline arrows\n- Heavy drop shadows or glowing effects\n- 3D effects \u002F perspective\n- Excessive decorative icons\n- Small text that's unreadable when printed\n\n## Math Formulas in Diagrams (KaTeX)\n\nMermaid supports rendering mathematical expressions via KaTeX (v10.9.0+). **When the diagram content involves math** (formulas, equations, Greek letters, subscripts\u002Fsuperscripts, fractions, matrices, operators, etc.), use KaTeX notation instead of plain-text approximations.\n\n### Supported Diagram Types for Math\n\nMath rendering with `$$...$$` is supported in:\n- **Flowcharts** (`flowchart` \u002F `graph`) — in node labels and edge labels\n- **Sequence Diagrams** — in participant aliases, messages, and notes\n\n### Syntax Rules\n\n1. **Wrap math expressions in `$$` delimiters** inside quoted strings:\n   ```\n   A[\"$$x^2$$\"] -->|\"$$\\sqrt{x+3}$$\"| B(\"$$\\frac{1}{2}$$\")\n   ```\n\n2. **Node labels with math MUST be quoted** — use `[\"$$...$$\"]` or `(\"$$...$$\")`:\n   ```\n   scaledDot[\"$$\\text{softmax}\\left(\\frac{QK^T}{\\sqrt{d_k}}\\right)V$$\"]\n   ```\n\n3. **Mix text and math** by placing `$$` only around the math portion:\n   ```\n   layer1[\"Linear Layer $$W_1 x + b_1$$\"]\n   ```\n\n4. **Use `\\text{}`** for non-math text inside a `$$` block:\n   ```\n   node[\"$$\\text{Attention}(Q, K, V)$$\"]\n   ```\n\n### Common Math Patterns for ML\u002FScience Diagrams\n\n| Concept | KaTeX Syntax | Renders As |\n| ------- | ------------ | ---------- |\n| Subscript | `$$W_Q$$` | W_Q |\n| Superscript | `$$x^2$$` | x² |\n| Fraction | `$$\\frac{QK^T}{\\sqrt{d_k}}$$` | QK^T \u002F sqrt(d_k) |\n| Greek letters | `$$\\alpha, \\beta, \\gamma$$` | α, β, γ |\n| Square root | `$$\\sqrt{d_k}$$` | √d_k |\n| Summation | `$$\\sum_{i=1}^{n} x_i$$` | Σx_i |\n| Matrix | `$$\\begin{bmatrix} a & b \\\\ c & d \\end{bmatrix}$$` | 2x2 matrix |\n| Softmax | `$$\\text{softmax}(z_i)$$` | softmax(z_i) |\n| Norm | `$$\\|\\|x\\|\\|_2$$` | ‖x‖₂ |\n| Hat\u002Ftilde | `$$\\hat{y}, \\tilde{x}$$` | ŷ, x̃ |\n\n### Example: Attention Mechanism with Math\n\n```\nflowchart TD\n    Q[\"$$Q \\in \\mathbb{R}^{n \\times d_k}$$\"]\n    K[\"$$K \\in \\mathbb{R}^{n \\times d_k}$$\"]\n    V[\"$$V \\in \\mathbb{R}^{n \\times d_v}$$\"]\n    scores[\"$$\\frac{QK^T}{\\sqrt{d_k}}$$\"]\n    softmax[\"$$\\text{softmax}(\\cdot)$$\"]\n    output[\"$$\\text{Attention}(Q,K,V)$$\"]\n\n    Q --> scores\n    K --> scores\n    scores --> softmax\n    softmax --> weighted[\"$$\\alpha V$$\"]\n    V --> weighted\n    weighted --> output\n```\n\n### When to Use Math vs Plain Text\n\n- **Use math** when the diagram is for academic\u002Ftechnical audiences and precision matters (papers, lectures, technical docs)\n- **Use plain text** (`\u003Cbr\u002F>` for line breaks) when the diagram is for general audiences or when math would add visual clutter without improving clarity\n- **Default behavior**: If the user's request contains mathematical notation, equations, or Greek symbols, automatically use KaTeX math rendering. Otherwise, use plain text labels.\n\n### Gotchas\n\n- The `$$` delimiters must be **inside quoted strings** — unquoted `$$` will break parsing\n- Backslashes in KaTeX (`\\frac`, `\\sqrt`, etc.) work normally in Mermaid strings\n- Very long formulas may overflow node boxes — break them with `\\\\` (newline in KaTeX) or simplify\n- **Always verify rendering** with `mmdc` — some KaTeX expressions may not render in all environments\n\n## Code Quality Rules\n\nGenerated Mermaid code MUST:\n\n1. Have correct syntax that renders directly\n2. Have clear structure with proper line breaks and indentation\n3. Use semantic node naming (not `A`, `B`, `C` — use `authServer`, `userDB`, etc.)\n4. Include styling when needed to improve visual appearance\n5. Use `\u003Cbr\u002F>` for line breaks inside node labels — never use `\\n`, which renders as literal text\n6. Avoid special characters in labels that break Mermaid parsing (wrap in quotes if needed)\n\n## Output Structure\n\n```\nfigures\u002F\n├── \u003Cdiagram-name>.mmd    # Raw Mermaid source (no markdown fences)\n├── \u003Cdiagram-name>.md     # Markdown with embedded mermaid block\n└── \u003Cdiagram-name>.png    # Rendered PNG (if mmdc available)\n```\n\n## Key Rules (MUST FOLLOW)\n\n1. **ALWAYS save files to `figures\u002F` directory** — Never just output code in chat\n2. **ALWAYS generate BOTH `.mmd` and `.md` files** — They must contain identical Mermaid code\n3. **ALWAYS read the reference documentation** before generating code for a diagram type\n4. **ALWAYS verify syntax** — Run mmdc or manually validate before accepting\n5. **ALWAYS review the rendered PNG** — Read the image and perform STRICT scoring\n6. **NEVER accept score \u003C 9** — Keep refining until excellence\n7. **VERIFY EVERY ARROW DIRECTION** — Wrong direction = automatic fail (score ≤ 6)\n8. **VERIFY EVERY BLOCK CONTENT** — Wrong content = automatic fail (score ≤ 7)\n9. **BE SPECIFIC in feedback** — \"Arrow from A to B points wrong\" not \"arrow is wrong\"\n10. **FIX errors before accepting** — Do not deliver broken diagrams\n11. **Use descriptive file names** — kebab-case derived from the diagram content\n\n---\n\nUser requirements: $ARGUMENTS\n",{"name":5,"description":7,"allowed-tools":24,"argument-hint":25},"Bash(*), Read, Write, Edit, Glob, Grep","[diagram description or requirements]","main","18193d71ea3441d7c033dbf195b8a7c75ac96f75","packages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Faris\u002Fskills\u002Fmermaid-diagram",0,"https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science","https:\u002F\u002Fgithub.com\u002FCZX-LBJ","一个没事喜欢随便写点代码的小菜鸡\r\n","2026-10-22 09:48:04",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add CZX-LBJ\u002Fdeepseek-science --skill mermaid-diagram",{"tool":40,"command":41},"bunx","bunx skills add CZX-LBJ\u002Fdeepseek-science --skill mermaid-diagram",{"tool":43,"command":44},"pnpm","pnpm dlx skills add CZX-LBJ\u002Fdeepseek-science --skill mermaid-diagram","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Faris\u002Fskills\u002Fmermaid-diagram\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7FEEKSNMRMKW6JEK93PFDFY","bio-free-energy-calculations","Performs alchemical free-energy calculations including relative binding free energy (RBFE \u002F FEP+) and absolute binding free energy (ABFE) via OpenFE, FEP+, GROMACS, AMBER pmemd, and OpenMM with explicit lambda scheduling, soft-core potentials, MBAR\u002FBAR analysis, cycle-closure validation, and protocol-appropriate enhanced sampling. Compares ML alternatives (Boltz-2 affinity, DeepDock). Use when ranking analogs by binding affinity beyond docking accuracy, performing prospective lead optimization, or validating SAR predictions.","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Fbioskills\u002Fchemoinformatics\u002Ffree-energy-calculations\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7FEE5CTE5QK55CEMXNNVWY9","bio-conformer-generation","Generates 3D conformer ensembles using RDKit ETKDGv3 with knowledge-enhanced distance geometry, MMFF94\u002FUFF force-field optimization, CREST + GFN2-xTB semi-empirical refinement, and macrocycle-aware torsion preferences. Provides explicit decision rules for single vs ensemble conformer use, RMSD pruning, energy windows, conformer count, and force-field choice. Use when preparing 3D ligands for docking, generating descriptor input for 3D QSAR, or sampling macrocycle\u002Fpeptide conformational ensembles.","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Fbioskills\u002Fchemoinformatics\u002Fconformer-generation\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7FEDNGFEMFWD1MSEDR5H7CY","bio-admet-prediction","Predicts ADMET properties using ADMETlab 3.0 (119 platform features, including 77 prediction models with modeled-endpoint uncertainty), ADMET-AI, DeepChem MolNet, and chemprop D-MPNN with explicit handling of OECD QSAR principles, applicability domain assessment, calibration, hERG\u002FCYP\u002FAMES endpoints, and PAINS \u002F Lipinski \u002F Ro5 \u002F Veber \u002F BBB druglikeness filters. Use when filtering compounds for drug-likeness, prioritizing leads by predicted safety, or building an in-house ADMET QSAR model.","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Fbioskills\u002Fchemoinformatics\u002Fadmet-prediction\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7FED69GFB54FRF7AV5066DN","writing-systems-papers","Paragraph-level structural blueprint for 10-12 page systems papers targeting OSDI, SOSP, ASPLOS, NSDI, and EuroSys. Provides page allocation, paragraph templates, and writing patterns. Use when user says \"写系统论文\", \"systems paper structure\", \"OSDI paper\", \"SOSP paper\", or wants fine-grained structural guidance for a systems conference submission.","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Faris\u002Fskills\u002Fwriting-systems-papers\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7FECVVDWZ0X0VEDTCE4B4DZ","wiki-enrich","Fill in the per-paper TODO sections of research-wiki\u002Fpapers\u002F\u003Cslug>.md pages that literature-ingest skills leave as bare scaffolds. Use when user says 'enrich wiki', 'fill paper TODOs', 'wiki body 補完', '把 paper 摘要寫進 wiki', 'research-wiki 自動填', or after a batch ingest that left papers\u002F as TODO scaffolds.","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Faris\u002Fskills\u002Fwiki-enrich\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7FECD4BCJ2MTSBDDSE3ZAJ5","web-debug-search","Search GitHub, Stack Exchange, Chinese technical communities, official documentation, and general developer web sources for software errors, compatibility problems, API usage questions, and real-world workarounds. Use for debugging and discovery only; results are not paper-citation evidence.","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Faris\u002Fskills\u002Fweb-debug-search\u002FSKILL.md",[],[]]