首頁 / Skills / 開發提效 / Markdown 與 Mermaid 寫作
開發提效

Markdown 與 Mermaid 寫作

Clayton Young / Superior Byte WorksApache-2.0Skill 語言: 英文
授權已核對不含腳本中風險
演示真實執行紀錄 · claude-sonnet-5-5 · 2026年10月
I'm documenting a small data pipeline for my team's repo README. Every night a scheduler triggers an ingest job that pulls CSV files from an SFTP server, a validation step checks the schema and moves bad files to a quarantine folder, good files are loaded into a staging table, then a transform job builds the reporting tables, and finally a Slack message is sent. Please write the README section "How the nightly pipeline works": a short intro, a diagram of the flow, and a sequence diagram showing the interaction between the scheduler, the ingest job, the SFTP server, the database and Slack. Our README is viewed on GitHub.
Skill: markdown-mermaid-writing
Read: references/mermaid_style_guide.md
Read: references/diagrams/sequence.md

Here's the section, ready to paste into your README. Both diagrams use standard Mermaid, which GitHub renders natively in light and dark mode.

## How the nightly pipeline works

Every night a scheduler triggers an ingest job. The job pulls CSV files from an SFTP server and checks each file's schema. Files that fail go to a quarantine folder, and files that pass are loaded into a staging table. A transform job then builds the reporting tables from staging, and a Slack message is sent at the end of the run.

### Pipeline flow

```mermaid
flowchart LR
    accTitle: Nightly Pipeline Flow
    accDescr: A scheduler triggers ingest from SFTP. Each CSV is validated. Bad files go to quarantine, good files load into staging, then the transform builds reporting tables and Slack is notified.

    schedule([⏰ Nightly trigger]) --> ingest[📥 Pull CSVs from SFTP]
    ingest --> validate{🔍 Schema valid?}
    validate -->|No| quarantine[🗂️ Move to quarantine]
    validate -->|Yes| staging[💾 Load into staging table]
    staging --> transform[⚙️ Build reporting tables]
    transform --> notify([📤 Send Slack message])
    quarantine --> notify

    classDef good fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#14532d
    classDef bad fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#7f1d1d

    class staging,transform good
    class quarantine bad
```

### Interaction between components

```mermaid
sequenceDiagram
    accTitle: Nightly Pipeline Sequence
    accDescr: The scheduler starts the ingest job, which downloads files from SFTP, validates each one, quarantines bad files or loads good ones into the database, runs the transform, and posts a summary to Slack.

    participant sched as ⏰ Scheduler
    participant ingest as 📥 Ingest job
    participant sftp as 🖥️ SFTP server
    participant db as 💾 Database
    participant slack as 📤 Slack

    sched->>ingest: Trigger nightly run
    ingest->>sftp: List and download CSV files
    sftp-->>ingest: CSV files

    loop 🔄 Each file
        ingest->>ingest: 🔍 Validate schema
        alt ✅ Schema valid
            ingest->>db: Load into staging table
            db-->>ingest: Rows loaded
        else ❌ Schema invalid
            ingest->>ingest: 🗂️ Move to quarantine folder
        end
    end

    ingest->>db: Run transform (build reporting tables)
    db-->>ingest: Reporting tables updated

    ingest->>slack: 📤 Post run summary
    slack-->>ingest: Message accepted
```

A few details are my assumptions, so please check them against your setup:

  • Who runs what: You didn't say which component runs validation and the transform. I showed the ingest job doing validation and loading, then triggering the transform in the database. If the transform is a separate job, add it as a sixth participant between the database and Slack.
  • Failures: The Slack message is sent after both good and bad files, as in the flow diagram. If it should only fire on success, or should list the quarantined files, say so and I'll adjust both diagrams.
  • Quarantine location: I didn't say whether the folder is on the SFTP server or local storage. Name it in the intro if readers will need to find it.

I couldn't render the diagrams here, but they follow standard Mermaid syntax. You can paste them into mermaid.live, or preview the README on GitHub, to confirm they display.

Real run in an isolated folder with only this skill installed. Only the Skill and Read tools were enabled, so no command was run and no file was written. The scenario is fictional. The diagrams were not rendered in this run: check them in a Mermaid-aware preview such as GitHub or mermaid.live before publishing.

它做什麼

提供一套可選的**「Markdown 文件 + Mermaid 圖」**寫作風格,讓結構保存在可編輯、便於比對的文字裡,而不是截圖裡。它幫你選對圖的類型(流程圖、循序圖、ER 圖、狀態圖、甘特圖、C4、時間軸、心智圖等),再指向對應類型的指南,裡面有測試過的範例與可直接複製的範本。它會加上 accTitle 與 accDescr 無障礙中繼資料,每個節點最多一個表情符號,並提醒你檢查文件將來顯示的地方用的是哪個版本的 Mermaid。

附帶的參考資料

Markdown 樣式指南、Mermaid 樣式指南、關於目前 Mermaid 算繪與命令列匯出的說明、21 份圖類型指南,以及 6 個文件範本(決策紀錄、操作指南、簡報、專案文件、研究論文、狀態報告)。

適合什麼場景

README、設計文件、方法說明與報告,凡是希望工作流程、資料模型或時間軸保持為可編輯文字的地方。

說明與風險

中風險:它會寫入與編輯 Markdown 檔案,沒有腳本。可選的圖表匯出會用 npm 安裝 Mermaid 命令列工具與 Chromium 瀏覽器,需要連網。不同平台(例如 GitHub)的 Mermaid 版本不一樣,請在發布的地方確認圖能正常算繪;試用中的圖沒有算繪過。它的樣式慣例(二級標題加表情符號、只有一個 H1)是可選的:請先遵循你自己專案的風格。這份副本做過精簡:為了符合大小限制刪去了 40 個檔案中的 6 個,並已在 SKILL.md 裡註明。Clayton Young 與 Superior Byte Works 的 Apache-2.0 作品,K-Dense 以 MIT 授權做了整合;隨附兩份授權檔。