Communitygithub.com

markdown-mermaid-writing

全面的 Markdown 與 Mermaid 圖表撰寫技能。適用於建立任何科學文件、報告、分析或視覺化內容。將純文字圖表確立為預設的文件標準,並提供完整樣式指南(Markdown + Mermaid)、24 種圖表類型參考與 9 種文件範本。

markdown-mermaid-writing 是什麼?

此技能定義了一套以 **Markdown 嵌入 Mermaid 圖表** 作為科學文件與技術文件預設與標準格式的規範。其核心理念是:以 Mermaid 圖表呈現的關係,比任何圖片更有價值。因為它是純文字,能在 Git 中清晰比對差異、無需建置步驟即可在 GitHub、GitLab、Notion 及 VS Code 等平台上原生渲染,且相較於純文字描述,使用的 Token 更少。它支援超過 24 種圖表類型,包括流程圖、時序圖、實體關係圖、甘特圖、雷達圖等,涵蓋絕大多數科學與工程關係的視覺化需求。技能內含完整的 Markdown 與 Mermaid 樣式指南、9 種文件範本(如 PR 記錄、研究論文、架構決策記錄),以及與其他技能(如 scientific-writing、literature-review)的整合工作流程。適用於任何需要版本控制、團隊協作或 AI 可解析的文件產出,並強制採用「三階段工作流程」:第一階段(強制)為 Mermaid 在 Markdown 中,作為唯一真相來源;第二與第三階段(選擇性)為 Python 或 AI 生成進階圖表。該技能適用於 Claude Code、Cursor、Codex、GitHub Copilot 等支援 Markdown 與 Mermaid 的 AI 代理與開發環境。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/skills/markdown-mermaid-writing

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Markdown 與 Mermaid 撰寫

概述

此技能教導您 — 並強制執行 — 一套標準,用於建立以 Markdown 嵌入 Mermaid 圖表作為預設與標準格式 的科學文件。

核心信念:在 .md 檔案中以 Mermaid 圖表呈現的關係,比任何圖片都更有價值。它是純文字,因此在 Git 中能清晰比對差異。它不需要建置步驟。它能在 GitHub、GitLab、Notion、VS Code 以及任何 Markdown 檢視器中原生渲染。它比描述相同關係的散文體需要用更少的 Token。而且它隨時可以轉換為精美的圖片 — 但文字版本始終是唯一的真相來源。

「你愈多將你的報告和檔案用 .md 格式、用一般純文字來寫 — 而 Mermaid 也是一種簡單的『腳本語言』— 這對任何下游的渲染,特別是 AI 生成的圖片(使用 Mermaid 而不是只用長篇文字來描述關係,因為 Token 更少)都很有幫助。此外,Mermaid 可以連同 Markdown 一起渲染,讓人類或 AI 幾乎在任何地方都能輕鬆使用。」

— Clayton Young (@borealBytes), K-Dense Discord, 2026-02-19

何時使用此技能

在以下情況使用此技能:

  • 建立 任何科學文件 — 報告、分析、手稿、方法章節
  • 撰寫 任何文件 — README、操作指南、決策記錄、專案文件
  • 製作 任何圖表 — 工作流程、資料管線、架構、時間軸、關係圖
  • 產生 任何將被版本控制的輸出 — 如果它要進入 Git,就應該用 Markdown
  • 與 任何其他技能 協作 — 此技能定義了包覆所有其他輸出的文件層
  • 有人要求你「加個圖表」或「將這個關係視覺化」 — 永遠先用 Mermaid

勿 對結構性或關係型圖表直接使用 Python matplotlib、seaborn 或 AI 圖片生成。 那些是第二階段和第三階段 — 僅在 Mermaid 無法表達所需內容時使用(例如,帶有真實數據的散點圖、照片級真實感的圖片)。

🎨 原始格式哲學

為何基於文字的圖表勝出

重要的事項Markdown 中的 MermaidPython / AI 圖片
Git diff 可讀✅❌ 二進位 Blob
可編輯,無需重新生成✅❌
相較於散文,Token 效率更高✅ 更小❌ 更大
無需建置步驟即可渲染✅❌ 需要託管
AI 無需視覺即可解析✅❌
可在 GitHub / GitLab / Notion 使用✅⚠️ 若需託管
無障礙(螢幕閱讀器)✅ accTitle/accDescr⚠️ 需要替代文字
之後可轉換為圖片✅ 隨時— 已是圖片

三階段工作流程

flowchart LR
    accTitle: 三階段文件工作流程
    accDescr: 第一階段:Markdown 中的 Mermaid 是必備且為唯一真相來源。第二和第三階段是選擇性的下游轉換,用於產出精美的最終成果。

    p1["📄 第一階段<br/>Markdown 中的 Mermaid<br/>(永遠 — 唯一真相來源)"]
    p2["🐍 第二階段<br/>Python 生成<br/>(選擇性 — 數據圖表)"]
    p3["🎨 第三階段<br/>AI 生成視覺效果<br/>(選擇性 — 精美加工)"]
    out["📊 最終交付物"]

    p1 --> out
    p1 -.->|"必要時"| p2
    p1 -.->|"必要時"| p3
    p2 --> out
    p3 --> out

    classDef required fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e3a5f
    classDef optional fill:#fef9c3,stroke:#ca8a04,stroke-width:2px,color:#713f12
    classDef output fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#14532d

    class p1 required
    class p2,p3 optional
    class out output

第一階段是強制的。 即使你後續進行到第二或第三階段,Mermaid 原始檔仍然要提交。

Mermaid 能表達什麼

Mermaid 涵蓋 24 種圖表類型。幾乎所有科學關係都能找到對應:

使用案例圖表類型檔案
實驗工作流程 / 決策邏輯流程圖references/diagrams/flowchart.md
服務互動 / API 呼叫 / 訊息傳遞時序圖references/diagrams/sequence.md
資料模型 / SchemaER 圖references/diagrams/er.md
狀態機 / 生命週期狀態圖references/diagrams/state.md
專案時間軸 / 路線圖甘特圖references/diagrams/gantt.md
比例 / 組成圓餅圖references/diagrams/pie.md
系統架構(縮放層級)C4 圖references/diagrams/c4.md
概念層級 / 腦力激盪心智圖references/diagrams/mindmap.md
按時間順序的事件 / 歷史時間軸references/diagrams/timeline.md
類別層級 / 類型關係類別圖references/diagrams/class.md
使用者旅程 / 滿意度圖使用者旅程圖references/diagrams/user_journey.md
雙軸比較 / 優先級排序象限圖references/diagrams/quadrant.md
需求追溯性需求圖references/diagrams/requirement.md
流量規模 / 資源分佈桑基圖references/diagrams/sankey.md
數值趨勢 / 長條圖與折線圖XY 圖表references/diagrams/xy_chart.md
元件佈局 / 空間安排區塊圖references/diagrams/block.md
工作項目狀態 / 任務欄位Kanban 圖references/diagrams/kanban.md
雲端基礎設施 / 服務拓撲架構圖references/diagrams/architecture.md
多維度比較 / 技能雷達圖雷達圖references/diagrams/radar.md
階層式比例 / 預算矩形樹狀圖references/diagrams/treemap.md
二進位協定 / 資料格式封包圖references/diagrams/packet.md
Git 分支 / 合併策略Git 圖references/diagrams/git_graph.md
程式碼風格時序(程式語法)ZenUMLreferences/diagrams/zenuml.md
多圖表組合模式複雜範例references/diagrams/complex_examples.md

💡 選擇正確的類型,而非簡單的類型。 不要凡事都預設使用流程圖。 對於按時間順序的事件,時間軸勝過流程圖。對於服務互動,時序圖勝過流程圖。 掃描表格並配對。


🔧 核心工作流程

步驟 1:識別文件類型

在從頭開始撰寫前,檢查是否有範本可用:

文件類型範本
Pull Request 記錄templates/pull_request.md
Issue / 錯誤 / 功能請求templates/issue.md
Sprint / 專案看板templates/kanban.md
架構決策記錄 (ADR)templates/decision_record.md
簡報 / 簡報資料templates/presentation.md
研究論文 / 分析templates/research_paper.md
專案文件templates/project_documentation.md
操作指南 / 教學templates/how_to_guide.md
狀態報告templates/status_report.md

步驟 2:閱讀樣式指南

在撰寫任何 .md 檔案之前:閱讀 references/markdown_style_guide.md。

需內化的關鍵規則:

  • 每份文件一個 H1 — 即標題。絕對不要更多。
  • 僅在 H2 標題使用 Emoji — 每個 H2 一個 Emoji,H3/H4 中不使用
  • 引用一切 — 每個外部主張都需加上註腳 [^N] 並附上完整 URL
  • 謹慎使用粗體 — 每個段落最多 2-3 個粗體詞,絕不用於完整句子
  • 每個 </details> 後加上水平線 — 強制規定
  • 比較、配置、結構化資料使用表格而非散文
  • 使用圖表取代文字牆 — 若描述流程、結構或關係,請加上 Mermaid

步驟 3:選擇圖表類型並閱讀其指南

在建立任何 Mermaid 圖表之前:閱讀 references/mermaid_style_guide.md。

然後開啟特定類型的檔案(例如 references/diagrams/flowchart.md)以取得範例、提示和可複製貼上的範本。

每個圖表的強制規則:

accTitle: 簡短名稱 3-8 個字
accDescr: 一兩句話解釋此圖表顯示的內容。
  • 無 %%{init} 指令 — 會破壞 GitHub 深色模式
  • 無內聯 style — 僅使用 classDef
  • 每個節點最多一個 Emoji — 放在標籤開頭
  • 使用 snake_case 節點 ID — 與標籤匹配

步驟 4:撰寫文件

從範本開始。套用 Markdown 樣式指南。將圖表與相關文字放在一起 — 不要放在獨立的「圖表」章節。

步驟 5:以文字形式提交

帶有嵌入 Mermaid 的 .md 檔案就是提交的內容。如果你也同時生成了 PNG 或 AI 圖片,那些是補充資料 — Markdown 才是真相來源。


⚠️ 常見陷阱

雷達圖語法 (radar-beta)

錯誤:

radar
title Example
x-axis ["A", "B", "C"]
"Series" : [1, 2, 3]

正確:

radar-beta
title Example
axis a["A"], b["B"], c["C"]
curve series["Series"]{1, 2, 3}
max 3
  • 使用 radar-beta 而非 radar(單獨關鍵字不存在)
  • 使用 axis 定義維度,而不是 x-axis
  • 使用 curve 定義資料系列,而不是 帶冒號的引號標籤
  • 無 accTitle/accDescr — radar-beta 不支援無障礙標註;請務必在圖表上方加上一段描述性斜體段落

XY 圖表 vs 雷達圖混淆

圖表關鍵字軸語法資料語法
XY 圖表(長條圖/折線圖)xychart-betax-axis ["Label1", "Label2"]bar [10, 20] 或 line [10, 20]
雷達圖(蜘蛛網圖)radar-betaaxis id["Label"]curve id["Label"]{10, 20}

在支援的類型上忘記 accTitle/accDescr

僅部分圖表類型支援 accTitle/accDescr。對於不支援的類型,請務必在程式碼區塊正上方放置一段描述性斜體段落:

比較三種方法在五個效能維度上的雷達圖。注意:雷達圖不支援 accTitle/accDescr。

radar-beta
...

🔗 與其他技能的整合

搭配 scientific-schematics

scientific-schematics 可生成 AI 驅動的出版級圖片(PNG)。請將 Mermaid 圖表作為示意圖的 簡報:

工作流程:
1. 在 .md 中以 Mermaid 建立概念(此技能 — 第一階段)
2. 向 scientific-schematics 描述相同概念以生成精美的 PNG(第三階段)
3. 兩者都提交 — .md 作為來源,PNG 作為補充圖表

搭配 scientific-writing

當 scientific-writing 產出手稿時,所有圖表和結構圖表都應使用此技能的標準。寫作技能負責散文和引用;此技能負責視覺結構。

工作流程:
1. 使用 scientific-writing 起草手稿
2. 對於每個顯示工作流程、架構或關係的圖表:
   - 用遵循此技能指南的 Mermaid 圖表替換佔位符
3. 僅在真正需要照片級真實感/複雜渲染的圖表上使用 scientific-schematics

搭配 literature-review

文獻回顧會產生帶有大量關係資料的摘要。使用此技能來:

  • 建立文獻領域的概念圖(心智圖)
  • 顯示發表時間軸(時間軸或甘特圖)
  • 比較方法論(象限圖或雷達圖)
  • 繪製論文中描述的資料流程(時序圖或流程圖)

搭配任何產出文件的技能

在最終確定任何技能產出的文件之前,套用此技能的檢查清單:

  • 文件是否使用了範本?如果是,我是否從正確的範本開始?
  • 所有圖表是否都以 Mermaid 格式撰寫,並包含 accTitle + accDescr?
  • 是否沒有 %%{init}、沒有內聯 style,僅有 classDef?
  • 所有外部主張是否都使用 [^N] 進行了引用?
  • 是否一個 H1,且僅在 H2 使用 Emoji?
  • 每個 </details> 後是否有水平線?

📚 參考索引

樣式指南

指南路徑行數涵蓋內容
Markdown 樣式指南references/markdown_style_guide.md~733標題、格式、引用、表格、Mermaid 整合、範本、品質檢查清單
Mermaid 樣式指南references/mermaid_style_guide.md~458無障礙、Emoji 集、顏色類別、主題中立性、類型選擇、複雜度分級

圖表類型指南(24 種)

每個檔案包含:生產級範例、該類型的特定提示,以及可複製貼上的範本。

references/diagrams/ — architecture, block, c4, class, complex_examples, er, flowchart, gantt, git_graph, kanban, mindmap, packet, pie, quadrant, radar, requirement, sankey, sequence, state, timeline, treemap, user_journey, xy_chart, zenuml

文件範本(9 種)

templates/ — decision_record, how_to_guide, issue, kanban, presentation, project_documentation, pull_request, research_paper, status_report

範例

assets/examples/example-research-report.md — 一份完整的研究報告,示範了正確的標題層級、多種圖表類型(流程圖、時序圖、甘特圖)、表格、註腳引用、可摺疊章節以及所有樣式指南規則的應用。


📝 出處

此技能中的所有樣式指南、圖表類型指南和文件範本均移植自 SuperiorByteWorks-LLC/agent-project 儲存庫,採用 Apache-2.0 授權。

此技能(作為 scientific-agent-skills 的一部分)根據 MIT 授權條款發布。包含的 Apache-2.0 內容與下游使用相容,需保留出處,如本技能各檔案標頭所維護。


Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

adaptyv

How to use the Adaptyv Bio Foundry API and Python SDK for protein experiment design, submission, and results retrieval. Use this skill whenever the user mentions Adaptyv, Foundry API, protein binding assays, protein screening experiments, BLI/SPR assays, thermostability assays, or wants to submit protein sequences for experimental characterization. Also trigger when code imports `adaptyv`, `adaptyv_sdk`, or `FoundryClient`, or references `foundry-api-public.adaptyvbio.com`.

aeon

This skill should be used for time series machine learning tasks including classification, regression, clustering, forecasting, anomaly detection, segmentation, and similarity search. Use when working with temporal data, sequential patterns, or time-indexed observations requiring specialized algorithms beyond standard ML approaches. Particularly suited for univariate and multivariate time series analysis with scikit-learn compatible APIs.

alphagenome

Look up precomputed AlphaGenome Atlas effects for any GRCh38 single-nucleotide variant (AVI score with Phred and 18 SHAP feature attributions, plus raw and quantile scores for RNA-seq, DNase, ATAC, ChIP-TF, ChIP-histone, CAGE, PRO-cap, splicing, polyadenylation and contact-map tracks), score variants or scan windows on demand with the AlphaGenome model for human and mouse (variant scoring, in silico mutagenesis, REF-versus-ALT track prediction), and build Atlas website deep links. Use when the user mentions AlphaGenome, AlphaGenome Atlas, AVI or AlphaGenome Variant Impact, DeepMind variant effect prediction, or wants to prioritise or mechanistically interpret non-coding, regulatory, splicing, enhancer, promoter, or chromatin-accessibility effects of SNVs from a VCF, credible set, or region. Research use only; not a clinical tool.

analytical-method-validation

Plan, execute, and document validation, verification, and transfer of analytical procedures under the governing framework - ICH Q2(R2) and Q14, USP <1220>/<1225>/<1226>, ICH M10 bioanalytical, CLSI EP, or ISO/IEC 17025. Use for HPLC, LC-MS/MS, GC, CE, ICP-MS, dissolution, qNMR, qPCR, NIR, and ligand binding or cell-based assays whenever the question is whether a procedure is fit for its intended purpose. Triggers include

anndata

Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.

arbor

Autonomously improve a real artifact (code, training recipe, agent harness, data pipeline, prompt) against an objective and an evaluator, using Hypothesis Tree Refinement (HTR) from the Arbor paper. Use this whenever someone wants to iteratively optimize something over many experiments without overfitting — e.g.

arboreto

Infer gene regulatory networks (GRNs) from gene expression data using scalable algorithms (GRNBoost2, GENIE3). Use when analyzing transcriptomics data (bulk RNA-seq, single-cell RNA-seq) to identify transcription factor-target gene relationships and regulatory interactions. Supports distributed computation for large-scale datasets.

astropy

Core Python library for astronomy and astrophysics workflows that need Astropy APIs, including units/quantities, coordinates, FITS I/O, tables, time systems, WCS, and cosmology. Use when implementing or debugging astronomical data analysis code with Astropy.

autoskill

Observe the user

benchling-integration

Benchling Python SDK and REST API integration for registry entities, inventory, ELN entries, workflows, Benchling Apps, and Data Warehouse queries. Use when automating lab data with benchling-sdk or the v2 API.

bgpt-paper-search

Search scientific papers and retrieve structured experimental data extracted from full-text studies via the BGPT MCP server. Returns 25+ fields per paper including methods, results, sample sizes, quality scores, and conclusions. Use for literature reviews, evidence synthesis, and finding experimental details not available in abstracts alone.

bids

>

biopython

Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.

bioservices

Unified Python interface to 40+ bioinformatics services. Use when querying multiple databases (UniProt, KEGG, ChEMBL, Reactome) in a single workflow with consistent API. Best for cross-database analysis, ID mapping across services. For quick single-database lookups use gget; for sequence/file manipulation use biopython.

bulk-rnaseq

End-to-end bulk RNA-seq orchestrator — takes raw FASTQ reads through QC and trimming (FastQC, fastp/Trim Galore), alignment and quantification (STAR, Salmon, featureCounts), assembles a gene-level counts matrix, then hands off to differential expression (pydeseq2), pathway/GSEA enrichment (pathway-enrichment), and publication figures (scientific-visualization). Use whenever the user has bulk RNA-seq reads or quant output and wants a complete, reproducible differential-expression workflow — e.g.

cellxgene-census

Query the CZ CELLxGENE Census programmatically for versioned public single-cell and spatial transcriptomics data. Use when you need population-scale cell metadata, gene expression slices, Census summary counts, source H5AD URIs/downloads, embeddings, spatial Census data, or reference atlas comparisons across organisms, tissues, diseases, assays, and cell types. For analyzing your own local single-cell data use scanpy, anndata, or scvi-tools.

cirq

Google quantum computing framework. Use when targeting Google Quantum AI hardware, designing noise-aware circuits, or running quantum characterization experiments. Best for Google hardware, noise modeling, and low-level circuit design. For IBM hardware use qiskit; for quantum ML with autodiff use pennylane; for physics simulations use qutip.

citation-management

Comprehensive citation management for academic research. Search OpenAlex, PubMed, and Google Scholar for papers, extract accurate metadata, validate citations, and generate properly formatted BibTeX entries. This skill should be used when you need to find papers, verify citation information, convert DOIs to BibTeX, or ensure reference accuracy in scientific writing.

clinical-decision-support

Prepare and validate research-only clinical decision-support evaluation, evidence-profile, cohort, survival, biomarker/model, privacy, and governance artifacts. Use for aggregate or synthetic research documentation and traceability—not patient care or live clinical operation.

clinical-reports

Create safety-bounded draft structures and run local deterministic checks for clinical case, diagnostic, trial, safety, and aggregate research reports. Use only with synthetic, de-identified, or aggregate inputs and verified source-fact manifests; every output requires qualified review.

相關技能