mermaid-packet-diagram
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "mermaid-packet-diagram" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-159fde0ef35a84a0d5720f320bc78dfa20a8124cad96adc488d26d0995328b9b. Verify the upstream source and version against https://skillhub.cn/skills/user_6afd4cd8/mermaid-packet-diagram before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Generates Mermaid packet diagram code from user-provided network protocol or packet structure descriptions; used when users mention keywords like "packet diagram", "packet", or "generate packet diagram".
Introduction source: third_party · user_6afd4cd8 · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Audience
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: mermaid-packet-diagram
description: 用于生成Mermaid数据包图代码。根据用户提供的网络协议或数据包结构描述生成Mermaid代码的数据包图,或当用户提到“数据包图”、“数据包”、“生成数据包图”、“packet diagram”等时使用。
name_zh: Mermaid数据包图生成
name_en: mermaid-packet-diagram
version: 1.0.0
author: duke_xiebo@outlook.com本技能用于根据用户提供的网络协议或数据包结构描述,生成 Mermaid 数据包图(Packet Diagram)代码。数据包图是一种可视化表示网络数据包结构和内容的方式,适用于开发人员、网络工程师、教育工作者和学生。
语法规则
基本结构
所有数据包图以 packet 关键字开头,后续每行定义一个字段:
packet
start-end: "字段名称" %% 范围语法
两种字段定义语法
1. 范围语法(Range Syntax)
精确指定位的起始和结束位置:
packet
0-15: "源端口"
16-31: "目的端口"
32-63: "序列号"
start:字段的起始位索引end:字段的结束位索引"字段名称":用双引号包裹的字段描述
2. 位计数语法(Bits Syntax,v11.7.0+)
使用 +<count> 从前一个字段结束位置自动计算起始位,更易于维护:
packet
+16: "源端口" %% 16位字段
+16: "目的端口" %% 16位字段
+32: "序列号" %% 32位字段
支持混合使用两种语法:
packet
+16: "源端口"
+16: "目的端口"
32-63: "序列号" %% 混合使用范围语法
添加标题
支持两种方式添加标题:
方式一:Frontmatter 方式
---
title: "TCP 数据包"
---
packet
0-15: "源端口"
...
方式二:内联标题方式
packet
title TCP 数据包
+16: "源端口"
...
示例
示例 1:TCP 数据包
---
title: "TCP 数据包"
---
packet
0-15: "源端口"
16-31: "目的端口"
32-63: "序列号"
64-95: "确认号"
96-99: "数据偏移"
100-105: "保留"
106: "URG"
107: "ACK"
108: "PSH"
109: "RST"
110: "SYN"
111: "FIN"
112-127: "窗口"
128-143: "校验和"
144-159: "紧急指针"
160-191: "(选项与填充)"
192-255: "数据 (可变长度)"
示例 2:UDP 数据包(位计数语法)
packet
title UDP 数据包
+16: "源端口"
+16: "目的端口"
32-47: "长度"
48-63: "校验和"
64-95: "数据 (可变长度)"
配置选项
可通过 Mermaid 配置文件自定义数据包图的外观:
| 配置项 | 类型 | 默认值 | 说明 |
|---|---|---|---|
rowHeight |
number | 32 | 每行的高度(像素) |
bitWidth |
number | 32 | 每位的宽度(像素) |
bitsPerRow |
number | 32 | 每行显示的位数 |
showBits |
boolean | true | 是否显示位编号 |
paddingX |
number | 5 | 行内字段之间的水平间距 |
paddingY |
number | 5 | 行与行之间的垂直间距 |
配置示例:
{
"packet": {
"bitsPerRow": 32,
"showBits": true,
"rowHeight": 32,
"bitWidth": 32,
"paddingX": 5,
"paddingY": 5
}
}
技能工作流程
步骤 1:理解用户需求
- 确认用户想要描述的网络协议或数据包结构
- 明确每个字段的名称、位宽/位置
- 确认是否需要标题
步骤 2:生成 Mermaid 代码
- 根据字段复杂度选择合适的语法(范围语法或位计数语法)
- 位计数语法更易于维护,推荐用于大多数场景
- 对于精确定位的字段(如 TCP 标志位),使用范围语法
步骤 3:组装完整代码块
将生成的代码包裹在 ``mermaid \`\`\ 代码块中,确保渲染引擎正确识别。
步骤 4:验证
- 确认位范围没有重叠
- 确认位范围是连续的(没有未定义的间隙,除非有意为之)
- 确认字段名称描述清晰
使用场景
- 网络协议文档:TCP、UDP、IP、ICMP 等协议头结构展示
- 教学演示:网络课程中讲解数据包结构
- 技术规范:定义自定义协议或数据格式
- 调试分析:可视化网络数据包字段分布
最佳实践
- 使用 32 位行宽:遵循 RFC 文档惯例,每行显示 32 位
- 为所有字段添加标签:每个字段都应具有清晰、描述性的名称
- 优先使用位计数语法:在修改设计时,位计数语法(
+N)比范围语法更容易维护 - 合理使用注释:用
%%添加注释说明字段用途 - 标志位单独成行:对于 1 位的标志位(如 TCP 的 URG/ACK/PSH 等),每个标志位独占一行
参考资料
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 服务于网络协议文档、教学演示、技术规范等明确场景
- 解决开发人员与网络工程师可视化数据包结构的核心痛点
- 受众虽专业但需求高频且实用
Highlights
- 触发词覆盖中英文常见表达(数据包图/packet diagram等)
- 边界清晰,无歧义或重叠风险
Areas to improve
-
缺少显式When to Use章节 Reported severity: Minor
文档实质包含使用场景说明,但未使用标准章节标题
Recommendation: 建议补充显式“When to Use”章节以提升规范性
Highlights
- 语法规则、示例、配置、流程分层清晰
- 提供完整端到端TCP/UDP示例
- frontmatter完整,文档长度适中
Highlights
- 基于Mermaid官方语法,工具来源权威
- 覆盖位重叠、连续性等关键验证点
- 提供灵活配置选项增强适应性
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- mermaid.js.org
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.