Communitygithub.com

UI 轉 Vue

當使用者有 UI 截圖或設計匯出檔,需要批次轉換成 Vue 3 元件,特別是搭配 Vant、Element Plus 或 Ant Design Vue 時使用。

UI 轉 Vue 是什麼?

此技能可批次將 UI 設計截圖轉換為 Vue 3 Composition API 元件程式碼。它適合需要從設計稿快速產生頁面元件、共用元件及路由設定的場景。此技能支援 Vant、Element Plus 和 Ant Design Vue 等主流 UI 框架,並可根據輸入目錄結構自動分組頁面、抽取共用元件。轉換器使用 DashScope API 進行模型推論,需設定 `DASHSCOPE_API_KEY` 環境變數。該工具可以透過 `npx` 直接執行,或全域安裝後使用 `ui-to-vue` 指令。產生的程式碼包含基礎結構,但仍建議在提交前進行格式化、lint、型別檢查及建置驗證。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/ui-to-vue

在你喜歡的 AI 中提問

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

說明文件

UI 轉 Vue 是做什麼的?

批次將 UI 設計截圖轉換為 Vue 3 Composition API 元件程式碼。

使用時機

  • 使用者提供一個目錄,內含設計截圖或設計匯出圖片。
  • 目標應用程式為 Vue 3。
  • 使用者希望獲得頁面元件、共用元件及路由連線的初版。
  • 使用者指定 Vant、Element Plus 或 Ant Design Vue 作為元件庫。

不應使用時機

  • 使用者只有一張截圖,且希望獲得專屬元件。
  • 目標專案不是 Vue。
  • 設計需要詳細的互動邏輯、資料流或無障礙性審查。
  • 截圖包含無法傳送至外部模型 API 的私人客戶資料。

輸入

使用一個輸入目錄,將截圖按模組和頁面狀態分組:

screenshots/
|-- HomePage/
|   |-- List/
|   |   |-- [email protected]
|   |   `-- cut-images/
|   |-- cut-images/
|   `-- [email protected]
`-- cut-images/

支援的切圖目錄名稱包含 assets、icons、sprites、cut、images 和 cut-images。

轉換模型

  • 頁面分組:將相關截圖合併成一個頁面元件,當它們代表列表、詳細、表單、載入或空狀態時。
  • UI 函式庫對應:盡可能將原生視覺元素對應到 Vant、Element Plus 或 Ant Design Vue 元件。
  • 切圖優先順序:優先使用頁面層級資源,其次是模組層級,最後是全域共用資源。
  • 元件提取:當 UI 區域重複出現超過一次時,將其提取為共用元件。

CLI 使用方式

使用 npx 執行轉換器,確保記錄中的指令不需依賴全域二進位檔即可運作:

export DASHSCOPE_API_KEY=your_key
npx [email protected] --input ./screenshots --ui vant --output ./src

針對桌面 UI 函式庫:

npx [email protected] --input ./designs --ui element-plus --output ./src
npx [email protected] --input ./designs --ui antd-vue --output ./src

如果套件已全域安裝,可以直接使用 ui-to-vue 指令:

npm install -g [email protected]
ui-to-vue --input ./screenshots --ui vant --output ./src

選項

選項描述預設值
--input設計圖片目錄./screenshots
--uiUI 函式庫:vant、element-plus 或 antd-vuevant
--output輸出目錄./src
--config設定檔路徑./.ui-to-vue.config.json

API 金鑰處理

轉換器可以從設定檔或環境變數中讀取 DashScope 憑證。在儲存庫中偏好使用環境變數:

export DASHSCOPE_API_KEY=your_key

如果需要本機設定檔,請將其排除在版本控制之外:

{
  "apiKey": "your_dashscope_key",
  "input": "./designs",
  "ui": "vant",
  "output": "./src"
}
.ui-to-vue.config.json

安全性與隱私

  • 將設計截視為可能傳送至外部模型 API 的來源素材。
  • 未經許可,請勿對私人客戶設計執行此流程。
  • 在可重複的工作流程中固定轉換器版本,而非使用 @latest。
  • 提交前請審查產生的 Vue 程式碼。
  • 請勿提交 .ui-to-vue.config.json、API 金鑰、產生的機密資訊或客戶截圖。

輸出審查清單

  • 頁面元件已產生在 views/ 或指定的輸出目錄下。
  • 僅在重複使用明確時,才將重複的 UI 區域提取到 components/ 中。
  • 路由輸出與目標專案的路由風格相容。
  • 產生的元件一致使用要求的 UI 函式庫。
  • 產生的 CSS 單位符合設計基準。
  • 程式碼通過專案的格式化工具、linter、型別檢查器及建置程序。
  • 提交前已審查過佔位文字、模擬資料及產生的資源。

疑難排解

問題檢查項目
401 或驗證錯誤確認在執行指令的 shell 中已設定 DASHSCOPE_API_KEY。
command not found: ui-to-vue使用 npx [email protected] 形式,或全域安裝套件。
切圖被忽略確認資源目錄名稱受支援,且位於對應的頁面或模組之下。
元件忽略要求的 UI 函式庫使用明確的 --ui 值重新執行,並檢查產生的匯入內容。
產生的版面尺寸看起來不對確認截圖匯出寬度符合目標函式庫的基準。

參考資料

  • npm 套件:ui-to-vue-converter

Individual skills in this repo

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

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

相關技能