본문으로 건너뛰기
Skillpedia
이미지 및 아이콘18k · #10553

mermaid-diagram

하는 일

이 스킬은 차트와 다이어그램을 위한 텍스트 형식인 Mermaid로 다이어그램 코드를 쓰고, 그 코드가 올바른지 확인합니다. 글로 된 설명에서 빠르게 다이어그램이 필요한 사람을 위한 스킬입니다.

사용하는 경우

  • ✓글로 된 설명에서 순서도, 시퀀스 다이어그램, 타임라인이 필요할 때.
  • ✓문서나 위키 페이지에 붙여 넣을 수 있는 다이어그램 코드를 원할 때.
  • ✓수학 표기가 들어 있어 깔끔한 서식이 필요한 다이어그램이 있을 때.

스킬 링크

https://github.com/wanshuiyin/Auto-claude-code-research-in-sleep/blob/main/skills/mermaid-diagram/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/wanshuiyin/Auto-claude-code-research-in-sleep/blob/main/skills/mermaid-diagram/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“제 주문 처리 과정의 Mermaid 순서도를 만들어 주세요. 문서에 붙여 넣을 수 있게 파일로 저장해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 알맞은 다이어그램 종류를 고르고 Mermaid 코드를 쓴 뒤, figures 폴더에 저장합니다. 문법을 확인하고, 문법 오류가 있으면 몇 라운드에 걸쳐 고칩니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Mermaid Diagram Generator

Generate high-quality Mermaid diagram code based on user requirements, with file output and verification.

Constants

  • OUTPUT_DIR = figures/ — Output directory for all generated files
  • MAX_ITERATIONS = 3 — Maximum refinement rounds for syntax errors

Workflow: MUST EXECUTE ALL STEPS

Step 0: Pre-flight Check

# Create output directory
mkdir -p figures

Step 1: Understand Requirements & Select Diagram Type

Parse the input: $ARGUMENTS

  1. Analyze user description to determine the most suitable diagram type
  2. Read the corresponding syntax reference documentation (see Step 2 below)
  3. 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
  4. Identify all components, connections, and data flow
  5. Plan the diagram structure

Step 2: Read Documentation

Select 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.

Type Use Cases
Flowchart Processes, decisions, steps
Sequence Diagram Interactions, messaging, API calls
Class Diagram Class structure, inheritance, associations
State Diagram State machines, state transitions
ER Diagram Database design, entity relationships
Gantt Chart Project planning, timelines
Pie Chart Proportions, distributions
Mindmap Hierarchical structures, knowledge graphs
Timeline Historical events, milestones
Git Graph Branches, merges, versions
Quadrant Chart Four-quadrant analysis
Requirement Diagram Requirements traceability
C4 Diagram System architecture (C4 model)
Sankey Diagram Flow, conversions
XY Chart Line charts, bar charts
Block Diagram System components, modules
Packet Diagram Network protocols, data structures
Kanban Task management, workflows
Architecture Diagram System architecture
Radar Chart Multi-dimensional comparison
Treemap Hierarchical data visualization
User Journey User experience flows
ZenUML Sequence diagrams (code style)

Configuration & Themes

  • Theming - Custom colors and styles
  • Directives - Diagram-level configuration
  • Layouts - Layout direction and spacing
  • Configuration - Global settings
  • Math - LaTeX math support (see Math Formulas in Diagrams section below)

Step 3: Generate Mermaid Code & Save Files

Generate the Mermaid code following the reference specification, then save TWO files:

File 1: figures/<diagram-name>.mmd — Raw Mermaid source

The .mmd file contains ONLY the raw Mermaid code (no markdown fences). Example:

flowchart TD
    A[Start] --> B{Condition}
    B -->|Yes| C[Execute]
    B -->|No| D[End]
    C --> D

File 2: figures/<diagram-name>.md — Markdown with embedded Mermaid

The .md file wraps the same code in a mermaid code block for preview rendering, plus a title and description. Example:

# Diagram Title

Brief description of what this diagram shows.

​```mermaid
flowchart TD
    A[Start] --> B{Condition}
    B -->|Yes| C[Execute]
    B -->|No| D[End]
    C --> D
​```

Naming convention: Use a descriptive kebab-case name derived from the user's request (e.g., auth-flow, system-architecture, database-er).

Step 4: Verify Mermaid Syntax (MANDATORY)

Claude MUST verify the generated Mermaid code by running the Mermaid CLI (mmdc).

# Check if mermaid-cli is available
if command -v mmdc &> /dev/null; then
    # Render to PNG to verify syntax is correct
    mmdc -i figures/<diagram-name>.mmd -o figures/<diagram-name>.png -b transparent \
        && echo "✅ Syntax valid — PNG rendered to figures/<diagram-name>.png"
else
    # Try npx as fallback
    npx -y @mermaid-js/mermaid-cli@latest -i figures/<diagram-name>.mmd -o figures/<diagram-name>.png -b transparent \
        && echo "✅ Syntax valid — PNG rendered to figures/<diagram-name>.png"
fi

If the verification fails:

  1. Read the error message carefully
  2. Fix the syntax issue in both .mmd and .md files
  3. Re-run verification
  4. Repeat up to MAX_ITERATIONS (3) times

Step 5: Claude STRICT Visual Review & Scoring (MANDATORY)

After successful rendering, Claude MUST read the generat

자주 묻는 질문

지원하는 다이어그램 종류는 몇 개인가요?

순서도, 시퀀스, 클래스, ER, 간트 차트를 포함해 스무 종이 넘는 종류를 다룹니다.

파일은 어디에 저장되나요?

기본적으로 프로젝트의 figures 폴더에 저장됩니다.

문법 오류를 고칠 수 있나요?

네. 문법 오류가 있으면 최대 세 라운드까지 코드를 다듬습니다.

상세 정보

작성자의 원본 설명

Generate Mermaid diagrams from user requirements. Supports flowcharts, sequence diagrams, class diagrams, ER diagrams, Gantt charts, and 18 more diagram types.

repo: wanshuiyin/Auto-claude-code-research-in-sleep

인기도

GitHub 스타
18k
순위
#10553
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬