重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
slidev-mermaid by yoanbernabeu/slidev-skills
npx skills add https://github.com/yoanbernabeu/slidev-skills --skill slidev-mermaid此技能涵盖在 Slidev 演示文稿中使用 Mermaid 语法创建可视化图表。Mermaid 允许您使用简单的文本创建流程图、序列图、类图以及许多其他类型的图表。
使用带有 mermaid 语言的代码块:
graph TD
A[Start] --> B[Process]
B --> C[End]
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
C --> E[End]
D --> E
graph LR
A[Input] --> B[Process] --> C[Output]
graph TD
A[Rectangle]
B(Rounded)
C([Stadium])
D[[Subroutine]]
E[(Database)]
F((Circle))
G>Asymmetric]
H{Diamond}
I{{Hexagon}}
J[/Parallelogram/]
K[\Parallelogram Alt\]
</v-click>
<v-click>
</v-click>
```
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
graph LR
A --> B
C --- D
E -.-> F
G ==> H
I --text--> J
K ---|text| L
sequenceDiagram
participant U as User
participant S as Server
participant D as Database
U->>S: Request
S->>D: Query
D-->>S: Result
S-->>U: Response
sequenceDiagram
participant C as Client
participant S as Server
C->>+S: Login Request
S->>S: Validate
S-->>-C: Token
C->>+S: API Call
S-->>-C: Data
sequenceDiagram
participant A as Alice
participant B as Bob
Note over A: Alice thinks
A->>B: Hello Bob!
Note over A,B: Shared note
loop Every minute
A->>B: Are you there?
end
alt Success
B-->>A: Yes!
else Failure
B-->>A: No response
end
classDiagram
class Animal {
+String name
+int age
+makeSound()
}
class Dog {
+String breed
+bark()
}
class Cat {
+meow()
}
Animal <|-- Dog
Animal <|-- Cat
classDiagram
classA --|> classB : Inheritance
classC --* classD : Composition
classE --o classF : Aggregation
classG --> classH : Association
classI -- classJ : Link
classK ..> classL : Dependency
classM ..|> classN : Realization
stateDiagram-v2
[*] --> Idle
Idle --> Processing: Start
Processing --> Success: Complete
Processing --> Error: Fail
Success --> [*]
Error --> Idle: Retry
stateDiagram-v2
[*] --> Active
state Active {
[*] --> Idle
Idle --> Running: Start
Running --> Paused: Pause
Paused --> Running: Resume
Running --> Idle: Stop
}
Active --> [*]: Shutdown
erDiagram
USER ||--o{ ORDER : places
USER {
int id PK
string name
string email
}
ORDER ||--|{ LINE_ITEM : contains
ORDER {
int id PK
date created
string status
}
PRODUCT ||--o{ LINE_ITEM : includes
PRODUCT {
int id PK
string name
float price
}
LINE_ITEM {
int quantity
}
gantt
title Project Timeline
dateFormat YYYY-MM-DD
section Planning
Requirements :a1, 2024-01-01, 7d
Design :a2, after a1, 5d
section Development
Backend :b1, after a2, 14d
Frontend :b2, after a2, 14d
section Testing
QA :c1, after b1, 7d
UAT :c2, after c1, 3d
pie title Language Usage
"JavaScript" : 45
"Python" : 25
"TypeScript" : 20
"Other" : 10
gitGraph
commit
commit
branch feature
checkout feature
commit
commit
checkout main
merge feature
commit
mindmap
root((Slidev))
Features
Markdown
Vue Components
Animations
Tech Stack
Vite
Vue 3
UnoCSS
Export
PDF
PPTX
SPA
timeline
title History of Slidev
2020 : Project Started
2021 : v0.1 Released
: Theme System Added
2022 : Monaco Editor
: Magic Move
2023 : v0.40
: Improved Animations
2024 : v0.50
: Browser Export
graph TD
A --> B --> C
可用主题:default, neutral, dark, forest, base
graph TD
A --> B --> C
graph LR
A --> B --> C --> D
graph TD
A[Important]:::important --> B[Normal]
B --> C[Warning]:::warning
classDef important fill:#f96,stroke:#333,stroke-width:2px
classDef warning fill:#ff0,stroke:#333
graph LR
A --> B
B --> C
linkStyle 0 stroke:#f00,stroke-width:2px
linkStyle 1 stroke:#0f0,stroke-width:2px
创建 setup/mermaid.ts:
import { defineMermaidSetup } from '@slidev/types'
export default defineMermaidSetup(() => {
return {
theme: 'neutral',
themeVariables: {
primaryColor: '#3b82f6',
primaryTextColor: '#fff',
primaryBorderColor: '#2563eb',
lineColor: '#64748b',
secondaryColor: '#f1f5f9',
},
}
})
❌ 过于复杂
20+ nodes, crossing lines everywhere
✓ 清晰且重点突出
5-10 nodes, logical flow
❌ 模糊的标签
graph TD
A --> B --> C
✓ 描述性标签
graph TD
Request[HTTP Request] --> Auth[Authentication]
Auth --> Response[JSON Response]
| 内容 | 图表类型 |
|---|---|
| 流程 | 流程图 |
| API 调用 | 序列图 |
| 数据模型 | 类图/实体关系图 |
| 项目时间线 | 甘特图 |
| 分布情况 | 饼图 |
| 层级结构 | 思维导图 |
使用 v-click 来逐步显示图表部分:
<v-click>
```mermaid
graph TD
A --> B
graph TD
A --> B --> C
graph TB
subgraph Client
UI[Web App]
Mobile[Mobile App]
end
subgraph Backend
API[API Gateway]
Auth[Auth Service]
Core[Core Service]
end
subgraph Data
DB[(PostgreSQL)]
Cache[(Redis)]
end
UI --> API
Mobile --> API
API --> Auth
API --> Core
Core --> DB
Core --> Cache
sequenceDiagram
actor User
participant FE as Frontend
participant BE as Backend
participant DB as Database
User->>FE: Click Button
FE->>BE: POST /api/action
BE->>DB: INSERT
DB-->>BE: OK
BE-->>FE: 201 Created
FE-->>User: Success Toast
创建图表时:
DIAGRAM PURPOSE: [What it illustrates]
DIAGRAM TYPE: [flowchart/sequence/class/etc.]
```mermaid {[options]}
[diagram code]
关键元素:
样式说明:
每周安装量
60
仓库
GitHub 星标数
22
首次出现
2026年1月25日
安全审计
安装于
opencode47
gemini-cli46
codex46
github-copilot45
cursor44
kimi-cli44
This skill covers creating visual diagrams using Mermaid syntax in Slidev presentations. Mermaid allows you to create flowcharts, sequence diagrams, class diagrams, and many other diagram types using simple text.
Use a code block with mermaid language:
```mermaid
graph TD
A[Start] --> B[Process]
B --> C[End]
```
```mermaid
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
C --> E[End]
D --> E
```
```mermaid
graph LR
A[Input] --> B[Process] --> C[Output]
```
```mermaid
graph TD
A[Rectangle]
B(Rounded)
C([Stadium])
D[[Subroutine]]
E[(Database)]
F((Circle))
G>Asymmetric]
H{Diamond}
I{{Hexagon}}
J[/Parallelogram/]
K[\Parallelogram Alt\]
```
```mermaid
graph LR
A --> B
C --- D
E -.-> F
G ==> H
I --text--> J
K ---|text| L
```
```mermaid
sequenceDiagram
participant U as User
participant S as Server
participant D as Database
U->>S: Request
S->>D: Query
D-->>S: Result
S-->>U: Response
```
```mermaid
sequenceDiagram
participant C as Client
participant S as Server
C->>+S: Login Request
S->>S: Validate
S-->>-C: Token
C->>+S: API Call
S-->>-C: Data
```
```mermaid
sequenceDiagram
participant A as Alice
participant B as Bob
Note over A: Alice thinks
A->>B: Hello Bob!
Note over A,B: Shared note
loop Every minute
A->>B: Are you there?
end
alt Success
B-->>A: Yes!
else Failure
B-->>A: No response
end
```
```mermaid
classDiagram
class Animal {
+String name
+int age
+makeSound()
}
class Dog {
+String breed
+bark()
}
class Cat {
+meow()
}
Animal <|-- Dog
Animal <|-- Cat
```
```mermaid
classDiagram
classA --|> classB : Inheritance
classC --* classD : Composition
classE --o classF : Aggregation
classG --> classH : Association
classI -- classJ : Link
classK ..> classL : Dependency
classM ..|> classN : Realization
```
```mermaid
stateDiagram-v2
[*] --> Idle
Idle --> Processing: Start
Processing --> Success: Complete
Processing --> Error: Fail
Success --> [*]
Error --> Idle: Retry
```
```mermaid
stateDiagram-v2
[*] --> Active
state Active {
[*] --> Idle
Idle --> Running: Start
Running --> Paused: Pause
Paused --> Running: Resume
Running --> Idle: Stop
}
Active --> [*]: Shutdown
```
```mermaid
erDiagram
USER ||--o{ ORDER : places
USER {
int id PK
string name
string email
}
ORDER ||--|{ LINE_ITEM : contains
ORDER {
int id PK
date created
string status
}
PRODUCT ||--o{ LINE_ITEM : includes
PRODUCT {
int id PK
string name
float price
}
LINE_ITEM {
int quantity
}
```
```mermaid
gantt
title Project Timeline
dateFormat YYYY-MM-DD
section Planning
Requirements :a1, 2024-01-01, 7d
Design :a2, after a1, 5d
section Development
Backend :b1, after a2, 14d
Frontend :b2, after a2, 14d
section Testing
QA :c1, after b1, 7d
UAT :c2, after c1, 3d
```
```mermaid
pie title Language Usage
"JavaScript" : 45
"Python" : 25
"TypeScript" : 20
"Other" : 10
```
```mermaid
gitGraph
commit
commit
branch feature
checkout feature
commit
commit
checkout main
merge feature
commit
```
```mermaid
mindmap
root((Slidev))
Features
Markdown
Vue Components
Animations
Tech Stack
Vite
Vue 3
UnoCSS
Export
PDF
PPTX
SPA
```
```mermaid
timeline
title History of Slidev
2020 : Project Started
2021 : v0.1 Released
: Theme System Added
2022 : Monaco Editor
: Magic Move
2023 : v0.40
: Improved Animations
2024 : v0.50
: Browser Export
```
```mermaid {theme: 'neutral'}
graph TD
A --> B --> C
```
Available themes: default, neutral, dark, forest, base
```mermaid {scale: 0.8}
graph TD
A --> B --> C
```
```mermaid {theme: 'neutral', scale: 0.7}
graph LR
A --> B --> C --> D
```
```mermaid
graph TD
A[Important]:::important --> B[Normal]
B --> C[Warning]:::warning
classDef important fill:#f96,stroke:#333,stroke-width:2px
classDef warning fill:#ff0,stroke:#333
```
```mermaid
graph LR
A --> B
B --> C
linkStyle 0 stroke:#f00,stroke-width:2px
linkStyle 1 stroke:#0f0,stroke-width:2px
```
Create setup/mermaid.ts:
import { defineMermaidSetup } from '@slidev/types'
export default defineMermaidSetup(() => {
return {
theme: 'neutral',
themeVariables: {
primaryColor: '#3b82f6',
primaryTextColor: '#fff',
primaryBorderColor: '#2563eb',
lineColor: '#64748b',
secondaryColor: '#f1f5f9',
},
}
})
❌ Too complex
20+ nodes, crossing lines everywhere
✓ Clear and focused
5-10 nodes, logical flow
❌ Vague labels
graph TD
A --> B --> C
✓ Descriptive labels
graph TD
Request[HTTP Request] --> Auth[Authentication]
Auth --> Response[JSON Response]
| Content | Diagram Type |
|---|---|
| Process flow | Flowchart |
| API calls | Sequence |
| Data models | Class/ER |
| Project timeline | Gantt |
| Distribution | Pie |
| Hierarchy | Mind map |
Use v-click to reveal diagram parts:
<v-click>
```mermaid
graph TD
A --> B
```
</v-click>
<v-click>
```mermaid
graph TD
A --> B --> C
```
</v-click>
```mermaid
graph TB
subgraph Client
UI[Web App]
Mobile[Mobile App]
end
subgraph Backend
API[API Gateway]
Auth[Auth Service]
Core[Core Service]
end
subgraph Data
DB[(PostgreSQL)]
Cache[(Redis)]
end
UI --> API
Mobile --> API
API --> Auth
API --> Core
Core --> DB
Core --> Cache
```
```mermaid
sequenceDiagram
actor User
participant FE as Frontend
participant BE as Backend
participant DB as Database
User->>FE: Click Button
FE->>BE: POST /api/action
BE->>DB: INSERT
DB-->>BE: OK
BE-->>FE: 201 Created
FE-->>User: Success Toast
```
When creating diagrams:
DIAGRAM PURPOSE: [What it illustrates]
DIAGRAM TYPE: [flowchart/sequence/class/etc.]
```mermaid {[options]}
[diagram code]
KEY ELEMENTS:
STYLING NOTES:
Weekly Installs
60
Repository
GitHub Stars
22
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode47
gemini-cli46
codex46
github-copilot45
cursor44
kimi-cli44
Claude技能创建器指南:构建模块化AI技能包,优化工作流与工具集成
5,700 周安装
文献检索工具 - 语义搜索PubMed、arXiv、bioRxiv、medRxiv科学文献数据库
249 周安装
Tailwind CSS v4 完全指南:CSS 优先配置、ESLint 集成与最佳实践
256 周安装
视频转GIF工具 - 一键生成多参数GIF变体,支持FFmpeg/gifsicle优化
266 周安装
Claude技能创建器指南 - 构建高效AI技能模块的完整教程与最佳实践
61 周安装
Build工作流编排器:AI驱动的开发流程自动化工具,支持绿地/棕地/TDD/重构
254 周安装
fal.ai AI图像视频生成技能:使用先进AI模型一键生成图像和视频内容
251 周安装