Communitygithub.com

EugineKosenko/majordom

分析專案中 `spcfctn/ui/draft` 目錄下的 Figma `.fig` 檔案。離線解壓並解碼(kiwi),將其拆解為章節、畫面、文字行和點陣圖,將分析結果寫入 `spcfctn/ui/*.md`,然後透過 Figma MCP 連結擷取作者留言,將其依幾何位置對應到畫面,檢查留言與檔案內容是否一致,並要求使用者釐不清之處。當使用者要求分析、解碼或重新讀取 `.fig` 檔案或 Figma 線框圖,或在新匯出後重新整理 `spcfctn/ui` 時使用。

majordom 是什麼?

此技能提供了一套完整的 Figma 設計稿離線分析流程,無需頻繁呼叫 Figma API。它能自動解壓縮 `.fig` 檔案、提取節點樹、文字圖層與點陣圖,並透過 MCP 工具取得設計作者留言,依幾何位置將留言對應到畫面。分析結果會輸出為結構化的 Markdown 文件,儲存在 `spcfctn/ui/` 目錄下,方便代理人後續查閱,而非重複讀取 Figma。 此工具支援的環境包括 Claude Code、Cursor 等可執行 Python 腳本與 MCP 伺服器的開發環境。運作方式分為六個步驟:(1) 解壓縮 `.fig` 檔案;(2) 解析出頁面、章節與畫面及其文字與點陣圖;(3) 將結果寫入指定的 Markdown 文件;(4) 透過 Figma MCP 工具擷取留言;(5) 驗證留言與設計稿內容的一致性;(6) 產生摘要報告,標註衝突與待釐清事項。此工具設計上不依賴 Figma API token,僅使用開源解碼器與 MCP 協議,安全且可審計。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/EugineKosenko/majordom/tree/HEAD/skills/analyze-fig

在你喜歡的 AI 中提問

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

說明文件

分析 Figma 匯出檔案 (analyze-fig)

分析 Figma 匯出檔案 (.fig),無需呼叫 Figma API:讀取檔案中的節點樹、文字與點陣圖,而作者*留言*(.fig 檔案中不存在)則透過 MCP 連結個別取得。結果為 spcfctn/ui/ 目錄下的 Markdown 檔案,可供後續使用,無需重複讀取 Figma。

何時不應執行

有關已解析設計稿的問題(例如「篩選器的留言說什麼…」、「畫面上有哪些欄位…」)應直接閱讀 spcfctn/ui/*.md 來解答,而非執行此技能。只有在匯入新的或更新的 .fig 檔案,或當 Markdown 檔案中沒有答案時(參閱 spcfctn-code.md),才需要執行解析。

目錄(僅草稿目錄 draft,不納入 Git 版本控制)

  • spcfctn/ui/draft/ — 輸入的 .fig 檔案(及其他草稿)。由使用者放置。
  • spcfctn/ui/draft/<名稱>/ — 解壓結果:message.json(所有節點)、meta.json、images/、screens.json 和 screens.txt,以及收集到的留言 (comments.json)。由 .fig 檔案還原,不納入 Git。沒有獨立的 raw/ 或 data/(參閱 modeling.md)。
  • spcfctn/ui/*.md — 分析結果;僅此部分保留在 Git 中。

<名稱> 為檔案名稱不含副檔名,並轉為小寫連字號格式(例如 internal-interfaces)。

步驟 0 — 準備

  • 找出專案的 spcfctn/。如果不存在,請要求使用者建立(參閱 spcfctn-code.md)。ui/ 及其子目錄 draft/ 請自行建立。
  • 檢查 spcfctn/ui/.gitignore(成品儲存庫):應包含 draft(參閱 modeling.md);如果缺少,請透過 gitignore.org 補上。
  • Figma 檔案:使用者需指定檔案名稱;若未指定,請列出 spcfctn/ui/draft/*.fig 並詢問。
  • 閱讀專案的 CLAUDE.md(語言慣例、規則)及既有的 spcfctn/ui/*.md:解析結果應延續其結構與術語,而非從零開始。
  • 需要在 PATH 中安裝 python3 和 zstd。

步驟 1 — 解壓與解碼

python3 ~/.claude/skills/analyze-fig/scripts/fig.py spcfctn/ui/draft/X.fig spcfctn/ui/draft/<名稱>

此指令會顯示格式版本、節點數量、blob 數量與圖片數量。此腳本已驗證可在格式版本 106 上運作;若遇到其他版本或錯誤,請勿猜測格式或使用其他解碼器,直接告知使用者。meta.json 中包含 exported_at:匯出時間將在步驟 5 中使用。message.json 檔案很大,請勿直接列印。

步驟 2 — 解析為章節與畫面

python3 ~/.claude/skills/analyze-fig/scripts/screens.py spcfctn/ui/draft/<名稱>

此指令會輸出頁面清單、章節(頂層框)與畫面(其子層),並顯示文字與點陣圖的數量。精髓在 screens.txt:針對每個畫面,文字圖層會從上到下、從左到右分組排列(便於讀取篩選器、欄位標題與按鈕),並附上點陣圖的連結。

  • 將數量與預期值(例如舊的 Markdown 檔案)進行比對;若有差異應停止。
  • 文字圖層無法看到無文字的元件(純圖示)與點陣圖內容。對於 images/ 中的每個點陣圖,請開啟檔案(Read)並描述文字圖層中缺少的內容;並標註這是從圖片讀取到的。節點樹與文字是主要依據,圖片則為輔助。
  • 元件實例 (INSTANCE) 可能包含未被腳本偵測到的覆寫文字;screens.txt 會對此提出警告。

步驟 3 — 寫入 spcfctn/ui/*.md

  • 每個章節一個 Markdown 檔案(若僅有一個章節則一個檔案即可)。若檔案已存在,請完整讀取並更新,而非覆寫:即使 Markdown 檔案僅由代理人管理,也不能遺失先前的釐清內容。
  • 語言風格遵循專案的 CLAUDE.md。
  • 結構(範例請參閱 job/vale/kylada 中的 spcfctn/ui/internal-dashboard.md):開頭應包含來源與驗證資訊(讀取內容、匯出日期、畫面數量與文字數量)、版型閱讀規則、UI 標籤與內部術語的對應、按順序排列的畫面(篩選器按版型順序、清單按鈕、欄位、列操作)、待解決問題。
  • 所有屬於你的解讀,而非版型或留言原文的內容,請標示為 inferred。
  • 專案的版型閱讀規則(例如「欄位標題下方的 Select 是排序控制」)請從 CLAUDE.md 取得並套用,而非自行臆測。

步驟 4 — 透過 MCP 連結取得留言

.fig 檔案中不含留言(已驗證):留言只留在 Figma 伺服器上。

  • 需要 Figma 中該檔案的連結(可有 node-id 或無)。若無,請向使用者索取。
  • 僅使用專案中已連接的 Figma MCP 伺服器所提供的 comments 工具(名稱請從已連接的伺服器清單中取得);參數 file 為該連結。若無此工具,請告知使用者。官方 figma-cs 不提供留言,請勿直接以 token 呼叫 REST API,也不要碰 .env。
  • 不帶 node_id 的呼叫會取得該檔案所有分支的所有留言(編號、日期、狀態、節點 @id、內容、回覆)。除非必要,否則不要設定 refresh。留言端點與檔案讀取的計費方式不同,即使讀取回傳 429,留言仍可正常運作。
  • 將留言對應到畫面的規則:
    • 若 @id 與 screens.json 中的畫面 id 相符,則畫面已確定;
    • 若 @id 為章節或頁面的 id,則需根據幾何位置決定畫面:需要留言的 node_id 和 node_offset。將字串 關鍵字 節點 X Y(例如 #144 979:3 500 5471)輸入: python3 ~/.claude/skills/analyze-fig/scripts/place.py spcfctn/ui/draft/<名稱> < 字串 輸出:關鍵字、章節、畫面;若座標不在畫面上,則顯示原因與最近的畫面。
    • 檢查輸出:comments 工具可能不輸出 node_offset(技能建立時即有此情況)。此時,屬於章節或頁面的留言無法被正確對應:請勿根據內容猜測畫面,而應將其歸類為章層級,標註*畫面未確定*,並告知使用者需要留言的偏移量才能正確對應。
  • 回覆 (↳) 屬於父留言的討論串。

步驟 5 — 驗證留言與檔案內容是否一致

對於每個已確定畫面的留言(以及章節層級的留言群組),請檢查:

  • 留言中提到的欄位、列、按鈕、數值是否存在於該畫面的文字圖層中(例如「整合服務數量」對應「服務」欄位;引用需有引號;列舉數值)。
  • 留言是否與版型衝突(欄位數量、順序、元件類型、「有篩選器」/「無」)。
  • 日期:若留言日期晚於 meta.json 中的 exported_at,則表示匯出已過時。請要求使用者在 spcfctn/ui/draft/ 中放置新的匯出檔案。
  • 留言的節點不在檔案中(已刪除或重新命名)— 此為孤立留言。
  • 留言無對應畫面且內容無法辨識。

將所有差異整理成一個小型表格(編號 #N、畫面、差異說明),並詢問使用者哪個是正確的:請勿擅自修正或自行決定版型與留言何者為準。在使用者回應之前,請在 Markdown 中標示為 conflict。

步驟 6 — 撰寫摘要

  • 在 Markdown 中新增一個章節,包含作者留言摘要(說明這些留言的目的)以及按畫面排列的所有留言(附編號 #N)。若留言釐清了之前標註為 inferred 的內容,請修正記錄並引用該留言。
  • 更新開頭的「Verification」部分:顯示已讀取的內容(.fig 檔案、版本、匯出日期、文字、點陣圖、留言、取得留言的日期)以及未涵蓋的內容。
  • 待解決問題以獨立清單列出;使用者的回應請移至「已解決」。
  • 未經要求,請勿提交任何內容。請以口頭(繁體中文)摘要:章節數量、畫面數量、留言數量、差異數量以及需要釐清的具體事項。

不應做的事項

  • 請勿以 token 呼叫 Figma REST API,也請勿讀取或編輯 .env。
  • 請勿讀取第三方程式碼(如 kiwi 解碼器等):格式已在 scripts/ 中實作。
  • 請勿將 .fig 及其解析結果(draft/ 下的所有內容)納入 Git。
  • 當有文字圖層可用時,請勿根據文字內容猜測留言所屬的畫面,也勿根據圖片猜測版型內容。

Individual skills in this repo

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

EugineKosenko/majordom

Керування сесіями claude-code-ide.el у живому Emacs через emacsclient headless — старт/continue/resume без блокуючих запитів, безпечна зупинка, перемикання permission-mode і auto-accept, навігація в інтерактивних picker'ах. Використовуй, коли сесія "Мажордом" має підняти, продовжити, зупинити чи інспектувати сесію claude-code-ide для іншого проєкту.

EugineKosenko/majordom

Scaffold a new component/command/crate in this user's literate org-babel Rust style (modeled on ads-back's crates/api and crates/cli patterns — one org file per command with a :tangle skeleton block, Декларації-before-Визначення/Дії noweb blocks, one heading per concern). Use whenever the user asks to add a new component, command, procedure, CLI subcommand, Yew component, module, or crate in an org-babel-literate Rust project (ads-back, ads-front, or similar), including wiring a brand-new crate's config.org/env.org/main.org into the workspace's federated config.org.

EugineKosenko/majordom

Bootstrap a new project in this user's standard layout — .claude-root, .dir-locals.el (root: org-link abbreviation), code/, spcfctn/code/ (with its own git repository) and a .claude/ directory with its own git repository and a CLAUDE.md that fixes the project's prose language and its short two-letter project code (chosen by the user from options the agent proposes) — and translate any files already present into that language. Use whenever the user asks to create, start, set up, initialise or "оформити" a new project (or to bring an existing bare directory to the standard layout).

EugineKosenko/majordom

Check org/md prose in this user's projects against the prose-formatting conventions in ~/.claude/rules/org-babel.md (~...~ vs =...= markup, acronym casing, /.../ glossary terms, real org-links vs italics/plain text, spaces around / between two markups, trailing newline, fill-column). Use proactively right after editing prose paragraphs in an .org or .md file (in place of manually re-deriving each rule from memory), and whenever the user explicitly asks to check/lint org rules or compares the request to running clippy.

相關技能