Communitygithub.com

plan-canvas

在本地瀏覽器中打開計畫與 HTML 成品,讓使用者可直接在頁面上標記元素、聊天、並批准或要求修改,無需離開頁面。適用於展示計畫供審查,或需要像「這裡需修改」這類精確回饋的情境。

plan-canvas 是什麼?

Plan Canvas 是一個專為開發者與 AI 代理(如 Claude Code、Cursor、Codex、Gemini、OpenCode、Copilot)設計的審查循環工具。當代理產生計畫成品(.plan.md 或 .html)後,可透過 `ecc-plan-canvas` CLI 在本地瀏覽器中開啟該成品,讓使用者直接在畫布上標註元件、聊天、並送出「批准計畫 / 要求修改」的裁決。代理則在後台阻塞等待 CLI 呼叫,收到使用者回饋(以 JSON 形式)後再進行修改或開始實作。此工具支援 Mermaid 圖表渲染、即時重新載入,並提供真正的雙向溝通機制,解決傳統 CLI 交互中「使用者說話但代理沒在聽」的問題。它無依賴、支援斷線續聽(佇列不會遺失訊息),並可輕鬆整合至任何支援 shell 指令的 AI 代理框架。

相容平台✓Claude Code✓Codex CLI✓Cursor✓Gemini CLI✓OpenCode
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/plan-canvas

在你喜歡的 AI 中提問

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

說明文件

Plan Canvas

用於計畫與視覺成品的審查循環:你撰寫成品,人類在瀏覽器中審查——精確標註他們所指的元素、聊天、並送出批准計畫 / 要求修改的裁決——而你則在單一個 CLI 呼叫上阻塞等待,其回饋以 JSON 形式回傳。

靈感來自 lavish-axi;以 ECC 原生方式圍繞 /plan 確認閘門重建,零依賴。

使用時機

  • 你剛寫好一個計畫成品(/plan 產生的 .claude/plans/*.plan.md),需要 CONFIRM/批准決定——畫布裁決取代了手動輸入「yes/繼續」。
  • 使用者應該具體指出要修改的內容:審查設計、比較、報告,或任何本機 .md / .html 成品。
  • 使用者要求 /plan-canvas、視覺審查,或「在瀏覽器中打開」。

請勿用於:差異代碼審查(/code-review)、執行網頁應用程式或遠端 URL。畫布僅提供本機成品檔案。

運作方式

以 ecc-plan-canvas CLI 呼叫——這是 ecc-universal 套件提供的二進位檔(在全域/外掛安裝後位於 PATH 中;外掛安裝亦可使用 node "$CLAUDE_PLUGIN_ROOT/scripts/plan-canvas.js")。從你正在審查的專案目錄中執行;它可從任何工作目錄運作。它管理一個所有工作階段共用的 detached loopback 伺服器(127.0.0.1:4517),以成品路徑為鍵——無需追蹤工作階段 ID。

此工作流程是純 CLI 加 JSON 的迴圈,因此與模型和 harness 無關:任何能執行 shell 指令並讀取 stdout 的代理皆可相同驅動(Claude Code、Codex、Cursor、Gemini、OpenCode、Copilot)。依你的 harness 如何顯示技能來觸發——例如 Claude Code 中的 /plan-canvas、Codex 中的 $plan-canvas——或直接執行 ecc-plan-canvas 指令。

# 1. 在使用者的瀏覽器中打開成品(立即回傳)
ecc-plan-canvas open .claude/plans/feature.plan.md

# 2. 阻塞直到人類回應。保持執行;若中斷則重新執行:
#    佇列中的回饋永遠不會遺失。
ecc-plan-canvas await .claude/plans/feature.plan.md

保持監聽,否則人類對著空椅子說話

只有在 await 實際 parked 在工作階段上時,回饋才會送達你。如果你的回合結束時沒有任何東西在監聽,訊息會留在佇列中,而從人類的視角來看,送出訊息似乎完全沒反應。

因此,請在你的 harness 支援時,將 await 作為背景任務執行(在 Claude Code 中,使用 run_in_background: true 的 Bash 呼叫)。它會在回饋送達時立即退出,並由 harness 將 JSON 交給你,這樣迴圈就能跨回合持續存活,而不會隨前景呼叫終止。前景 await 也可用,但僅限於 harness 設定時間限制之前。

存在兩個備援機制,但都不能作為省略上述做法的藉口:

  • ecc-plan-canvas pending 列出已排入佇列但沒有監聽器的回饋。每當你不確定是否錯過訊息時,可檢查此項。
  • stop:plan-canvas-pending 鉤子會在你的回合中有未送達的畫布回饋時阻止回合結束,並將訊息交給你。如果你從該鉤子讀取回饋,代表你太早停止監聽了。

await 在使用者操作時印出 JSON:

{
  "status": "feedback",
  "items": [
    { "kind": "annotation", "text": "將此拆分為兩個階段",
      "anchor": { "selector": "h2:nth-of-type(3)", "tag": "h2", "snippet": "階段 2:遷移" } },
    { "kind": "verdict", "verdict": "request-changes" }
  ]
}
  • kind: "chat"——自由形式訊息;在畫布中回覆,而非終端機。
  • kind: "annotation"——錨定到某個元素的回饋(anchor.selector、anchor.snippet 顯示他們所指的內容;anchor.textRange.text 顯示他們反白的段落)。
  • kind: "verdict"——approve 表示計畫已確認:停止輪詢、結束工作階段、開始實作。request-changes 表示修改成品(畫布會即時重新載入)並維持迴圈。

3. 始終在畫布中回應,然後繼續監聽。一個指令可同時完成兩件事:

ecc-plan-canvas await <file> --reply "已按要求拆分階段 2。請查看。"

每一則人類訊息都應在畫布中獲得回覆,即使只是簡單一句「收到,正在重寫風險表」也一樣。在聊天面板中保持沉默與畫布故障難以區分,而這正是此迴圈要防止的失敗。在那裡回答,不僅僅是在終端機中。

在你工作期間,使用活動指示器讓聊天保持真實:

# 動畫「代理正在思考…」氣泡;在長時間工作期間刷新它
ecc-plan-canvas typing <file> --state thinking
# 在回覆送達前切換為「代理正在打字…」
ecc-plan-canvas typing <file> --state typing

await 在將批次交給你時會自動設定 thinking,而 --reply 會清除它。兩種狀態都會自動過期,因此當機的代理會誠實地顯示「已排入佇列」,而不是讓人類看到永遠轉圈的點。如果修訂時間超過一分鐘,請刷新 thinking。

4. 結束當審查結束時:ecc-plan-canvas end <file>。

圖表(Mermaid)

當計畫的一部分是流程、架構、時序圖、狀態機、ER 模型或依賴關係圖時,請將其撰寫為被 fence 包圍的 ```mermaid 區塊,而非 ASCII 藝術或一大段文字——畫布會將其渲染為帶主題的圖表,讓人類可以精確指出。當圖表比段落更易於快速理解時使用;簡單的清單或表格則跳過。

```mermaid
flowchart LR
  A[市場確認] --> B{有觀察者?}
  B -->|是| C[排入工作佇列] --> D[扇出工作者]
```

圖表以 ECC 深色主題搭配強調色盤渲染。Mermaid 從固定的 CDN 載入到瀏覽器中;若無法使用(離線),區塊會退化為顯示其原始碼,因此審查永遠不會被阻擋。將本機鏡像指向 ECC_PLAN_CANVAS_MERMAID_URL 以用於氣隙環境。

規則

  • Markdown 成品以 ECC 的計畫模板渲染(包含 Mermaid 區塊);.html 成品則原樣渲染,並注入標註層。關於 HTML 撰寫指引,請使用 frontend-design-direction 和 artifact-design 技能。
  • 編輯成品檔案以進行修訂——畫布會在儲存時即時重新載入。切勿重新執行 open 來重新整理。
  • {"status": "ended", "endedBy": "user"}(或回饋批次中的 sessionEnded: true)表示使用者關閉了審查:停止輪詢,在聊天中傳遞剩餘更新,且不要重新開啟。對該工作階段的普通 open 將被拒絕;僅在使用者要求恢復時才傳遞 --reopen。
  • 同層資源(圖片、CSS)必須放在成品旁,並以相對路徑引用。
  • 伺服器僅限 loopback,並在 30 分鐘空閒後退出(ECC_PLAN_CANVAS_IDLE_MS);stop 可明確關閉它。狀態儲存在 ~/.claude/plan-canvas/(ECC_PLAN_CANVAS_STATE_DIR)。

範例

計畫批准流程——/plan 寫入 .claude/plans/notifications.plan.md 且必須等待確認:

ecc-plan-canvas open .claude/plans/notifications.plan.md
ecc-plan-canvas await .claude/plans/notifications.plan.md
# → {"status":"feedback","items":[{"kind":"verdict","verdict":"approve"}]}
ecc-plan-canvas end .claude/plans/notifications.plan.md
# 計畫已確認——開始實作

修訂迴圈——回饋送達,你編輯檔案,回覆,繼續監聽:

# await 回傳標註 → 編輯 .plan.md(畫布即時重新載入)
ecc-plan-canvas await <file> --reply "已重做風險表。"
# → 再次阻塞,直到下一個回應

反模式

  • 在迴圈中使用 --timeout-ms 輪詢。它僅用於測試。應讓普通的 await 保持執行。
  • 在審查仍開啟時,以沒有 await 監聽的狀態結束你的回合。這是人類體驗到「我送了訊息但什麼都沒發生」的唯一失敗。
  • 讀取了回饋但僅在終端機中回答。人類正在看著畫布。
  • 在使用者發起結束後重新開啟,「只是為了展示」某些東西。
  • 將整個計畫貼到聊天中又打開畫布——選擇畫布,並將終端機摘要保持在一行。
  • 從狀態檔案解析畫布聊天——你需要的所有資訊都會透過 await 送達。

設計說明與原起:docs/design/plan-canvas.md。

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.

相關技能