Motivation
Figma now ships a native AI agent in the editor. The plugin can close the fix loop for designers who don't have Claude Code + MCP access (the current canicode-roundtrip path requires a full seat + Claude Code session):
- Analyze in the plugin
- Copy a deterministic fix prompt
- Paste it into Figma's AI agent, which performs the fixes / asks the gotcha questions
- Re-analyze in the plugin to verify
This is the lint --fix experience, delegated to the host agent. Consistent with ADR-013: canicode diagnoses and prompts the fix direction, but does not own fix execution.
UX (intentionally minimal)
- One "Copy fix prompt" button at the top of the plugin report
- Clicking opens a popup/modal with the prompt in a read-only textarea + copy button (textarea doubles as a manual select-copy fallback for Figma's plugin iframe clipboard restrictions)
- The prompt always contains everything in the current report — no chunking, no "next batch" state. The plugin stays stateless; re-analysis after the agent's fixes naturally regenerates the remaining prompt
- Selection-size warning (one inline line): triggered by selection node count (default ~1000 nodes, constant in config), NOT issue count — real designs produce dozens of issues even at proper section scope, so issue count is a bad proxy for "scope too big". Warning only; never blocks
Prompt content (all deterministic — pure templating, no LLM call)
- Violation rules → imperative fix instruction per rule template, with node name + id (e.g. "Frame 'Card' (12:34) has no auto-layout — apply vertical auto-layout, gap 8")
- Info-collection (gotcha) rules → instruct the agent to ask the user, in its own designer-friendly phrasing, based on the rule context — we do NOT author the question text. E.g. "Node X has no interaction states defined. Ask the user what hover/pressed should look like, then record the answer as an annotation on the node"
- Annotation format spec: the gotcha section must specify the exact annotation convention canicode reads (same format as the roundtrip annotation upsert), otherwise re-analysis cannot detect the gotcha as resolved and the verify loop never closes
- Optional: sort structural fixes (e.g.
no-auto-layout) first within the prompt, since structural changes can invalidate other findings
Scope
src/core/: prompt-builder module — pure function (violations, gotchas) → prompt text, per-rule template registry next to rule messages. Lives in core so web/CLI reports can reuse it later
app/figma-plugin/: copy button + modal with read-only textarea
- Selection-size warning line + node-count threshold constant
Out of scope
- Chunking / batching / "next bundle" state — explicitly rejected for simplicity; scope control is the user's job via selection
- Authoring gotcha question text — the agent phrases questions itself
- Any gotcha Q&A UI in the plugin
🤖 Generated with Claude Code
Motivation
Figma now ships a native AI agent in the editor. The plugin can close the fix loop for designers who don't have Claude Code + MCP access (the current
canicode-roundtrippath requires a full seat + Claude Code session):This is the lint
--fixexperience, delegated to the host agent. Consistent with ADR-013: canicode diagnoses and prompts the fix direction, but does not own fix execution.UX (intentionally minimal)
Prompt content (all deterministic — pure templating, no LLM call)
no-auto-layout) first within the prompt, since structural changes can invalidate other findingsScope
src/core/: prompt-builder module — pure function(violations, gotchas) → prompt text, per-rule template registry next to rule messages. Lives in core so web/CLI reports can reuse it laterapp/figma-plugin/: copy button + modal with read-only textareaOut of scope
🤖 Generated with Claude Code