paper-flex
millionco/skills · Agent Skill
將Paper或設計節點從絕對定位轉換為flex或自動佈局,同時保持SVG/影象的完整性,Z順序和基於截圖的視覺對齊性。
前往安裝 ↓總覽
| 發布者 | |
|---|---|
| 儲存庫 | millionco/skills ↗ |
| 技能資料夾 | paper-flex |
| 星 | 34 |
| 分支 | 2 |
| 附帶檔案 | 3 |
| 授權 | MIT |
| 最近更新 | 2026年6月30日 |
| 連結 | 技能原始碼 ↗ · 儲存庫 ↗ |
Mozgi 檢查
我們在技能檔案中發現的內容。詳細資訊需訂閱。
安裝
技能就是一個含 SKILL.md 的資料夾。選擇你的代理,在專案根目錄的終端機(macOS、Linux 或 Windows 的 Git Bash)執行指令。
把提示貼到 Claude、Codex 或其他助理:它會自行檢查並安裝技能。
Install the “paper-flex” skill from mozgi.io (https://mozgi.io/skills/millionco-paper-flex/) for me. 1. Download the archive: https://mozgi.io/skills/millionco-paper-flex/download If it fails, take the skill folder from the source: https://github.com/millionco/skills/tree/main/skills/paper-flex 2. Read SKILL.md and the other files. Check the skill is safe: no hidden commands, no sending data elsewhere, no scripts doing something other than described. If anything looks suspicious, stop and tell me. 3. Put the “paper-flex” folder into your agent's skills folder: .claude/skills/ for Claude Code, .agents/skills/ for Codex, .cursor/skills/ for Cursor, .gemini/skills/ for Gemini CLI. Inside the project if we are in one, otherwise in the home folder (~/.claude/skills/ etc.). 4. Make sure <skills folder>/paper-flex/SKILL.md exists. 5. Briefly tell me what this skill does and offer to try it on my task. If you cannot do a step yourself, tell me what to click or type.
git clone --depth 1 --branch main https://github.com/millionco/skills.git /tmp/skills mkdir -p .claude/skills cp -r /tmp/skills/skills/paper-flex .claude/skills/paper-flex
重新啟動 Claude Code — 技能就會出現在清單中,手動呼叫:/paper-flex。要套用到所有專案,請放在 ~/.claude/skills。
git clone --depth 1 --branch main https://github.com/millionco/skills.git /tmp/skills mkdir -p .agents/skills cp -r /tmp/skills/skills/paper-flex .agents/skills/paper-flex
Codex 會從目前資料夾往上到儲存庫根目錄,在 .agents/skills 中尋找技能;用 /skills 或 $paper-flex 呼叫。所有專案:~/.agents/skills。
git clone --depth 1 --branch main https://github.com/millionco/skills.git /tmp/skills mkdir -p .cursor/skills cp -r /tmp/skills/skills/paper-flex .cursor/skills/paper-flex
Cursor 啟動時會載入技能;在 Agent 聊天輸入「/」呼叫。Cursor 也會讀取 .claude/skills 與 .agents/skills。所有專案:~/.cursor/skills。
git clone --depth 1 --branch main https://github.com/millionco/skills.git /tmp/skills mkdir -p .gemini/skills cp -r /tmp/skills/skills/paper-flex .gemini/skills/paper-flex
任務符合時,Gemini CLI 會提議啟用技能,由你確認。所有專案:~/.gemini/skills。
安裝前請先檢視 SKILL.md 與相關檔案。點擊檔案即可預覽。
SKILL.md 內容
作者原文 · 唯讀Paper Flex
You convert Paper layouts from absolute positioning into flex structure without losing the original pixels.
Hard rule: preserve existing visual nodes first. Recreate only plain layout wrappers or simple text/div surfaces whose computed styles are fully known.
RED/GREEN Intent
This skill closes failures seen without Paper-specific guidance:
- Using generic move/relative positioning instead of
x-paper-cloneplusupdate_styles - Losing SVG path data, image fills, crops, or exact shadows by rebuilding nodes
- Breaking z-order because Paper appends
x-paper-clonenodes after normal divs - Leaving cloned absolute
left/topoffsets inside flex flow - Letting shadows or filters become visible/inherited after restructuring
GREEN outcome: the converted node has a readable flex hierarchy, original SVG/image fidelity, verified z-order, and a screenshot that still matches the source.
Required First Pass
Before writing or deleting anything:
1. Call get_guide({ topic: "paper-mcp-instructions" }).
2. Call get_basic_info and get_selection to confirm target artboard/node scope.
3. Call get_screenshot on the target and keep it as the visual baseline.
4. Call get_tree_summary(depth=10) and get_children on the target.
5. Call get_computed_styles for the target and every direct visual child. Record left, top, width, height, colors, fonts, shadows, filters, radii, and image fills.
6. If text styling will be created or changed, call get_font_family_info before writing typography.
Do not start conversion from memory or screenshot alone. The computed styles are the source of truth for flex math.
Source Preservation Rules
1. Keep the original nodes until the converted layout has passed screenshot comparison.
2. Use <x-paper-clone node-id="..."> for SVGs, images, complex vectors, icons, masks, and styled shapes.
3. Never hand-redraw an SVG, image, logo, or complex decorative layer. No exceptions for "simple enough."
4. After cloning into flex flow, batch update_styles to set left: "0px" and top: "0px" on every flow clone.
5. After cloning anything that must remain overlaid, batch update_styles to set the required position, left, and top. Inline styles on <x-paper-clone> are not enough.
Conversion Workflow
1. Map the absolute children into semantic groups: background, header row, text stack, media, card, controls, overlays.
2. Compute spacing from coordinates:
gap = next.top - (current.top + current.height)
leftPadding = first.left - container.left
topPadding = first.top - container.top
3. Use Paper-compatible layout: display: flex, flex-direction, align-items, justify-content, gap, and wrapper padding.
4. Do not rely on margins. Use gap, padding wrappers, or explicit spacer frames for non-uniform spacing.
5. Build incrementally. Each write_html call should add one visual group or wrapper.
6. Use separate write_html calls whenever clone z-order matters:
1. write_html container shell
2. write_html decorative/background clones into shell
3. write_html content wrappers/divs into shell
4. update_styles cloned positions and flow offsets
7. Delete original children only after the converted children exist, positions are verified, and the screenshot matches. Verify the final child list with get_children.
Paper-Specific Traps
| Trap | Why It Breaks | Correct Move |
|---|---|---|
| Setting position styles on <x-paper-clone> | Paper ignores clone position overrides at insertion time | Clone first, then call update_styles |
| Mixing clones and divs in one write_html | Paper appends clones after divs, changing z-order | Insert decorative clones in an earlier write |
| Leaving original clone coordinates | Absolute offsets push flow items away from their flex slots | Reset flow clones to left: "0px", top: "0px" |
| Using position: relative for overlapped cards | Paper stacks instead of overlapping in fixed wrappers | Use absolute cards inside a fixed-size wrapper |
| Keeping hidden source shadows | Flex order can reveal shadows that were covered before | Remove boxShadow on clones whose shadow was hidden by a later opaque sibling |
| Applying filter to a flex parent | Filters inherit and affect children unintentionally | Apply filters only to leaf nodes that need them |
| Cloning reference SVGs blindly | Some SVG clones contain empty text children | Inspect with get_tree_summary; delete empty Text children |
Layered Cards
Open references/layered-cards.md when the design has back cards, floating badges, corner marks, or overlapping elements.
Default card stack rules:
1. Card stack wrapper is a plain fixed-size frame, not a flex container.
2. Back card is the first child.
3. Front card uses position: absolute; left: 0px; top: 0px.
4. Floating badges, labels, and corner marks are inside the stack wrapper as last children.
Good And Bad Patterns
Bad: Delete an imported SVG, write a new <svg>, put it in a flex row, and eyeball the icon.
Good: Clone the original SVG with x-paper-clone, place it in the flex row, reset its flow offsets with update_styles, then compare screenshots.
Bad: One write_html call containing a background clone and content divs.
Good: Write the shell, insert background clones in a separate call, then insert content so Paper's clone ordering cannot place backgrounds on top.
Before Marking Complete, You MUST:
1. Verify the original screenshot and converted screenshot match.
2. Verify no SVG, image, logo, mask, or complex shape was recreated instead of cloned.
3. Verify every flow clone has left: "0px" and top: "0px" via get_computed_styles.
4. Verify every absolute overlay clone has its intended position, left, and top via get_computed_styles.
5. Verify decorative/background clones appear earlier than content with get_children.
6. Verify overlapping badges/labels are last children of their stack/wrapper.
7. Verify hidden shadows are removed where flex restructuring would reveal them.
8. Verify filters are on leaf nodes only.
9. Call finish_working_on_nodes when done.
Do not skip any step. A skipped step means visual corruption.
常見問題
paper-flex 技能有什麼用途?
將Paper或設計節點從絕對定位轉換為flex或自動佈局,同時保持SVG/影象的完整性,Z順序和基於截圖的視覺對齊性。
如何安裝 paper-flex?
打開本頁的「安裝」區塊並選擇你的代理 — Claude Code、Codex、Cursor 或 Gemini CLI:那裡有把技能資料夾複製到正確位置的現成指令。也可以複製「透過助理」分頁中的提示,讓助理自行檢查並安裝技能。
paper-flex 適用哪些 AI 模型?
技能是純 Markdown 指示(Agent Skills 格式),因此 paper-flex 適用任何讀取 SKILL.md 的代理:Claude Code、Codex、Cursor、Gemini CLI、GitHub Copilot、OpenCode 等。只有在任務符合技能描述時,模型才會載入指示。
paper-flex 是免費的嗎?
此技能由 millionco 公開發布,採用 MIT 授權。技能本身免費 — 你只需向 AI 供應商支付實際使用的 token 費用。
安裝技能安全嗎?
技能是代理會遵循的指示,安裝前請閱讀 SKILL.md 及相關檔案。技能資料夾中的腳本只有在代理執行時才會運行 — 留意它的動作,不要授予多餘權限。
技能和 MCP 伺服器或外掛有何不同?
MCP 伺服器或外掛為模型提供新工具 — 會執行並回傳結果的程式碼。技能提供的是知識與流程:如何處理任務、要遵循哪些步驟、好的成果長什麼樣子。它不需要伺服器或 API 金鑰。