跳到正文
cccskills
免费在 GitHub 公开

code-to-diagram

Turn a codebase into Mermaid diagrams such as architecture, ER, sequence, class, and flow diagrams. It analyzes relevant files, writes diagram source, renders SVG and PNG images, and checks the rendered result for readability and correctness.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Generate architecture diagrams, ER diagrams, sequence diagrams, flowcharts, and class diagrams from codebases using Mermaid.js. Use when users ask to visualize code structure, draw architecture diagrams, create ER diagrams from database models, generate sequence diagrams from API flows, or produce any diagram from source code. Triggers on: 'draw architecture', 'generate diagram', 'visualize code', 'ER diagram', 'sequence diagram', 'class diagram', 'flowchart from code', 'module dependency graph'.

dp-archive/archive星标 1,107(GitHub 1,107 + cccskills 0)

实测评分 未实测

查看安装方法

适用场景

  • Visualize a codebase architecture
  • Create an ER diagram from database models
  • Show an API flow as a sequence diagram
  • Map dependencies between modules

包含的文件(2)

  • SKILL.md4.1 KB
  • references/mermaid-patterns.md6.0 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Code to Diagram

Generate production-quality diagrams from source code via Mermaid.js, rendered to SVG/PNG with mmdc.

Environment

Executor required: This skill needs the diagram executor (Chromium + Node.js + mmdc pre-installed). If mmdc is not available, install first:

npm install -g @mermaid-js/mermaid-cli

Puppeteer config for headless environments — create at /tmp/puppeteer-config.json if missing:

{"args": ["--no-sandbox", "--disable-setuid-sandbox"]}

Workflow

  1. Analyze — Read the codebase to understand structure (glob, grep, read)
  2. Plan — Decide diagram type(s) based on user request and code patterns
  3. Generate — Write .mmd file with Mermaid syntax
  4. Render — Run mmdc to produce SVG and PNG
  5. Verify — Read the output image and check correctness

Diagram Type Selection

User IntentDiagram TypeMermaid Keyword
System overview, module layoutArchitecturegraph TD + subgraph
Database tables, ORM modelsER DiagramerDiagram
API flow, request lifecycleSequence DiagramsequenceDiagram
Inheritance, interfacesClass DiagramclassDiagram
Business logic, conditionalsFlowchartflowchart TD
Task states, lifecycleState DiagramstateDiagram-v2
Import/dependency treeDependency Graphgraph LR
Timeline, project phasesGantt Chartgantt

Analysis Strategy

Do NOT read every file. Use progressive analysis:

Step 1 — Directory scan: glob("**/*.py") or glob("**/*.ts") to understand module structure.

Step 2 — Entry points:

  • Python: main.py, app.py, __init__.py, pyproject.toml
  • Node.js: package.json, index.ts, app.ts
  • Java: pom.xml, Application.java

Step 3 — Targeted reads by diagram type:

  • ER → ORM models (models.py, schema.prisma, *.entity.ts)
  • Architecture → Router registrations, dependency injection, config
  • Sequence → Specific endpoint handler + service call chain
  • Class → Class definitions via grep("class ")

Step 4 — GitHub repos:

git clone --depth 1 <url> /tmp/repo-name

Then apply the same progressive scan.

Rendering

# SVG (transparent background, good for docs)
mmdc -i diagram.mmd -o diagram.svg -b transparent -p /tmp/puppeteer-config.json

# PNG (white background, 2x scale for sharpness)
mmdc -i diagram.mmd -o diagram.png -b white -s 2 -p /tmp/puppeteer-config.json

Always generate both formats. Use -s 2 for PNG (sharp at any zoom level).

Mermaid Syntax Reference

For detailed patterns and examples per diagram type, see references/mermaid-patterns.md.

Key rules:

  • Short IDs, descriptive labels: DB[("PostgreSQL 16")]
  • Use subgraph for logical grouping in architecture diagrams
  • Limit ER diagrams to ~10 entities — split by domain if larger
  • participant aliases in sequence diagrams for short names
  • Quote labels with special chars: A["Node (v1)"]
  • Max ~20 nodes per diagram — split into multiple if larger

Output Conventions

  • Write .mmd source + rendered files to workspace
  • Descriptive names: architecture.mmd, er-diagram.png, api-sequence.svg
  • Multiple diagrams → create diagrams/ folder with index

Quality Checklist

  • All entities/modules from the code are represented
  • Relationships and data flow directions are correct
  • Labels readable, not truncated or overlapping
  • No Mermaid syntax errors
  • Output image visually verified

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Review text for patterns associated with AI-generated writing, including vocabulary, structure, formatting, citations, and model-specific artifacts. The skill combines multiple signals, weighs context and mitigating evidence, and presents a cautious assessment with confidence and caveats.

中文简介正在准备中。当前显示英语简介。

  • Review an essay for multiple AI-writing signals
  • Explain which text patterns may suggest AI authorship
  • Assess a draft while accounting for false-positive risks
dp-archive/archive11072026年3月4日 更新

Extract audio from videos or download audio from supported websites with yt-dlp, then save it as MP3, M4A, FLAC, WAV, or OPUS. The workflow can embed track metadata and cover art, and process playlists or podcast episodes in batches.

中文简介正在准备中。当前显示英语简介。

  • Save a video's audio as MP3 or FLAC
  • Download podcast episodes as audio files
  • Convert a playlist into numbered audio tracks
dp-archive/archive11072026年3月4日 更新

biopython

免费

Use Biopython to process DNA, RNA, and protein sequences, read and convert common biology file formats, run alignments or BLAST searches, access NCBI records, and work with protein structures and phylogenetic trees in Python.

中文简介正在准备中。当前显示英语简介。

  • Reading and converting FASTA, GenBank, or PDB files
  • Calculating sequence statistics or translating DNA
  • Searching NCBI and PubMed records in batches
dp-archive/archive11072026年3月4日 更新

Turn a project description into a coordinated visual identity package. Define logo variants, color palettes, and typography, then create layouts for business cards and social media covers along with a brand specification document for consistent use.

中文简介正在准备中。当前显示英语简介。

  • Creating a logo system and brand kit
  • Choosing colors and typography for a new project
  • Designing a business card and social media cover
dp-archive/archive11072026年3月4日 更新

Create original posters and static artwork by first defining a visual direction for color, shape, space, and typography. Receive a Markdown design philosophy alongside a PNG or PDF artwork that communicates primarily through visuals.

中文简介正在准备中。当前显示英语简介。

  • Create an original poster
  • Express a theme through abstract artwork
  • Develop a visual direction and finished artwork
dp-archive/archive11072026年3月4日 更新

Create short brand copy that follows a defined voice and strict length limits. Use it for taglines, brand philosophy, business cards, social bios and cover text, with guidance for keeping wording consistent across touchpoints.

中文简介正在准备中。当前显示英语简介。

  • Writing a short brand tagline
  • Defining a consistent brand voice
  • Fitting copy into a social media bio
dp-archive/archive11072026年3月4日 更新

查看 dp-archive 的全部技能

报告此技能的问题