@agent-native/core 0.39.0 → 0.39.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/cli/skills.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,yBAAyB,GAG1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,4BAA4B,EAC5B,cAAc,EACd,UAAU,EACV,6BAA6B,GAC9B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,EAAiB,MAAM,yBAAyB,CAAC;AAEjE,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAgCsB,CAAC;AAEpC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+EvB,CAAC;AAEF,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEnC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAoCY,CAAC;AAExC,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AO,EAAqB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAC5D;KACF,CAAC;IACF,MAAM,QAAQ,GAAG,aAAa;QAC5B,CAAC,CAAC,4BAA4B;QAC9B,CAAC,CAAC,sBAAsB,CAAC,MAAM;YAC7B,CAAC,CAAC,iCAAiC,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACxE,CAAC,CAAC,EAAE,CAAC;IACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB;QACE,aAAa,cAAc,SAAS,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG;QACtE,YAAY,CAAC,MAAM;YACjB,CAAC,CAAC,uBAAuB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACnD,CAAC,CAAC,8BAA8B;QAClC,UAAU,CAAC,MAAM;YACf,CAAC,CAAC,eAAe,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACzC,CAAC,CAAC,2BAA2B;QAC/B,OAAO,CAAC,MAAM;YACZ,CAAC,CAAC,UAAU,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACrE,CAAC,CAAC,EAAE;QACN,QAAQ;QACR,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACzE,2EAA2E;QAC3E,MAAM,CAAC,cAAc;YACnB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,gGAAgG;KACrG;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CACrB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * `agent-native skills` is the friendly install surface for app-backed skills.\n * The lower-level `app-skill` commands remain the packaging primitives; this\n * command handles the common \"install Assets for my agent\" path in one step.\n */\n\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { spawn } from \"node:child_process\";\n\nimport {\n buildAppSkillPack,\n ensureAppSkill,\n loadAppSkillManifest,\n normalizeAppSkillManifest,\n type AppSkillManifest,\n type LoadedAppSkillManifest,\n} from \"./app-skill.js\";\nimport {\n readConnectClientPreferences,\n resolveClients,\n runConnect,\n writeConnectClientPreferences,\n} from \"./connect.js\";\nimport {\n CONTEXT_XRAY_SKILL_MD,\n installLocalContextXray,\n} from \"./context-xray-local.js\";\nimport { CLIENTS, type ClientId } from \"./mcp-config-writers.js\";\n\nconst HELP = `agent-native skills\n\nUsage:\n agent-native skills list\n agent-native skills add assets|design-exploration|visual-plan|visual-questions|ui-plan|prototype-plan|visualize-plan|context-xray [--client codex|claude-code|claude-code-cli|cowork|all] [--scope user|project] [--mcp-url <url>] [--no-connect] [--yes] [--dry-run] [--json]\n agent-native skills add <manifest-or-app-dir> [--client ...] [--yes]\n\nExamples:\n agent-native skills add assets\n agent-native skills add design-exploration\n agent-native skills add visual-plan\n agent-native skills add visual-plan --no-connect\n agent-native skills add context-xray --client all\n agent-native skills add assets --client claude-code\n agent-native skills add assets --mcp-url https://my-app.ngrok-free.dev\n agent-native skills add ./dist/assets-skill --client codex\n\nThe add command installs the SKILL.md instructions, registers the app-backed\nMCP connector, and then authenticates it in one step so you do not hit an OAuth\nwall on the first tool call. Authentication reuses \"agent-native connect\":\nOAuth-capable clients (Claude Code) get a URL-only entry and a /mcp authenticate\nprompt, while Codex / Cowork run the browser device-code flow. In a\nnon-interactive shell or CI the auth step is skipped and the exact\n\"agent-native connect <url>\" command is printed instead.\n\nRunning \"npx skills add ...\" directly installs instructions only; use this Agent\nNative CLI path when you want MCP setup and auth too. Pass --no-connect to\nregister the connector without authenticating (leave auth to the host or run\n\"agent-native connect\" later). Pass --mcp-url to register that connector against\na custom origin (an ngrok tunnel, a local dev server, or a self-hosted\ndeployment) instead of the built-in hosted default — a bare origin gets the\nstandard /_agent-native/mcp path appended. Use app-skill pack for marketplace\nbundles and custom adapter output.`;\n\nconst ASSETS_SKILL_MD = `---\nname: assets\ndescription: >-\n Use Assets for image or video generation requests, brand-safe media,\n human picker UI, search/list/export actions, and cross-app asset selection.\n Prefer this over generic image tools when installed.\nmetadata:\n visibility: exported\n---\n\n# Assets\n\nUse the Assets app when a workflow needs reusable brand media, a human picker,\nor generated image/video assets that another app can reference by ID and URL.\nWhen this skill is available, route plain image-generation requests here instead\nof using a generic image generator.\n\n## Choose The Path\n\n- Use \\`open-asset-picker\\` when a person should browse, search, generate, and\n select an asset in UI. Pass \\`mediaType: \"image\"\\` by default, or\n \\`mediaType: \"video\"\\` for video libraries. When the user asks to create a\n specific image and choose the best option, pass \\`prompt\\`,\n \\`autoGenerate: true\\`, and \\`count: 3\\` so the picker opens with candidates\n to preview and select.\n- Use unattended actions when the agent already knows what to do:\n \\`search-assets\\`, \\`list-assets\\`, \\`generate-image\\`,\n \\`generate-image-batch\\`, \\`generate-video\\`,\n \\`refresh-generation-run\\`, and \\`export-asset\\`.\n- Use browser/deep-link fallback when the host cannot render MCP Apps inline.\n Surface the returned picker link. If it opens in a normal browser tab, have\n the user select an asset there and paste back the copied handoff summary.\n Treat Codex, Claude Code, and Claude Desktop Code as link-out hosts; do not\n promise inline MCP App rendering there.\n If the skill instructions are available but the MCP tool namespace has not\n appeared yet, use the Assets browser fallback URL shape instead of switching\n to a generic generator:\n \\`https://assets.agent-native.com/library?mediaType=image&prompt=...&autoGenerate=1&count=3\\`.\n When reporting the final selected image in Codex or Claude Code, include the\n asset link and, if an inline preview is important, download the selected\n \\`previewUrl\\`/\\`downloadUrl\\` to a local temp image and embed that absolute\n local path. Remote CDN markdown images can fail to render in code-editor chat\n surfaces.\n\n## Image And Video Workflows\n\n1. Pick or match the library with \\`list-libraries\\` or \\`match-library\\`.\n2. For images, call \\`generate-image\\` or \\`generate-image-batch\\`. Image\n actions are synchronous: one batch call should return the finished image\n candidates, so do not poll or regenerate unless a returned slot failed.\n3. For videos, call \\`generate-video\\` and poll \\`refresh-generation-run\\`\n until the run completes.\n4. Preserve returned \\`assetId\\`, \\`runId\\`, \\`previewUrl\\`, \\`downloadUrl\\`,\n media type, and dimensions so the caller can attach or embed the result.\n\n## Cross-App Use\n\n- Hosted default: connect \\`https://assets.agent-native.com/_agent-native/mcp\\`.\n Do not put shared secrets in skill files.\n- For CLI/code-editor clients, keep any \\`agent-native connect\\` command\n running until browser authorization finishes. Stopping it early can leave the\n browser approved but the local MCP config unwritten. Restart or reload the\n agent client after installing or connecting if Assets tools do not appear in\n the live session.\n- Local customization: use \\`agent-native app-skill launch --local\\` from an\n Assets app-skill manifest, or pass \\`--into <path>\\` for editable source.\n- Do not call image/video providers directly from another app. Assets owns\n generation, picker UI, search/list/export, and asset context.\n- If an Assets tool call returns \\`Session terminated\\`, \\`needs auth\\`, or\n another connector/session error, do not keep retrying the tool. Tell the user\n to reconnect or authenticate the Assets MCP connector, then continue after it\n is available.\n- Do not hand-roll MCP HTTP requests with curl from the agent session. Use the\n host-exposed Assets tools after restart/reload, or use the returned\n browser/deep-link fallback.\n- If a batch image generation request times out in browser fallback, retry with\n \\`count: 1\\` only after telling the user the multi-candidate request timed out.\n- If you inspect local MCP config, redact \\`Authorization\\`, \\`http_headers\\`,\n and token values. Never paste bearer tokens into chat or logs.\n`;\n\nconst DESIGN_EXPLORATION_SKILL_MD = `---\nname: design-exploration\ndescription: >-\n Use Design for UI/UX exploration, side-by-side design directions,\n interactive prototype previews, user selection, iteration, and design-to-code\n handoff through the hosted Design MCP app.\nmetadata:\n visibility: exported\n---\n\n# Design Exploration\n\nUse the Design app when a workflow needs visual UI exploration, prototype\niteration, or a human-in-the-loop choice among design directions.\n\n## Choose The Path\n\n- Use \\`create-design\\` first to create a project shell. Do not report the\n design as ready until it has renderable HTML.\n- For open-ended UX exploration, generate distinct, complete HTML directions\n (2-5, three by default) and call \\`present-design-variants\\`. The inline\n Design MCP app shows the options, lets the user pick one, and persists the\n selected variant.\n- If the Design app opens as a browser link instead of inline (CLI hosts like\n Codex / Claude Code, where the deep link carries \\`handoff=chat\\`), the user\n picks a direction there and the editor shows a copyable summary — ask them to\n paste it back into chat so you can continue from the chosen direction. The\n \\`present-design-variants\\` result's \\`fallbackInstructions\\` describe this.\n- For direct refinements to an already chosen direction, call\n \\`get-design-snapshot\\`, edit from the current tuned HTML, then call\n \\`generate-design\\`.\n- Use \\`export-coding-handoff\\` when the user wants to implement the chosen\n design in a codebase.\n\n## Exploration Defaults\n\n1. Default to three variants unless the user asks for a different count\n (\\`present-design-variants\\` accepts 2-5; three is the sweet spot).\n2. Make variants structurally and stylistically distinct, not just color swaps.\n3. Each variant must be a complete standalone HTML document that renders\n without a build step.\n4. For product UI redesigns, prefer cleaner hierarchy, progressive disclosure,\n and realistic controls over decorative mockups.\n5. After \\`present-design-variants\\`, wait for the user's pick before\n generating the next version. If they say \"I like #2 but...\", snapshot the\n chosen design and refine that direction with \\`generate-design\\`.\n\n## Cross-App Use\n\n- Hosted default: connect \\`https://design.agent-native.com/_agent-native/mcp\\`.\n Do not put shared secrets in skill files.\n- For CLI/code-editor clients, keep any \\`agent-native connect\\` command\n running until browser authorization finishes. Stopping it early can leave the\n browser approved but the local MCP config unwritten. Restart or reload the\n agent client after installing or connecting if Design tools do not appear in\n the live session.\n- Dispatch can expose Design alongside other apps. Use Design for UI/UX design\n tasks, Assets for image/media selection, Slides for decks, and so on.\n- Keep the loop visual: surface the inline MCP App or the returned \"Open\n design\" link instead of pasting large HTML blobs into chat.\n- If a Design tool call returns \\`Session terminated\\`, \\`needs auth\\`, or\n another connector/session error, do not keep retrying the tool. Tell the user\n to reconnect or authenticate the Design MCP connector, then continue after it\n is available.\n- Do not hand-roll MCP HTTP requests with curl from the agent session. Use the\n host-exposed Design tools after restart/reload, or use the returned\n browser/deep-link fallback.\n- If you inspect local MCP config, redact \\`Authorization\\`, \\`http_headers\\`,\n and token values. Never paste bearer tokens into chat or logs.\n`;\n\n/**\n * Shared setup/auth block for every Plans skill (`/visual-plan`, `/ui-plan`,\n * `/prototype-plan`, `/visual-questions`, `/visualize-plan`). Interpolated into each skill markdown\n * so the install + one-step authenticate instructions never drift between them.\n * Keep this in sync with the copies under `templates/plan/.agents/skills/*` and\n * top-level `skills/*` (this skill's SKILL.md is triplicated with no sync test).\n */\nconst PLAN_SETUP_AUTH_MD = `## Setup & Authentication\n\nThere are two ways into Plans.\n\n**Coding agent (CLI).** Install once with the Agent-Native CLI. The command\ninstalls the Plans skills, registers the hosted Plans MCP connector, and\nauthenticates it in the same step (a one-time browser sign-in at setup — this is\nintended), so the first tool call does not hit an OAuth wall:\n\n\\`\\`\\`bash\nagent-native skills add visual-plan\n\\`\\`\\`\n\nAfter that, \\`/visual-plan\\` (and \\`/ui-plan\\`, \\`/prototype-plan\\`,\n\\`/visual-questions\\`, \\`/visualize-plan\\`) generate a plan and open the editor. Pass \\`--no-connect\\` to\nregister the connector without authenticating, then run\n\\`agent-native connect https://plan.agent-native.com\\` whenever you are ready.\n\n**Browser (people you share with).** Open the Plans editor and create & edit\nwith no sign-up — you work as a guest. Sign in only when you want to save or\nshare; signing in claims the plans you made as a guest into your account.\n\nSharing and commenting require an account: public/shared plans are viewable by\nanyone with the link, but commenting on them needs an agent-native account.\n\nFor fully offline, no-account use, run the Plans app locally and sync plans to\nyour repo as MDX. This local mode is a separate advanced path, not the default\nhosted flow.\n\nIf a Plans tool returns \\`needs auth\\`, \\`Unauthorized\\`, or \\`Session terminated\\`,\ndo not keep retrying the tool. Authenticate the connector with\n\\`agent-native connect https://plan.agent-native.com\\` (OAuth-capable hosts can\ninstead re-run /mcp and choose Authenticate), then continue once the connector\nis available.\n\nHosted default: connect \\`https://plan.agent-native.com/_agent-native/mcp\\`. Do\nnot put shared secrets in skill files.`;\n\nexport const VISUAL_PLANS_SKILL_MD = `---\nname: visual-plan\ndescription: >-\n Use Agent-Native Plans when coding-agent work needs an interactive structured\n plan document with diagrams, wireframes, mockups, prototypes, annotations,\n and comments.\nmetadata:\n visibility: exported\n---\n\n# Agent-Native Plans\n\nAgent-Native Plans is structured visual planning mode for coding agents. Build\nthe plan you would normally write in Markdown, but as a scannable document with\neditable blocks mixed in: an optional top visual review area (wireframe canvas,\nlive prototype, or both in tabs) and a Notion-like technical document below. The\nuser reacts to visuals first and reads prose only where it helps.\n\n\\`/visual-plan\\` is the canonical command and the main entry point. Use \\`/ui-plan\\`\nwhen the work is primarily product UI and review should start with the screens.\nUse \\`/prototype-plan\\` when review should start with a functional live prototype.\nUse \\`/visual-questions\\` only when the user explicitly wants a visual intake form\nbefore planning. Use \\`/visualize-plan\\` to turn an existing Codex, Claude Code,\nMarkdown, or pasted plan into a visual companion.\n\n## When To Use\n\nCreate a visual plan when work is multi-file, ambiguous, long-running, risky, or\nUI-heavy, when architecture / data flow / UI direction / options / open\nquestions would be clearer visually, or when the user needs to react to a\ndirection before you implement.\n\n## Plan Discipline\n\n- **Gate hard.** A polished visual plan is the most expensive plan form; only\n invest when a wrong direction is costly. Skip it for trivial, unambiguous work\n — typos, one-line fixes, a single well-specified function, anything whose diff\n you could describe in one sentence — and just make the change. Never pad a plan\n with filler and never ship a single-step plan.\n- **Research before you draft.** Read the real files, actions, schema, and\n patterns first; name actual files, symbols, and data shapes instead of\n inventing them. Check existing \\`actions/\\` before proposing endpoints and prefer\n named client helpers over raw fetch. Delegate wide exploration to a sub-agent.\n- **Planning is read-only.** Make no source edits while building or reviewing the\n plan. Start editing only after the user approves the direction.\n- **Clarify vs. assume.** Do not ask how to build it — explore and present the\n approach and options in the plan. Ask a clarifying question only when an\n ambiguity would change the design and you cannot resolve it from the code; use\n the host agent's normal ask-user-question flow and batch 2-4 high-leverage\n questions before finalizing. Do not call \\`create-visual-questions\\` from\n \\`/visual-plan\\`; keep any answerable follow-up inside the plan itself as a\n bottom \\`question-form\\` Open Questions block. Otherwise state the assumption\n explicitly and proceed, and put anything unresolved in an open-questions block.\n- **The plan is the approval gate.** After surfacing it, ask the user to review\n and approve before you write code, and name which files/areas the work touches.\n Presenting the plan and requesting sign-off is the approval step — do not ask a\n separate \"does this look good?\" question.\n- **The document is the source of truth, not the chat.** When scope shifts,\n update the plan with \\`update-visual-plan\\` rather than only changing course in\n chat, and re-read the approved plan before major steps.\n\n## Core Workflow\n\n1. Follow the host agent's normal planning flow: inspect the codebase, delegate\n wide exploration when useful, gather the info needed, and ask native\n clarifying questions as needed before generating the plan.\n2. Decide the top visual surface with the rules below, then call\n \\`create-visual-plan\\` with the title, brief, source, repo path, and structured \\`content\\` blocks.\n3. Compose any top visual surface from the kit and write the document with\n native blocks (see the cores below). Keep the document close to the Markdown\n plan the agent would normally output; add diagrams, wireframes, prototypes,\n and visual callouts only where they clarify the plan. Skip the top visual\n surface for non-visual work.\n4. Surface the returned Plans link or inline MCP App and ask the user to review.\n Always include the actual URL in chat so the next step is a click in CLI or\n other text-only hosts. When the host exposes an embedded browser/preview panel\n and a tool can open arbitrary URLs there, open the returned plan URL\n automatically for convenient review; do not rely on this as the only handoff.\n5. Call \\`get-plan-feedback\\` before editing, after review, after any long pause,\n and before the final response. Treat \\`anchorDetails\\`, resolver intent, recent\n review events, and any focused screenshots from browser handoff as the source\n of truth for exactly what changed and exactly what each comment points at.\n6. Apply changes with \\`update-visual-plan\\`, preferring targeted \\`contentPatches\\`.\n When the user wants source-control friendly edits, use\n \\`patch-visual-plan-source\\` against the MDX files instead of regenerating the\n plan.\n7. Export with \\`export-visual-plan\\` only when the user wants a shareable receipt\n or repo-check-in artifacts.\n\n## Visual Surface Choice\n\nChoose the surface before creating the plan. Do not add visual chrome by\ndefault:\n\n- **No visual surface** for architecture-only, backend-only, data migration,\n copy-only, or otherwise non-visual plans. Use a strong document with diagrams\n only when relationships need a visual explanation.\n- **Canvas only** for one static screen, a before/after comparison, a component\n state, a small popover, or a visual direction that does not require clicking.\n Put those wireframes in \\`content.canvas\\` and omit \\`content.prototype\\`.\n- **Canvas + prototype** for multi-step UI flows, onboarding, wizards,\n review/approval flows, navigation changes, or anything where the reviewer\n needs to operate the behavior. Keep the static wireframes in\n \\`content.canvas\\`, add the aligned functional prototype in\n \\`content.prototype\\`, and rely on the top visual tabs to switch between them.\n- **Prototype-first** when the user explicitly asks for \\`/prototype-plan\\`, asks\n to operate the UI, or when interaction is the main question. Use\n \\`create-prototype-plan\\`, which still preserves static mocks where useful.\n\nFor mixed canvas + prototype plans, reuse the same real labels, app statuses,\nand screen ids across both surfaces. The canvas is the inspectable static reference;\nthe prototype is the interactive version of that same flow, not a separate\ndesign direction.\n\n<!-- SHARED-CORE:wireframe-canvas START -->\n\n## Wireframe & Canvas Core\n\nThis section is shared, word for word, by \\`/visual-plan\\`, \\`/ui-plan\\`, and\n\\`/visualize-plan\\`. It is the single source of truth for how wireframes and the\ncanvas work. Do not paraphrase it per command.\n\n**A wireframe is an HTML mockup. The renderer owns the look; you write the\ncontent.** Set \\`data.html\\` to a self-contained, semantic HTML fragment of the\nscreen and set \\`data.surface\\`. The renderer owns the surface footprint/aspect,\nthe dark/light theme, the hand-drawn font, and the rough.js sketch overlay — you\nnever write \\`<html>\\`/\\`<body>\\`/\\`<script>\\`/\\`<style>\\` tags, font-family, hex colors,\nor any width/height/coordinates. You write real HTML layout and real product\ncontent; the renderer styles and roughens it.\n\n**A wireframe block's data is an HTML screen plus a surface:**\n\n\\`\\`\\`json\n{\n \"surface\": \"browser\",\n \"html\": \"<div style=\\\\\"display:flex;flex-direction:column;gap:10px;padding:16px;height:100%\\\\\"><h1>Sign in</h1><p class=\\\\\"wf-muted\\\\\">Use your work email to continue.</p><div class=\\\\\"wf-card\\\\\" style=\\\\\"display:flex;flex-direction:column;gap:10px\\\\\"><label>Email<input value=\\\\\"jane@acme.co\\\\\" /></label><label>Password<input value=\\\\\"••••••••\\\\\" /></label><label style=\\\\\"display:flex;align-items:center;gap:8px\\\\\"><input type=\\\\\"checkbox\\\\\" checked /> Remember me</label><button class=\\\\\"primary\\\\\">Sign in</button></div><a href=\\\\\"#\\\\\">Forgot password?</a></div>\"\n}\n\\`\\`\\`\n\n**Write PLAIN semantic HTML and let the renderer style it.** Bare elements\n(\\`h1\\`/\\`h2\\`/\\`h3\\`, \\`p\\`, \\`button\\`, \\`input\\`, \\`<input type=\"checkbox\">\\`, \\`a\\`, \\`hr\\`)\nare auto-themed — no classes needed. Helper classes carry the rest:\n\n- \\`.wf-card\\` / \\`.wf-box\\` — a bordered, padded container (a panel, a list item).\n- \\`.wf-pill\\` / \\`.wf-chip\\` — a rounded tag or filter; add \\`.accent\\`\n (\\`<span class=\"wf-pill accent\">\\`) for the accent-filled variant.\n- \\`.wf-muted\\` — secondary/muted text (or use \\`<small>\\`).\n- \\`button.primary\\` or any element with \\`[data-primary]\\` — the accent-filled\n primary button.\n\n**Use the \\`--wf-*\\` tokens for any custom color, never hex.** The renderer flips\nthese on light/dark, so reading them is what keeps a mockup correct in both\nthemes. For any inline border, background, or text color, reference a token:\n\\`style=\"border:1.4px solid var(--wf-line)\"\\`. The tokens are \\`--wf-ink\\` (text),\n\\`--wf-muted\\` (secondary text), \\`--wf-line\\` (borders/dividers), \\`--wf-paper\\`\n(page background), \\`--wf-card\\` (raised surface), \\`--wf-accent\\` /\n\\`--wf-accent-fg\\` / \\`--wf-accent-soft\\` (brand action), \\`--wf-warn\\`, \\`--wf-ok\\`,\nand \\`--wf-radius\\`. Never hard-code a hex color and never set \\`font-family\\` — the\nrenderer owns the sketch/clean font.\n\n**Lay out with inline \\`style\\` flex/grid.** You write the real layout —\n\\`display:flex; flex-direction:column; gap:10px; padding:16px\\` and so on — and the\nrenderer never repositions anything. Compose the actual product: reproduce the\ncurrent screen, then show the modification. Real labels, real counts, real dates,\nreal button text grounded in the screen you read; not lorem or gray bars.\n\n**Surface presets — match the real footprint, never default to desktop+mobile.**\nPick the \\`surface\\` that matches what the user will actually see:\n\n- \\`browser\\`: a web page that needs a browser chrome frame around it.\n- \\`desktop\\`: a full desktop app page or app shell.\n- \\`mobile\\`: a phone screen, only when the work is genuinely mobile.\n- \\`popover\\`: a small floating menu, dropdown, or inline popover.\n- \\`panel\\`: a side panel, inspector, or sidebar widget.\n\nThe surface locks the footprint and aspect; never set width/height/coordinates.\nA sidebar popover renders as a small surface, not a desktop page and a phone\nframe. Do not emit \\`desktop\\` + \\`mobile\\` variants unless responsive behavior\nactually changes the layout. For a component or widget, show one broader\napp-context frame only when placement affects understanding, then the focused\ncomponent states.\n\n**Modify, don't redesign.** When the task changes an existing screen, reproduce\nthe current screen's real layout and footprint FIRST, then change only the delta\nand call it out with a single annotation. Do not restack the page into a new\nlayout. For net-new surfaces, compose from the real app shell.\n\n**Zoom in on sub-surfaces, don't redraw the page.** For a small sub-surface (a\npopover, menu, dialog, toast), show the full screen once, then add a small\nseparate artboard whose \\`html\\` contains ONLY that sub-surface — do not re-draw\nthe whole page around it, and do not scale a duplicate up. Pick the matching\n\\`surface\\` (e.g. \\`popover\\`) so the footprint is right; never widen a popover to\npage width.\n\n**Loading / skeleton states.** Set \\`data.skeleton: true\\` on the wireframe and\nfill the \\`html\\` with neutral, textless placeholder geometry — boxes and bars\nbuilt as \\`<div>\\`s with \\`background:var(--wf-line)\\` and explicit heights/widths,\nno labels or copy. The renderer drops borders, sketch, and color into the\nskeleton register automatically. Never escape to a \\`custom-html\\` document block\nto fake a loader, and never move a mockup out of the canvas — mockups always\nlive in canvas artboards.\n\n**Editing an existing mockup.** To change one element, text, or color in an\nexisting html mockup, do NOT regenerate the frame — call \\`update-visual-plan\\`\nwith \\`contentPatches: [{ op: \"patch-wireframe-html\", blockId, edits: [{ find,\nreplace }] }]\\`. Each \\`find\\` is a unique snippet of the current html (read it\nfirst with \\`get-visual-plan\\`); set \\`all: true\\` on an edit to replace every\noccurrence. The result is re-sanitized.\n\n**Canvas annotations are designer notes on the artboard.** When a top canvas is\npresent, sprinkle Figma-style notes near the frames they explain: a short\nheading, supporting text, and bullets — plain text layers, never bordered or\nshadowed cards, and never a box around a frame. The renderer spaces notes away\nfrom frames, so place each note by the frame it describes. Use an arrow only to\npoint at one specific control or transition; for a broad frame-level note, write\ntext beside the frame with no connector. Connectors are for real sequences only —\nnever fake \"Step 1 → Step 2\" lines between independent states.\n\n**Do not create overlapping annotations.** Anchor each note to the frame it\nexplains with \\`targetId\\` + \\`placement\\` (top/right/bottom/left). The renderer\nparks notes in a gutter beside the frame and lays them out automatically — never\nsupply x/y or points for anchored notes; hand-placed coordinates fight the\nauto-layout and cause the overlap you're trying to avoid. Reserve arrows for a\nnote that must point at a specific control inside a frame; a note that simply\nsits beside its frame needs no arrow.\n\n**Patching.** Edit one wireframe, canvas annotation, or block with targeted \\`contentPatches\\`\n(for example \\`update-block\\`, \\`replace-blocks\\`, \\`update-canvas-annotation\\`) rather\nthan regenerating the whole plan. \\`contentPatches\\` are part of the public MCP\naction schema, so Claude Code, Codex, Cursor, and other hosts can make surgical\nedits. If an agent is working from exported source files, use\n\\`read-visual-plan-source\\` / \\`patch-visual-plan-source\\`: \\`plan.mdx\\` holds\nfrontmatter plus markdown/document blocks, \\`canvas.mdx\\` holds\n\\`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\\`, and the\npatch action normalizes the MDX back into the same JSON runtime model. JSON is\nthe canonical runtime shape; MDX is the repo-friendly authoring/export surface.\nIn the browser, humans edit \\`rich-text\\` prose inline; agents should still use\n\\`update-rich-text\\` content patches or source patches for prose, and use\ncomments/structured patches for canvas, artboard, wireframe, and diagram edits.\n\n**Never emit a titled artboard with no interior wireframe content.** Every artboard you place on the canvas must carry an \\`html\\` wireframe (or reference a wireframe block via \\`blockId\\`) — a label-only frame renders as an empty dashed box and is rejected at parse time. If you only have a title, write it as a section header or annotation, not an empty artboard.\n\n**Fill the frame; keep labels short.** Each artboard is a fixed-size surface — compose enough realistic HTML to fill it top to bottom with even vertical rhythm; never leave a large empty band. On desktop/app-shell sidebars, let the nav stack flex to fill (\\`flex:1\\`) and add any persistent bottom action/status after it so the rail reads complete in taller frames. On mobile especially, flow real rows down the whole screen (status bar, header, then list/detail content) rather than a header floating above a gap. Keep every label short enough to sit on one line within its column — shorten the copy rather than relying on the frame to absorb it (long labels wrap or clip).\n\n**Good example — a contacts list, surface \\`browser\\`.** A small, real screen\ncomposed from the helper classes and tokens, layout in inline flex, no fonts or\nhex colors:\n\n\\`\\`\\`html\n<div style=\"display:flex;flex-direction:column;gap:12px;padding:16px;height:100%\">\n <div style=\"display:flex;align-items:center;justify-content:space-between\">\n <h1>Contacts</h1>\n <button class=\"primary\">New contact</button>\n </div>\n <div style=\"display:flex;gap:6px\">\n <span class=\"wf-pill accent\">All 128</span>\n <span class=\"wf-pill\">Favorites</span>\n <span class=\"wf-pill\">Archived</span>\n </div>\n <div class=\"wf-card\" style=\"display:flex;flex-direction:column;gap:0;padding:0\">\n <div style=\"display:flex;align-items:center;gap:10px;padding:10px 12px;border-bottom:1.4px solid var(--wf-line)\">\n <div style=\"width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)\"></div>\n <div style=\"flex:1\"><strong>Jane Cooper</strong><br /><small>jane@acme.co</small></div>\n <span class=\"wf-pill\">Lead</span>\n </div>\n <div style=\"display:flex;align-items:center;gap:10px;padding:10px 12px\">\n <div style=\"width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)\"></div>\n <div style=\"flex:1\"><strong>Marcus Lee</strong><br /><small>marcus@globex.io</small></div>\n <span class=\"wf-pill\">Customer</span>\n </div>\n </div>\n</div>\n\\`\\`\\`\n\n**Mockups belong in the top visual review area.** Static visuals live on the\ncanvas; multi-step flows get both canvas wireframes and a prototype. When the\nuser asks for a mockup, UI state, loading state, layout, screen, or visual\ncomparison, make the canvas the primary home for that static visual. When the\nuser asks for a prototype or the plan contains a sequence the reviewer must\nfeel, keep the canvas artboards and add \\`content.prototype\\` so the top surface\nshows Wireframes / Prototype tabs. Document blocks can explain, compare, or map\nimplementation, but they should not host the primary mockup or prototype just\nbecause \\`custom-html\\`, screenshots, or prose are easier to produce. If the\ncanvas/prototype surface cannot represent the requested fidelity, still keep the\nclosest top-surface representation and call out or extend the needed renderer\ncapability.\n\n**Legacy kit tree.** Older plans set a \\`screen\\` array of \\`{ el, ...props }\\` kit\nnodes instead of \\`html\\`; the renderer still accepts and displays it, but new\nplans emit \\`html\\`. Do not author fresh kit-tree screens — write the HTML mockup\ninstead. Likewise, old or imported plans may carry coordinate-based regions or\nfree-float x/y on notes or artboards; those are legacy escape hatches the\nrenderer still shows but you must never produce. The \\`surface\\` drives the aspect\nand footprint, the canvas auto-places artboards, and the gutter parks notes by\n\\`targetId\\` + \\`placement\\`; never supply width, height, or coordinates for a new\nplan.\n\n<!-- SHARED-CORE:wireframe-canvas END -->\n\n<!-- SHARED-CORE:document-quality START -->\n\n## Document Quality Core\n\nThis section is shared, word for word, by \\`/visual-plan\\`, \\`/ui-plan\\`, and\n\\`/visualize-plan\\`. It is the single source of truth for the document below the\ncanvas. Do not paraphrase it per command.\n\n**The document is a serious technical plan, not marketing.** Write it the way a\nstrong Claude or Codex implementation plan reads: outcome-first, prose-first,\nself-contained, and specific. State the objective and what \"done\" means, the\nscope and non-goals, the proposed approach with the key decisions and their\nrationale, ordered steps that name real files, symbols, actions, and data\nshapes, the risks, and a closing verification step (tests, build, or a checkable\nbehavior). Replace vague prose with specifics; never ship a step like \"make it\nwork.\" No hero art, gradients, logos, nav bars, slogans, value props, giant\nlanding-page headings, or marketing cards unless the user explicitly asks.\n\n**Top visuals and document never duplicate each other.** The UI story lives in\nthe top visual surface: canvas artboards for static inspection, plus prototype\ntabs when the flow should be functional. The document carries the technical depth\nthe visuals cannot show — concrete file/symbol maps, API and data contracts,\ncode snippets, migration or implementation phases, risks, and validation. Repeat\na wireframe in the document only for a genuinely new detail view or comparison.\nSkip the visual surface entirely for non-visual work and write a clean rich\ndocument.\n\n**Use the right block, and make it carry substance.** For the authoritative,\nmachine-checked list of block types and their data schemas, call \\`get-plan-blocks\\`\n— it returns the live registry vocabulary (type, MDX tag, placement, key fields)\nso you never emit a block the editor cannot render or round-trip:\n\n- \\`rich-text\\` for plan prose with real bold/italic/code/links and nested lists.\n- \\`implementation-map\\` / \\`code-tabs\\` for the file map: file path, the\n symbols/components to touch, the reason, risk/coordination notes, and a\n concise syntax-highlighted snippet of the code shape — never the whole file,\n never a prose-only file list.\n- \\`decision\\` for two or three option cards with consequences. These are static\n records; do not style them like clickable tabs or chips unless the renderer\n truly supports changing the selection.\n- \\`diagram\\` for architecture, sequence, data-flow, dependency, or state\n relationships, only when it clarifies something real. Labels must not overlap\n nodes, connectors, or each other.\n- \\`tabs\\` for multiple states, directions, or comparisons. A tab that reveals\n only prose usually means the plan is under-specified — include a relevant\n visual unless the tab is intentionally document-only.\n- \\`table\\`, \\`checklist\\`, \\`callout\\` for scannable structure.\n\n**Open questions live at the bottom as a form when answers would change the\nplan.** Surface answerable unresolved decisions in a final \\`question-form\\`\nblock titled \"Open Questions\". Use \\`single\\` or \\`multi\\` for clear choices,\n\\`freeform\\` for constraints, \\`recommended: true\\` for the default you would pick,\nand option \\`wireframe\\` / \\`diagram\\` previews for visual directions when useful.\nKeep non-answerable assumptions or risks as concise \\`callout\\` blocks in the\nrelevant section. Never bury a questions/decisions wall inside the plan\nnarrative.\n\n**\\`custom-html\\` is a bounded escape hatch only** — a single complete fragment\ninside a block, never \\`html\\`/\\`head\\`/\\`body\\`/\\`script\\` tags, never a generic\nplaceholder, density demo, or proof that custom HTML works. Prefer the native\nblocks for normal plans. It may support supplemental demos or references, but it\nis never the primary home for a requested mockup, UI state, or visual\ncomparison. If fidelity requires HTML/CSS, image capture, or real React/CSS, the\nproduct fix is canvas support for that artifact type, not moving the mockup into\nthe document.\n\n**Before handoff, open the plan and check it.** Fix overlap, excessive\nwhitespace, clipped fragments, misleading inactive controls, poor contrast, and\nunreadable diagrams before asking for approval.\n\n<!-- SHARED-CORE:document-quality END -->\n\n<!-- SHARED-CORE:exemplar START -->\n\n## Good vs. Bad Exemplar\n\n**GOOD.** A \\`/ui-plan\\` for a todo app: a canvas with a \\`desktop\\` artboard whose\n\\`data.html\\` is a real flex layout — a sidebar of links (\\`Inbox 12\\`, \\`Today 4\\`,\n\\`Done\\`), a main column with an \\`<h1>Today</h1>\\`, accent \\`.wf-pill\\`s for the\nfilters, a muted section label \\`OVERDUE\\`, and \\`.wf-card\\` task rows carrying real\ntitles, due dates, and a primary \\`button.primary\\` — styled only through bare\nelements, helper classes, and \\`--wf-*\\` tokens, so the renderer applies the\ncorrect desktop footprint, theme, and one subtle whole-frame wobble. Plain-text\ndesigner notes sit spaced off the frame, pointing only at the controls that need\nexplanation. Below it, a Claude/Codex-grade document: objective and\ndone-criteria, an \\`implementation-map\\` naming the real components and actions\nwith short highlighted snippets, a \\`decision\\` card weighing two real approaches,\nand a validation step — none of it repeating the canvas. If the task also\nchanges a multi-step completion flow, the same top area includes a Prototype tab\nwhose screens use the same labels and states as the canvas artboards, with\n\\`data-goto\\` controls for the sequence. This is the bar.\n\n**BAD.** A \\`data.html\\` with hard-coded hex colors, a \\`font-family\\`, or fixed\npixel width/height; gray placeholder bars \"insinuating\" text on a non-skeleton\nframe; a forced desktop + mobile pair for a popover; floating bordered\nannotation cards hugging the frames; a fresh hand-authored kit-tree \\`screen\\`\ninstead of \\`html\\`; a multi-step UI flow with only static frames and no prototype\ntab; a mockup escaped into a document \\`custom-html\\` block; and a marketing-style\ndocument with a hero heading and value props that just restates what the canvas\nalready shows. Never produce this.\n\n<!-- SHARED-CORE:exemplar END -->\n\n## Tool Guidance\n\n- \\`create-visual-plan\\`: start one structured visual plan per agent task/run;\n \\`content\\` may include no visual surface, canvas only, or canvas + prototype.\n- \\`create-ui-plan\\`: start a UI-first plan when the work is primarily product UI.\n- \\`create-prototype-plan\\`: start a prototype-first plan with a functional top\n review surface.\n- \\`convert-visual-plan-to-prototype\\`: convert an existing HTML wireframe canvas\n into a prototype plan.\n- \\`create-visual-questions\\`: use only for the explicit \\`/visual-questions\\`\n command, not as \\`/visual-plan\\` preflight.\n- \\`visualize-plan\\`: build a visual companion from an existing text plan.\n- \\`update-visual-plan\\`: revise content, status, or comments; prefer\n \\`contentPatches\\` over regenerating the whole plan.\n- \\`read-visual-plan-source\\`: read the normalized plan as \\`plan.mdx\\`,\n optional \\`canvas.mdx\\`, optional \\`.plan-state.json\\`, and JSON.\n- \\`patch-visual-plan-source\\`: apply granular MDX AST patches by stable block,\n artboard, annotation, component, or wireframe-node id.\n- \\`import-visual-plan-source\\`: create or replace a plan from an MDX folder.\n- \\`get-visual-plan\\`: read the current structured plan, exported HTML, and\n annotations; it also returns the MDX folder for source workflows.\n- \\`get-plan-feedback\\`: read unconsumed human feedback. Use it frequently; it\n returns grouped threads, exact anchor details, expected resolver, and recent\n review-event payloads so agents can act only on the comments meant for them.\n- \\`export-visual-plan\\`: export HTML, Markdown fallback, structured JSON, and MDX\n files for repo check-in.\n\nWhen the user critiques a plan's look or structure, fix the renderer or this\nskill — never hand-edit one stored plan. Turn feedback into better guidance.\n\n## Setup & Authentication\n\nThere are two ways into Plans.\n\n**Coding agent (CLI).** Install once with the Agent-Native CLI. The command\ninstalls the Plans skills, registers the hosted Plans MCP connector, and\nauthenticates it in the same step (a one-time browser sign-in at setup — this is\nintended), so the first tool call does not hit an OAuth wall:\n\n\\`\\`\\`bash\nagent-native skills add visual-plan\n\\`\\`\\`\n\nAfter that, \\`/visual-plan\\` (and \\`/ui-plan\\`, \\`/prototype-plan\\`,\n\\`/visual-questions\\`, \\`/visualize-plan\\`) generate a plan and open the editor. Pass \\`--no-connect\\` to\nregister the connector without authenticating, then run\n\\`agent-native connect https://plan.agent-native.com\\` whenever you are ready.\n\n**Browser (people you share with).** Open the Plans editor and create & edit\nwith no sign-up — you work as a guest. Sign in only when you want to save or\nshare; signing in claims the plans you made as a guest into your account.\n\nSharing and commenting require an account: public/shared plans are viewable by\nanyone with the link, but commenting on them needs an agent-native account.\n\nFor fully offline, no-account use, run the Plans app locally and sync plans to\nyour repo as MDX. This local mode is a separate advanced path, not the default\nhosted flow.\n\nIf a Plans tool returns \\`needs auth\\`, \\`Unauthorized\\`, or \\`Session terminated\\`,\ndo not keep retrying the tool. Authenticate the connector with\n\\`agent-native connect https://plan.agent-native.com\\` (OAuth-capable hosts can\ninstead re-run /mcp and choose Authenticate), then continue once the connector\nis available.\n\nHosted default: connect \\`https://plan.agent-native.com/_agent-native/mcp\\`. Do\nnot put shared secrets in skill files.\n`;\n\nexport const UI_PLAN_SKILL_MD = `---\nname: ui-plan\ndescription: >-\n Use Agent-Native Plans for UI-first planning with an optional top pan/zoom\n wireframe canvas, a refined Notion-like document, rich tabs, diagrams,\n comments, drawing, and agent handoff.\nmetadata:\n visibility: exported\n---\n\n# UI Plan\n\nUse \\`/ui-plan\\` when the task is primarily about product UI, user flows,\ninteraction details, component layout, or visual direction. The reviewable UI\ncomes first; implementation detail comes after the user has something concrete to\nreact to.\n\n\\`/visual-plan\\` remains the general command for architecture, backend, refactors,\nand mixed work. Use \\`/prototype-plan\\` when the UI review needs a functional live\nprototype instead of static screens. Use \\`/visual-questions\\` only when the user\nexplicitly wants visual intake before planning, and \\`/visualize-plan\\` when a text\nplan already exists.\n\n## Plan Discipline\n\n- **Gate hard.** Use a UI plan when the surface is new, ambiguous, spans several\n screens or states, or the direction needs agreement before coding. Skip it for\n cosmetic one-liners — a color, a label, a spacing tweak — and just make the\n change. Never ship a single-step or filler plan.\n- **Research before you draft.** Read the real components, routes, and design\n tokens first; ground every mockup and the file map in actual files and symbols.\n Delegate wide exploration to a sub-agent when the surface is large.\n- **Planning is read-only.** Make no source edits while building or reviewing.\n Start editing only after the user approves the UI direction.\n- **Clarify vs. assume.** Do not ask how to build the UI — present the direction\n and options as mockups and tabs. Ask a clarifying question only when an\n ambiguity would change the design; use the host agent's normal\n ask-user-question flow and batch 2-4 before finalizing. Do not call\n \\`create-visual-questions\\` from \\`/ui-plan\\`; keep answerable follow-up inside\n the same plan as a bottom \\`question-form\\` Open Questions block. Otherwise\n state the assumption in the plan and proceed.\n- **The plan is the approval gate.** Ask the user to review and approve the UI\n direction before you write code, and name the files/areas the work touches.\n\n## UI-First Workflow\n\n1. Follow the host agent's normal planning flow: inspect the codebase, gather\n the UI/component context needed, and ask native clarifying questions as needed\n before generating the plan.\n2. Call \\`create-ui-plan\\` with a UI-specific title, brief, source, repo path, and\n structured \\`content\\`. The canvas comes first, the document second.\n3. Compose the top canvas from the kit (see the cores below): the key artboards\n with real product content, designer notes, and connectors only for real\n sequences. Skip the canvas when wireframes would not clarify the work.\n4. Continue below as a concise technical document that stays close to the\n Markdown plan the agent would normally output — not a second copy of the\n canvas — covering concrete files, contracts, phases, risks, and validation.\n5. Call \\`get-plan-feedback\\` before implementation, after review, after a long\n pause, and before the final response. Treat \\`anchorDetails\\`, resolver intent,\n recent review events, and any focused screenshots from browser handoff as the\n source of truth for exactly what changed and exactly what each UI comment\n points at. Apply changes with \\`update-visual-plan\\`, preferring\n \\`contentPatches\\` for one frame, annotation, node, tab, or block. When the\n user wants source-control friendly edits, use \\`patch-visual-plan-source\\`\n against the MDX files instead of regenerating the plan.\n\n## Agent Handoff\n\nAfter the canvas and document, add a short handoff that names the chosen UI\ndirection, unresolved visual questions, and feedback that must be read before\ncode changes. Never claim feedback has been applied until \\`get-plan-feedback\\` or\nthe user has supplied it.\n\n<!-- SHARED-CORE:wireframe-canvas START -->\n\n## Wireframe & Canvas Core\n\nThis section is shared, word for word, by \\`/visual-plan\\`, \\`/ui-plan\\`, and\n\\`/visualize-plan\\`. It is the single source of truth for how wireframes and the\ncanvas work. Do not paraphrase it per command.\n\n**A wireframe is an HTML mockup. The renderer owns the look; you write the\ncontent.** Set \\`data.html\\` to a self-contained, semantic HTML fragment of the\nscreen and set \\`data.surface\\`. The renderer owns the surface footprint/aspect,\nthe dark/light theme, the hand-drawn font, and the rough.js sketch overlay — you\nnever write \\`<html>\\`/\\`<body>\\`/\\`<script>\\`/\\`<style>\\` tags, font-family, hex colors,\nor any width/height/coordinates. You write real HTML layout and real product\ncontent; the renderer styles and roughens it.\n\n**A wireframe block's data is an HTML screen plus a surface:**\n\n\\`\\`\\`json\n{\n \"surface\": \"browser\",\n \"html\": \"<div style=\\\\\"display:flex;flex-direction:column;gap:10px;padding:16px;height:100%\\\\\"><h1>Sign in</h1><p class=\\\\\"wf-muted\\\\\">Use your work email to continue.</p><div class=\\\\\"wf-card\\\\\" style=\\\\\"display:flex;flex-direction:column;gap:10px\\\\\"><label>Email<input value=\\\\\"jane@acme.co\\\\\" /></label><label>Password<input value=\\\\\"••••••••\\\\\" /></label><label style=\\\\\"display:flex;align-items:center;gap:8px\\\\\"><input type=\\\\\"checkbox\\\\\" checked /> Remember me</label><button class=\\\\\"primary\\\\\">Sign in</button></div><a href=\\\\\"#\\\\\">Forgot password?</a></div>\"\n}\n\\`\\`\\`\n\n**Write PLAIN semantic HTML and let the renderer style it.** Bare elements\n(\\`h1\\`/\\`h2\\`/\\`h3\\`, \\`p\\`, \\`button\\`, \\`input\\`, \\`<input type=\"checkbox\">\\`, \\`a\\`, \\`hr\\`)\nare auto-themed — no classes needed. Helper classes carry the rest:\n\n- \\`.wf-card\\` / \\`.wf-box\\` — a bordered, padded container (a panel, a list item).\n- \\`.wf-pill\\` / \\`.wf-chip\\` — a rounded tag or filter; add \\`.accent\\`\n (\\`<span class=\"wf-pill accent\">\\`) for the accent-filled variant.\n- \\`.wf-muted\\` — secondary/muted text (or use \\`<small>\\`).\n- \\`button.primary\\` or any element with \\`[data-primary]\\` — the accent-filled\n primary button.\n\n**Use the \\`--wf-*\\` tokens for any custom color, never hex.** The renderer flips\nthese on light/dark, so reading them is what keeps a mockup correct in both\nthemes. For any inline border, background, or text color, reference a token:\n\\`style=\"border:1.4px solid var(--wf-line)\"\\`. The tokens are \\`--wf-ink\\` (text),\n\\`--wf-muted\\` (secondary text), \\`--wf-line\\` (borders/dividers), \\`--wf-paper\\`\n(page background), \\`--wf-card\\` (raised surface), \\`--wf-accent\\` /\n\\`--wf-accent-fg\\` / \\`--wf-accent-soft\\` (brand action), \\`--wf-warn\\`, \\`--wf-ok\\`,\nand \\`--wf-radius\\`. Never hard-code a hex color and never set \\`font-family\\` — the\nrenderer owns the sketch/clean font.\n\n**Lay out with inline \\`style\\` flex/grid.** You write the real layout —\n\\`display:flex; flex-direction:column; gap:10px; padding:16px\\` and so on — and the\nrenderer never repositions anything. Compose the actual product: reproduce the\ncurrent screen, then show the modification. Real labels, real counts, real dates,\nreal button text grounded in the screen you read; not lorem or gray bars.\n\n**Surface presets — match the real footprint, never default to desktop+mobile.**\nPick the \\`surface\\` that matches what the user will actually see:\n\n- \\`browser\\`: a web page that needs a browser chrome frame around it.\n- \\`desktop\\`: a full desktop app page or app shell.\n- \\`mobile\\`: a phone screen, only when the work is genuinely mobile.\n- \\`popover\\`: a small floating menu, dropdown, or inline popover.\n- \\`panel\\`: a side panel, inspector, or sidebar widget.\n\nThe surface locks the footprint and aspect; never set width/height/coordinates.\nA sidebar popover renders as a small surface, not a desktop page and a phone\nframe. Do not emit \\`desktop\\` + \\`mobile\\` variants unless responsive behavior\nactually changes the layout. For a component or widget, show one broader\napp-context frame only when placement affects understanding, then the focused\ncomponent states.\n\n**Modify, don't redesign.** When the task changes an existing screen, reproduce\nthe current screen's real layout and footprint FIRST, then change only the delta\nand call it out with a single annotation. Do not restack the page into a new\nlayout. For net-new surfaces, compose from the real app shell.\n\n**Zoom in on sub-surfaces, don't redraw the page.** For a small sub-surface (a\npopover, menu, dialog, toast), show the full screen once, then add a small\nseparate artboard whose \\`html\\` contains ONLY that sub-surface — do not re-draw\nthe whole page around it, and do not scale a duplicate up. Pick the matching\n\\`surface\\` (e.g. \\`popover\\`) so the footprint is right; never widen a popover to\npage width.\n\n**Loading / skeleton states.** Set \\`data.skeleton: true\\` on the wireframe and\nfill the \\`html\\` with neutral, textless placeholder geometry — boxes and bars\nbuilt as \\`<div>\\`s with \\`background:var(--wf-line)\\` and explicit heights/widths,\nno labels or copy. The renderer drops borders, sketch, and color into the\nskeleton register automatically. Never escape to a \\`custom-html\\` document block\nto fake a loader, and never move a mockup out of the canvas — mockups always\nlive in canvas artboards.\n\n**Editing an existing mockup.** To change one element, text, or color in an\nexisting html mockup, do NOT regenerate the frame — call \\`update-visual-plan\\`\nwith \\`contentPatches: [{ op: \"patch-wireframe-html\", blockId, edits: [{ find,\nreplace }] }]\\`. Each \\`find\\` is a unique snippet of the current html (read it\nfirst with \\`get-visual-plan\\`); set \\`all: true\\` on an edit to replace every\noccurrence. The result is re-sanitized.\n\n**Canvas annotations are designer notes on the artboard.** When a top canvas is\npresent, sprinkle Figma-style notes near the frames they explain: a short\nheading, supporting text, and bullets — plain text layers, never bordered or\nshadowed cards, and never a box around a frame. The renderer spaces notes away\nfrom frames, so place each note by the frame it describes. Use an arrow only to\npoint at one specific control or transition; for a broad frame-level note, write\ntext beside the frame with no connector. Connectors are for real sequences only —\nnever fake \"Step 1 → Step 2\" lines between independent states.\n\n**Do not create overlapping annotations.** Anchor each note to the frame it\nexplains with \\`targetId\\` + \\`placement\\` (top/right/bottom/left). The renderer\nparks notes in a gutter beside the frame and lays them out automatically — never\nsupply x/y or points for anchored notes; hand-placed coordinates fight the\nauto-layout and cause the overlap you're trying to avoid. Reserve arrows for a\nnote that must point at a specific control inside a frame; a note that simply\nsits beside its frame needs no arrow.\n\n**Patching.** Edit one wireframe, canvas annotation, or block with targeted \\`contentPatches\\`\n(for example \\`update-block\\`, \\`replace-blocks\\`, \\`update-canvas-annotation\\`) rather\nthan regenerating the whole plan. \\`contentPatches\\` are part of the public MCP\naction schema, so Claude Code, Codex, Cursor, and other hosts can make surgical\nedits. If an agent is working from exported source files, use\n\\`read-visual-plan-source\\` / \\`patch-visual-plan-source\\`: \\`plan.mdx\\` holds\nfrontmatter plus markdown/document blocks, \\`canvas.mdx\\` holds\n\\`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\\`, and the\npatch action normalizes the MDX back into the same JSON runtime model. JSON is\nthe canonical runtime shape; MDX is the repo-friendly authoring/export surface.\nIn the browser, humans edit \\`rich-text\\` prose inline; agents should still use\n\\`update-rich-text\\` content patches or source patches for prose, and use\ncomments/structured patches for canvas, artboard, wireframe, and diagram edits.\n\n**Never emit a titled artboard with no interior wireframe content.** Every artboard you place on the canvas must carry an \\`html\\` wireframe (or reference a wireframe block via \\`blockId\\`) — a label-only frame renders as an empty dashed box and is rejected at parse time. If you only have a title, write it as a section header or annotation, not an empty artboard.\n\n**Fill the frame; keep labels short.** Each artboard is a fixed-size surface — compose enough realistic HTML to fill it top to bottom with even vertical rhythm; never leave a large empty band. On desktop/app-shell sidebars, let the nav stack flex to fill (\\`flex:1\\`) and add any persistent bottom action/status after it so the rail reads complete in taller frames. On mobile especially, flow real rows down the whole screen (status bar, header, then list/detail content) rather than a header floating above a gap. Keep every label short enough to sit on one line within its column — shorten the copy rather than relying on the frame to absorb it (long labels wrap or clip).\n\n**Good example — a contacts list, surface \\`browser\\`.** A small, real screen\ncomposed from the helper classes and tokens, layout in inline flex, no fonts or\nhex colors:\n\n\\`\\`\\`html\n<div style=\"display:flex;flex-direction:column;gap:12px;padding:16px;height:100%\">\n <div style=\"display:flex;align-items:center;justify-content:space-between\">\n <h1>Contacts</h1>\n <button class=\"primary\">New contact</button>\n </div>\n <div style=\"display:flex;gap:6px\">\n <span class=\"wf-pill accent\">All 128</span>\n <span class=\"wf-pill\">Favorites</span>\n <span class=\"wf-pill\">Archived</span>\n </div>\n <div class=\"wf-card\" style=\"display:flex;flex-direction:column;gap:0;padding:0\">\n <div style=\"display:flex;align-items:center;gap:10px;padding:10px 12px;border-bottom:1.4px solid var(--wf-line)\">\n <div style=\"width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)\"></div>\n <div style=\"flex:1\"><strong>Jane Cooper</strong><br /><small>jane@acme.co</small></div>\n <span class=\"wf-pill\">Lead</span>\n </div>\n <div style=\"display:flex;align-items:center;gap:10px;padding:10px 12px\">\n <div style=\"width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)\"></div>\n <div style=\"flex:1\"><strong>Marcus Lee</strong><br /><small>marcus@globex.io</small></div>\n <span class=\"wf-pill\">Customer</span>\n </div>\n </div>\n</div>\n\\`\\`\\`\n\n**Mockups belong in the top visual review area.** Static visuals live on the\ncanvas; multi-step flows get both canvas wireframes and a prototype. When the\nuser asks for a mockup, UI state, loading state, layout, screen, or visual\ncomparison, make the canvas the primary home for that static visual. When the\nuser asks for a prototype or the plan contains a sequence the reviewer must\nfeel, keep the canvas artboards and add \\`content.prototype\\` so the top surface\nshows Wireframes / Prototype tabs. Document blocks can explain, compare, or map\nimplementation, but they should not host the primary mockup or prototype just\nbecause \\`custom-html\\`, screenshots, or prose are easier to produce. If the\ncanvas/prototype surface cannot represent the requested fidelity, still keep the\nclosest top-surface representation and call out or extend the needed renderer\ncapability.\n\n**Legacy kit tree.** Older plans set a \\`screen\\` array of \\`{ el, ...props }\\` kit\nnodes instead of \\`html\\`; the renderer still accepts and displays it, but new\nplans emit \\`html\\`. Do not author fresh kit-tree screens — write the HTML mockup\ninstead. Likewise, old or imported plans may carry coordinate-based regions or\nfree-float x/y on notes or artboards; those are legacy escape hatches the\nrenderer still shows but you must never produce. The \\`surface\\` drives the aspect\nand footprint, the canvas auto-places artboards, and the gutter parks notes by\n\\`targetId\\` + \\`placement\\`; never supply width, height, or coordinates for a new\nplan.\n\n<!-- SHARED-CORE:wireframe-canvas END -->\n\n<!-- SHARED-CORE:document-quality START -->\n\n## Document Quality Core\n\nThis section is shared, word for word, by \\`/visual-plan\\`, \\`/ui-plan\\`, and\n\\`/visualize-plan\\`. It is the single source of truth for the document below the\ncanvas. Do not paraphrase it per command.\n\n**The document is a serious technical plan, not marketing.** Write it the way a\nstrong Claude or Codex implementation plan reads: outcome-first, prose-first,\nself-contained, and specific. State the objective and what \"done\" means, the\nscope and non-goals, the proposed approach with the key decisions and their\nrationale, ordered steps that name real files, symbols, actions, and data\nshapes, the risks, and a closing verification step (tests, build, or a checkable\nbehavior). Replace vague prose with specifics; never ship a step like \"make it\nwork.\" No hero art, gradients, logos, nav bars, slogans, value props, giant\nlanding-page headings, or marketing cards unless the user explicitly asks.\n\n**Top visuals and document never duplicate each other.** The UI story lives in\nthe top visual surface: canvas artboards for static inspection, plus prototype\ntabs when the flow should be functional. The document carries the technical depth\nthe visuals cannot show — concrete file/symbol maps, API and data contracts,\ncode snippets, migration or implementation phases, risks, and validation. Repeat\na wireframe in the document only for a genuinely new detail view or comparison.\nSkip the visual surface entirely for non-visual work and write a clean rich\ndocument.\n\n**Use the right block, and make it carry substance.** For the authoritative,\nmachine-checked list of block types and their data schemas, call \\`get-plan-blocks\\`\n— it returns the live registry vocabulary (type, MDX tag, placement, key fields)\nso you never emit a block the editor cannot render or round-trip:\n\n- \\`rich-text\\` for plan prose with real bold/italic/code/links and nested lists.\n- \\`implementation-map\\` / \\`code-tabs\\` for the file map: file path, the\n symbols/components to touch, the reason, risk/coordination notes, and a\n concise syntax-highlighted snippet of the code shape — never the whole file,\n never a prose-only file list.\n- \\`decision\\` for two or three option cards with consequences. These are static\n records; do not style them like clickable tabs or chips unless the renderer\n truly supports changing the selection.\n- \\`diagram\\` for architecture, sequence, data-flow, dependency, or state\n relationships, only when it clarifies something real. Labels must not overlap\n nodes, connectors, or each other.\n- \\`tabs\\` for multiple states, directions, or comparisons. A tab that reveals\n only prose usually means the plan is under-specified — include a relevant\n visual unless the tab is intentionally document-only.\n- \\`table\\`, \\`checklist\\`, \\`callout\\` for scannable structure.\n\n**Open questions live at the bottom as a form when answers would change the\nplan.** Surface answerable unresolved decisions in a final \\`question-form\\`\nblock titled \"Open Questions\". Use \\`single\\` or \\`multi\\` for clear choices,\n\\`freeform\\` for constraints, \\`recommended: true\\` for the default you would pick,\nand option \\`wireframe\\` / \\`diagram\\` previews for visual directions when useful.\nKeep non-answerable assumptions or risks as concise \\`callout\\` blocks in the\nrelevant section. Never bury a questions/decisions wall inside the plan\nnarrative.\n\n**\\`custom-html\\` is a bounded escape hatch only** — a single complete fragment\ninside a block, never \\`html\\`/\\`head\\`/\\`body\\`/\\`script\\` tags, never a generic\nplaceholder, density demo, or proof that custom HTML works. Prefer the native\nblocks for normal plans. It may support supplemental demos or references, but it\nis never the primary home for a requested mockup, UI state, or visual\ncomparison. If fidelity requires HTML/CSS, image capture, or real React/CSS, the\nproduct fix is canvas support for that artifact type, not moving the mockup into\nthe document.\n\n**Before handoff, open the plan and check it.** Fix overlap, excessive\nwhitespace, clipped fragments, misleading inactive controls, poor contrast, and\nunreadable diagrams before asking for approval.\n\n<!-- SHARED-CORE:document-quality END -->\n\n<!-- SHARED-CORE:exemplar START -->\n\n## Good vs. Bad Exemplar\n\n**GOOD.** A \\`/ui-plan\\` for a todo app: a canvas with a \\`desktop\\` artboard whose\n\\`data.html\\` is a real flex layout — a sidebar of links (\\`Inbox 12\\`, \\`Today 4\\`,\n\\`Done\\`), a main column with an \\`<h1>Today</h1>\\`, accent \\`.wf-pill\\`s for the\nfilters, a muted section label \\`OVERDUE\\`, and \\`.wf-card\\` task rows carrying real\ntitles, due dates, and a primary \\`button.primary\\` — styled only through bare\nelements, helper classes, and \\`--wf-*\\` tokens, so the renderer applies the\ncorrect desktop footprint, theme, and one subtle whole-frame wobble. Plain-text\ndesigner notes sit spaced off the frame, pointing only at the controls that need\nexplanation. Below it, a Claude/Codex-grade document: objective and\ndone-criteria, an \\`implementation-map\\` naming the real components and actions\nwith short highlighted snippets, a \\`decision\\` card weighing two real approaches,\nand a validation step — none of it repeating the canvas. If the task also\nchanges a multi-step completion flow, the same top area includes a Prototype tab\nwhose screens use the same labels and states as the canvas artboards, with\n\\`data-goto\\` controls for the sequence. This is the bar.\n\n**BAD.** A \\`data.html\\` with hard-coded hex colors, a \\`font-family\\`, or fixed\npixel width/height; gray placeholder bars \"insinuating\" text on a non-skeleton\nframe; a forced desktop + mobile pair for a popover; floating bordered\nannotation cards hugging the frames; a fresh hand-authored kit-tree \\`screen\\`\ninstead of \\`html\\`; a multi-step UI flow with only static frames and no prototype\ntab; a mockup escaped into a document \\`custom-html\\` block; and a marketing-style\ndocument with a hero heading and value props that just restates what the canvas\nalready shows. Never produce this.\n\n<!-- SHARED-CORE:exemplar END -->\n\n## Tool Guidance\n\n- \\`create-ui-plan\\`: create the UI-first structured visual plan.\n- \\`create-prototype-plan\\`: create a prototype-first plan when UI review needs a\n functional live prototype.\n- \\`convert-visual-plan-to-prototype\\`: convert an existing HTML wireframe canvas\n into a prototype plan.\n- \\`create-visual-questions\\`: use only for the explicit \\`/visual-questions\\`\n command, not as \\`/ui-plan\\` preflight.\n- \\`update-visual-plan\\`: revise content, mockups, comments, or handoff notes;\n prefer targeted \\`contentPatches\\`.\n- \\`read-visual-plan-source\\`: read the normalized plan as \\`plan.mdx\\`,\n optional \\`canvas.mdx\\`, optional \\`.plan-state.json\\`, and JSON.\n- \\`patch-visual-plan-source\\`: apply granular MDX AST patches by stable block,\n artboard, annotation, component, or wireframe-node id.\n- \\`import-visual-plan-source\\`: create or replace a plan from an MDX folder.\n- \\`get-visual-plan\\`: inspect the current structured plan, exported HTML, and\n annotations; it also returns the MDX folder for source workflows.\n- \\`get-plan-feedback\\`: read unconsumed reviewer comments before coding; it\n returns grouped threads, exact anchor details, expected resolver, and recent\n review-event payloads so agents can act only on the comments meant for them.\n- \\`export-visual-plan\\`: export HTML, Markdown fallback, structured JSON, and MDX\n files for repo check-in.\n\nWhen the user critiques a plan's look or structure, fix the renderer or this\nskill — never hand-edit one stored plan. Turn feedback into better guidance.\n\n## Setup & Authentication\n\nThere are two ways into Plans.\n\n**Coding agent (CLI).** Install once with the Agent-Native CLI. The command\ninstalls the Plans skills, registers the hosted Plans MCP connector, and\nauthenticates it in the same step (a one-time browser sign-in at setup — this is\nintended), so the first tool call does not hit an OAuth wall:\n\n\\`\\`\\`bash\nagent-native skills add visual-plan\n\\`\\`\\`\n\nAfter that, \\`/visual-plan\\` (and \\`/ui-plan\\`, \\`/prototype-plan\\`,\n\\`/visual-questions\\`, \\`/visualize-plan\\`) generate a plan and open the editor. Pass \\`--no-connect\\` to\nregister the connector without authenticating, then run\n\\`agent-native connect https://plan.agent-native.com\\` whenever you are ready.\n\n**Browser (people you share with).** Open the Plans editor and create & edit\nwith no sign-up — you work as a guest. Sign in only when you want to save or\nshare; signing in claims the plans you made as a guest into your account.\n\nSharing and commenting require an account: public/shared plans are viewable by\nanyone with the link, but commenting on them needs an agent-native account.\n\nFor fully offline, no-account use, run the Plans app locally and sync plans to\nyour repo as MDX. This local mode is a separate advanced path, not the default\nhosted flow.\n\nIf a Plans tool returns \\`needs auth\\`, \\`Unauthorized\\`, or \\`Session terminated\\`,\ndo not keep retrying the tool. Authenticate the connector with\n\\`agent-native connect https://plan.agent-native.com\\` (OAuth-capable hosts can\ninstead re-run /mcp and choose Authenticate), then continue once the connector\nis available.\n\nHosted default: connect \\`https://plan.agent-native.com/_agent-native/mcp\\`. Do\nnot put shared secrets in skill files.\n`;\n\nexport const PROTOTYPE_PLAN_SKILL_MD = `---\nname: prototype-plan\ndescription: >-\n Use Agent-Native Plans for /prototype-plan when work needs a functional\n prototype-first plan, static mocks, comments, review toggles, or conversion\n from a visual plan.\nmetadata:\n visibility: exported\n---\n\n# Prototype Plan\n\n\\`/prototype-plan\\` creates a plan whose primary review surface is a live,\nfunctional prototype above the document. Use it when the user needs to feel a\nflow, operate basic UI state, or comment on interaction before implementation\nhardens the decision.\n\n## Rule\n\nMake the prototype answer a concrete question. The plan should say what is being\ntested, show the functional prototype first, then keep static mocks and implementation\nnotes in the document below.\n\n## When To Use\n\nUse \\`/prototype-plan\\` when the user asks for a prototype, wants to click through\nand operate UI states, needs design review before code, wants comments pinned to\nlive screens, or asks to move a visual plan into a prototype.\n\nPrefer \\`/visual-plan\\` for architecture, data flow, or non-interactive planning.\nPrefer \\`/ui-plan\\` when static screen review is enough. Use \\`/visualize-plan\\`\nfirst only when the user hands you an existing Markdown/Codex/Claude plan that\nneeds a visual companion before becoming interactive.\n\n## Core Workflow\n\n1. Inspect the real codebase and decide the question the prototype should\n answer. Good examples: \"Does this onboarding flow feel short enough?\" or\n \"Which dashboard density should we implement?\"\n2. Call \\`create-prototype-plan\\` with a title, brief, and screen HTML. Default to\n one functional prototype screen when local UI behavior is enough; use 2-4\n screens only for true routes, steps, or materially different contexts. The\n returned plan opens with the prototype viewer on top and static mocks, flow\n diagram, implementation map, and verification below.\n3. Make controls actually work. Use the renderer's safe Alpine-like directives:\n \\`x-data\\`, \\`x-model\\`, \\`x-for\\`, \\`x-text\\`, \\`x-show\\`, \\`:class\\`, \\`@click\\`, and\n \\`@keydown.enter\\`. Use safe helper verbs such as \\`remove(list, item)\\`,\n \\`setAll(list, 'done', true)\\`, \\`removeWhere(list, 'done', true)\\`, and counters\n such as \\`count(list)\\`, \\`countWhere(list, 'done', true)\\`, and\n \\`remaining(list, 'done')\\` when they help. Use \\`data-goto=\"screen-id\"\\` only\n for true screen/route changes, not for every button press.\n4. Show important app feedback inside the prototype itself: selected filters,\n checked rows, typed drafts, validation messages, permissions, progress, or\n empty states.\n5. Surface the returned Plans link and ask the user to click through, comment on\n the prototype or static mocks, and approve the direction before code changes.\n6. Before implementing or revising, call \\`get-plan-feedback\\`. Treat prototype\n anchors, screenshots, and resolver intent as the source of truth.\n7. Update with \\`update-visual-plan\\` content patches. Use\n \\`patch-prototype-html\\`, \\`update-prototype-screen\\`, or \\`set-prototype\\` for\n targeted prototype edits instead of regenerating the whole plan.\n\n## Converting A Visual Plan\n\nWhen a visual plan already has HTML canvas wireframes, call\n\\`convert-visual-plan-to-prototype\\` with the plan id. This derives prototype\nscreens from the canvas frames, preserves the canvas/static mocks by default,\nand changes the top review surface to the prototype viewer.\n\nUse \\`removeCanvas: true\\` only when the user explicitly wants the old canvas\ngone. Otherwise keep static mocks available for source export and detailed\nreview.\n\n## Prototype Screen HTML\n\nWrite bounded semantic HTML fragments only:\n\n\\`\\`\\`html\n<div style=\"display:flex;flex-direction:column;gap:14px;padding:18px;height:100%\">\n <header style=\"display:flex;justify-content:space-between;gap:12px\">\n <div>\n <h1>Launch checklist</h1>\n <p class=\"wf-muted\">Reviewer can add, complete, filter, and remove tasks.</p>\n </div>\n <span class=\"wf-pill accent\">Live prototype</span>\n </header>\n <section\n class=\"wf-card\"\n x-data=\"{ draft: '', filter: 'all', todos: [{ text: 'Check copy', done: false }, { text: 'Confirm owner', done: true }] }\"\n style=\"display:flex;flex-direction:column;gap:10px\"\n >\n <div style=\"display:flex;gap:8px\">\n <input x-model=\"draft\" @keydown.enter=\"draft && todos.push({ text: draft, done: false }); draft = ''\" placeholder=\"Add task\" />\n <button class=\"primary\" @click=\"draft && todos.push({ text: draft, done: false }); draft = ''\">Add</button>\n </div>\n <div style=\"display:flex;gap:8px\">\n <button @click=\"filter = 'all'\" :class=\"{ primary: filter === 'all' }\">All</button>\n <button @click=\"filter = 'done'\" :class=\"{ primary: filter === 'done' }\">Done</button>\n <button @click=\"setAll(todos, 'done', true)\">Mark all done</button>\n </div>\n <p class=\"wf-muted\"><span x-text=\"remaining(todos, 'done')\"></span> open / <span x-text=\"count(todos)\"></span> total</p>\n <div\n class=\"wf-box\"\n x-for=\"todo in todos\"\n x-show=\"filter === 'all' || (filter === 'done' && todo.done)\"\n :class=\"{ 'is-done': todo.done }\"\n style=\"display:flex;justify-content:space-between;gap:10px\"\n >\n <label style=\"display:flex;gap:8px\"><input type=\"checkbox\" x-model=\"todo.done\" /><span x-text=\"todo.text\"></span></label>\n <button @click=\"remove(todos, todo)\">Remove</button>\n </div>\n <button @click=\"removeWhere(todos, 'done', true)\">Clear completed</button>\n </section>\n</div>\n\\`\\`\\`\n\nUse real labels, counts, dates, and controls grounded in the target app. Keep\nsurfaces honest: \\`browser\\` for web pages, \\`desktop\\` for app shells, \\`mobile\\`\nonly for real mobile work, \\`panel\\` for side panels, and \\`popover\\` for menus.\n\nDo not include \\`<html>\\`, \\`<body>\\`, \\`<script>\\`, \\`<style>\\`, browser \\`on*\\`\nhandler attributes such as \\`onclick\\`, fake APIs, raw secrets, or customer data.\nThe renderer owns sketchy/clean mode, theme, surface sizing, rough outlines, and\ncomment overlays.\n\n## Review Surface\n\nPrototype plans support:\n\n- real local controls through safe prototype directives\n- optional screen/route transitions from \\`data-goto\\`\n- rough vs clean mode through the shared wireframe toggle\n- dark vs light mode through the shared theme toggle\n- comment visibility from the prototype toolbar\n- Figma-style comments pinned directly on live prototype screens\n- a popout URL with \\`?prototype=1\\` for focused browser review\n- static wireframe mocks in the document body where they help implementation\n\n## Source Files\n\nRuntime JSON is canonical. Source export uses:\n\n- \\`plan.mdx\\` for document blocks\n- \\`prototype.mdx\\` for \\`<Prototype>\\`, \\`<PrototypeScreen>\\`, and\n \\`<PrototypeTransition>\\`\n- \\`canvas.mdx\\` for static mocks when a canvas is present\n- \\`.plan-state.json\\` for persisted viewport state\n\nPatch source with \\`patch-visual-plan-source\\` only when the user wants\nsource-control friendly edits. Patch runtime content when the user is simply\nreviewing and iterating.\n\n## Related Skills\n\n- \\`visual-plan\\`\n- \\`ui-plan\\`\n- \\`visualize-plan\\`\n- \\`visual-questions\\`\n`;\n\nexport const VISUAL_QUESTIONS_SKILL_MD = `---\nname: visual-questions\ndescription: >-\n Use Agent-Native Plans to ask rich visual intake questions when\n /visual-questions is explicitly requested before creating a UI plan or visual\n plan.\nmetadata:\n visibility: both\n---\n\n# Visual Questions\n\nUse \\`/visual-questions\\` when the next best step is not a plan yet, but a\nreviewable visual intake: single-choice chips, multi-select chips, freeform\nnotes, mockup choices, sketch diagrams, and a generated answer summary that feeds\nthe next planning prompt. It composes with \\`/visual-plan\\`, \\`/ui-plan\\`,\n\\`/prototype-plan\\`, and \\`/visualize-plan\\`.\n\n## When To Use\n\n- The user asks to be shown options before the agent writes a plan.\n- UI direction, form factor, layout model, feature set, or visual style is fuzzy\n enough that 2-6 answers would materially change the plan.\n- The user would benefit from choosing between visual mockups or diagrams rather\n than answering text-only prompts.\n\nGate hard: skip this for tiny, unambiguous changes. If the agent can reasonably\ninfer the answer, prefer \\`/ui-plan\\`, \\`/prototype-plan\\`, or \\`/visual-plan\\` directly and put\nassumptions in the plan.\n\nVisual questions are an explicit intake command, not an automatic preflight for\n\\`/visual-plan\\`, \\`/ui-plan\\`, or \\`/prototype-plan\\`.\n\n## Workflow\n\n1. Call \\`create-visual-questions\\` with a clear title, brief, source, and repo\n path when known.\n2. Omit \\`questions\\` for the default UI intake. Provide a custom \\`questions\\` array\n only when the task has domain-specific choices.\n3. Surface the returned Plans link and ask the user to answer visually.\n4. The generated summary drives the next step: \\`create-ui-plan\\` for static UI\n review, \\`create-prototype-plan\\` for click-through UI flows,\n \\`create-visual-plan\\` for general plans, \\`visualize-plan\\` when a text plan\n already exists, or \\`update-visual-plan\\` with targeted \\`contentPatches\\` to\n fold answers into an active plan.\n5. If the user leaves comments, call \\`get-plan-feedback\\` before using the answers.\n\n## Question Types\n\nSupported \\`questions\\` entries:\n\n- \\`single\\`: chip group where one option wins.\n- \\`multi\\`: chip group where multiple options can be selected.\n- \\`freeform\\`: textarea for constraints, inspirations, or things to avoid.\n- \\`visual\\`: visual options with sketch previews — use for layout direction, flow\n depth, surface choice, or diagram choices.\n\nEach option can include \\`label\\`, \\`value\\`, \\`description\\`, \\`recommended\\`,\n\\`preview\\`, and \\`bullets\\`. Valid \\`preview\\` values match the wireframe surfaces:\n\\`desktop\\`, \\`mobile\\`, \\`popover\\`, \\`panel\\`, \\`component\\`, \\`split\\`, \\`flow\\`, and\n\\`diagram\\`. Pick the preview that matches the real footprint — do not offer a\ndesktop/mobile pair for a popover, panel, or component.\n\n## Quality Bar\n\n- Ask only decision-changing questions. A beautiful form with low-value questions\n is still friction.\n- Prefer visible, answerable options over abstract prose.\n- Use visual tabs when users need to compare layout or flow shapes.\n- Keep the output calm and document-like, not a landing page.\n- The generated answer summary is not the final plan; it is the intake prompt for\n the next agent step.\n\n## Tool Guidance\n\n- \\`create-visual-questions\\`: create the interactive intake plan.\n- \\`get-visual-plan\\`: inspect the current visual question plan.\n- \\`get-plan-feedback\\`: read comments before creating or updating the next plan.\n- \\`create-ui-plan\\`: create a UI-first plan from the answers.\n- \\`create-prototype-plan\\`: create a prototype-first plan from the answers when\n interaction feel matters.\n- \\`create-visual-plan\\`: create a general visual plan from the answers.\n- \\`visualize-plan\\`: enrich an existing text plan after answers are gathered.\n- \\`export-visual-plan\\`: export answer plans as HTML, Markdown fallback,\n structured JSON, and MDX files when the intake needs to be checked into a repo.\n- \\`read-visual-plan-source\\` / \\`patch-visual-plan-source\\`: inspect or patch the\n MDX source if another agent is operating from checked-in plan files.\n\n## Setup & Authentication\n\nThere are two ways into Plans.\n\n**Coding agent (CLI).** Install once with the Agent-Native CLI. The command\ninstalls the Plans skills, registers the hosted Plans MCP connector, and\nauthenticates it in the same step (a one-time browser sign-in at setup — this is\nintended), so the first tool call does not hit an OAuth wall:\n\n\\`\\`\\`bash\nagent-native skills add visual-plan\n\\`\\`\\`\n\nAfter that, \\`/visual-plan\\` (and \\`/ui-plan\\`, \\`/prototype-plan\\`,\n\\`/visual-questions\\`, \\`/visualize-plan\\`) generate a plan and open the editor. Pass \\`--no-connect\\` to\nregister the connector without authenticating, then run\n\\`agent-native connect https://plan.agent-native.com\\` whenever you are ready.\n\n**Browser (people you share with).** Open the Plans editor and create & edit\nwith no sign-up — you work as a guest. Sign in only when you want to save or\nshare; signing in claims the plans you made as a guest into your account.\n\nSharing and commenting require an account: public/shared plans are viewable by\nanyone with the link, but commenting on them needs an agent-native account.\n\nFor fully offline, no-account use, run the Plans app locally and sync plans to\nyour repo as MDX. This local mode is a separate advanced path, not the default\nhosted flow.\n\nIf a Plans tool returns \\`needs auth\\`, \\`Unauthorized\\`, or \\`Session terminated\\`,\ndo not keep retrying the tool. Authenticate the connector with\n\\`agent-native connect https://plan.agent-native.com\\` (OAuth-capable hosts can\ninstead re-run /mcp and choose Authenticate), then continue once the connector\nis available.\n\nHosted default: connect \\`https://plan.agent-native.com/_agent-native/mcp\\`. Do\nnot put shared secrets in skill files.\n`;\n\nexport const VISUALIZE_PLAN_SKILL_MD = `---\nname: visualize-plan\ndescription: >-\n Convert an existing Codex, Claude Code, Markdown, or pasted plan into an\n Agent-Native Plans visual companion with diagrams, wireframes, prototypes,\n annotations, and feedback.\nmetadata:\n visibility: exported\n---\n\n# Visualize Plan\n\nUse \\`/visualize-plan\\` when a plan already exists and the user wants it easier to\nreview. The native Codex or Claude Code plan can stay where it is; Agent-Native\nPlans creates a structured visual companion beside it — diagrams, wireframes,\nstate sketches, functional prototypes, option cards, and comment prompts instead\nof a wall of text. It still reads like a plan, not a marketing page.\n\nUse \\`/prototype-plan\\` instead when the user wants a functional prototype as the first\nartifact and there is no text plan to preserve. When a text plan already exists,\n\\`/visualize-plan\\` should decide whether it needs no visual surface, canvas only,\nor canvas + prototype; call \\`convert-visual-plan-to-prototype\\` after\nvisualization when its HTML wireframes should drive a prototype review.\n\n## Plan Discipline\n\n- **Gate hard.** A visual companion is worth it only when the source plan is\n long, risky, or hard to react to as text. If the source plan is for trivial,\n unambiguous work, skip the companion and just implement.\n- **Stay grounded and read-only.** Preserve the source plan's intent, do not\n invent codebase facts, and label anything inferred as inferred. Make no source\n edits while building or reviewing the companion.\n- **The companion is the approval gate.** Ask the user to review and approve the\n direction before you write code, and name which files/areas the work touches.\n Carry answerable unresolved assumptions and open questions into a bottom\n \\`question-form\\` block instead of guessing silently.\n\n## Workflow\n\n1. Gather the existing plan text from the user's paste, a referenced file, or\n recent visible agent context. Do not invent the source plan. If no plan text\n exists and the work is UI-heavy, use \\`/ui-plan\\` or \\`/prototype-plan\\` instead.\n2. Call \\`visualize-plan\\` with \\`planText\\`, \\`title\\`, \\`brief\\`, \\`source\\`, and\n \\`repoPath\\` when available.\n3. Surface the returned Plans link or inline MCP App.\n4. Decide the top visual surface with the rules below, then enrich the import\n with \\`update-visual-plan\\` (prefer targeted \\`contentPatches\\`): add canvas\n wireframes for user-visible UI, add \\`content.prototype\\` for multi-step flows,\n add diagrams for architecture or data flow, add option cards for real\n tradeoffs, and add explicit open questions. Apply the two cores below — the\n companion must meet the same quality bar as a fresh plan, not be a thinner\n ruleset. Label inferred visuals as inferred. When the user wants\n source-control friendly edits, use \\`patch-visual-plan-source\\` against the MDX\n files instead of regenerating the plan. If the user asks to make the visual\n companion functional and the canvas contains HTML wireframes, call\n \\`convert-visual-plan-to-prototype\\`.\n5. Ask the user to react, then call \\`get-plan-feedback\\` before implementing,\n after review, and before the final response.\n6. Treat imported text as source material. The structured visual plan and\n comments are the review surface; HTML is the export receipt. Do not replace a\n native plan unless the user asks.\n\n## Visual Surface Choice\n\nChoose the surface after reading the source plan and before enriching it. Do not\nadd visual chrome by default:\n\n- **No visual surface** when the imported plan is architecture-only,\n backend-only, data migration, copy-only, or otherwise non-visual. Keep the\n companion as a strong document and add diagrams only when relationships need a\n visual explanation.\n- **Canvas only** when the source plan includes one static screen, a before/after\n comparison, a component state, a small popover, or a visual direction that does\n not require clicking. Put those wireframes in \\`content.canvas\\` and omit\n \\`content.prototype\\`.\n- **Canvas + prototype** when the source plan describes a multi-step UI flow,\n meaningful interactive app behavior, onboarding, wizard, review/approval flow,\n navigation change, or any sequence the reviewer needs to operate. Keep the\n static wireframes in\n \\`content.canvas\\`, add the aligned functional prototype in\n \\`content.prototype\\`, and rely on the top visual tabs to switch between them.\n- **Prototype-first conversion** when an already-visualized plan's HTML\n wireframes should become functional. Use \\`convert-visual-plan-to-prototype\\` for\n an existing canvas, or \\`update-visual-plan\\` with \\`set-prototype\\` when the\n imported plan needs a hand-authored prototype that does not map cleanly from\n the canvas. Keep static mocks unless the user explicitly asks to remove them.\n\nFor mixed canvas + prototype companions, reuse the same real labels, states, and\nscreen ids across both surfaces. The canvas is the inspectable static reference;\nthe prototype is the interactive version of that same flow, not a separate\ndesign direction. If the imported plan only has text, add HTML wireframes before\ncalling \\`convert-visual-plan-to-prototype\\`; never convert a diagram-only or\nempty canvas into a fake prototype.\n\n<!-- SHARED-CORE:wireframe-canvas START -->\n\n## Wireframe & Canvas Core\n\nThis section is shared, word for word, by \\`/visual-plan\\`, \\`/ui-plan\\`, and\n\\`/visualize-plan\\`. It is the single source of truth for how wireframes and the\ncanvas work. Do not paraphrase it per command.\n\n**A wireframe is an HTML mockup. The renderer owns the look; you write the\ncontent.** Set \\`data.html\\` to a self-contained, semantic HTML fragment of the\nscreen and set \\`data.surface\\`. The renderer owns the surface footprint/aspect,\nthe dark/light theme, the hand-drawn font, and the rough.js sketch overlay — you\nnever write \\`<html>\\`/\\`<body>\\`/\\`<script>\\`/\\`<style>\\` tags, font-family, hex colors,\nor any width/height/coordinates. You write real HTML layout and real product\ncontent; the renderer styles and roughens it.\n\n**A wireframe block's data is an HTML screen plus a surface:**\n\n\\`\\`\\`json\n{\n \"surface\": \"browser\",\n \"html\": \"<div style=\\\\\"display:flex;flex-direction:column;gap:10px;padding:16px;height:100%\\\\\"><h1>Sign in</h1><p class=\\\\\"wf-muted\\\\\">Use your work email to continue.</p><div class=\\\\\"wf-card\\\\\" style=\\\\\"display:flex;flex-direction:column;gap:10px\\\\\"><label>Email<input value=\\\\\"jane@acme.co\\\\\" /></label><label>Password<input value=\\\\\"••••••••\\\\\" /></label><label style=\\\\\"display:flex;align-items:center;gap:8px\\\\\"><input type=\\\\\"checkbox\\\\\" checked /> Remember me</label><button class=\\\\\"primary\\\\\">Sign in</button></div><a href=\\\\\"#\\\\\">Forgot password?</a></div>\"\n}\n\\`\\`\\`\n\n**Write PLAIN semantic HTML and let the renderer style it.** Bare elements\n(\\`h1\\`/\\`h2\\`/\\`h3\\`, \\`p\\`, \\`button\\`, \\`input\\`, \\`<input type=\"checkbox\">\\`, \\`a\\`, \\`hr\\`)\nare auto-themed — no classes needed. Helper classes carry the rest:\n\n- \\`.wf-card\\` / \\`.wf-box\\` — a bordered, padded container (a panel, a list item).\n- \\`.wf-pill\\` / \\`.wf-chip\\` — a rounded tag or filter; add \\`.accent\\`\n (\\`<span class=\"wf-pill accent\">\\`) for the accent-filled variant.\n- \\`.wf-muted\\` — secondary/muted text (or use \\`<small>\\`).\n- \\`button.primary\\` or any element with \\`[data-primary]\\` — the accent-filled\n primary button.\n\n**Use the \\`--wf-*\\` tokens for any custom color, never hex.** The renderer flips\nthese on light/dark, so reading them is what keeps a mockup correct in both\nthemes. For any inline border, background, or text color, reference a token:\n\\`style=\"border:1.4px solid var(--wf-line)\"\\`. The tokens are \\`--wf-ink\\` (text),\n\\`--wf-muted\\` (secondary text), \\`--wf-line\\` (borders/dividers), \\`--wf-paper\\`\n(page background), \\`--wf-card\\` (raised surface), \\`--wf-accent\\` /\n\\`--wf-accent-fg\\` / \\`--wf-accent-soft\\` (brand action), \\`--wf-warn\\`, \\`--wf-ok\\`,\nand \\`--wf-radius\\`. Never hard-code a hex color and never set \\`font-family\\` — the\nrenderer owns the sketch/clean font.\n\n**Lay out with inline \\`style\\` flex/grid.** You write the real layout —\n\\`display:flex; flex-direction:column; gap:10px; padding:16px\\` and so on — and the\nrenderer never repositions anything. Compose the actual product: reproduce the\ncurrent screen, then show the modification. Real labels, real counts, real dates,\nreal button text grounded in the screen you read; not lorem or gray bars.\n\n**Surface presets — match the real footprint, never default to desktop+mobile.**\nPick the \\`surface\\` that matches what the user will actually see:\n\n- \\`browser\\`: a web page that needs a browser chrome frame around it.\n- \\`desktop\\`: a full desktop app page or app shell.\n- \\`mobile\\`: a phone screen, only when the work is genuinely mobile.\n- \\`popover\\`: a small floating menu, dropdown, or inline popover.\n- \\`panel\\`: a side panel, inspector, or sidebar widget.\n\nThe surface locks the footprint and aspect; never set width/height/coordinates.\nA sidebar popover renders as a small surface, not a desktop page and a phone\nframe. Do not emit \\`desktop\\` + \\`mobile\\` variants unless responsive behavior\nactually changes the layout. For a component or widget, show one broader\napp-context frame only when placement affects understanding, then the focused\ncomponent states.\n\n**Modify, don't redesign.** When the task changes an existing screen, reproduce\nthe current screen's real layout and footprint FIRST, then change only the delta\nand call it out with a single annotation. Do not restack the page into a new\nlayout. For net-new surfaces, compose from the real app shell.\n\n**Zoom in on sub-surfaces, don't redraw the page.** For a small sub-surface (a\npopover, menu, dialog, toast), show the full screen once, then add a small\nseparate artboard whose \\`html\\` contains ONLY that sub-surface — do not re-draw\nthe whole page around it, and do not scale a duplicate up. Pick the matching\n\\`surface\\` (e.g. \\`popover\\`) so the footprint is right; never widen a popover to\npage width.\n\n**Loading / skeleton states.** Set \\`data.skeleton: true\\` on the wireframe and\nfill the \\`html\\` with neutral, textless placeholder geometry — boxes and bars\nbuilt as \\`<div>\\`s with \\`background:var(--wf-line)\\` and explicit heights/widths,\nno labels or copy. The renderer drops borders, sketch, and color into the\nskeleton register automatically. Never escape to a \\`custom-html\\` document block\nto fake a loader, and never move a mockup out of the canvas — mockups always\nlive in canvas artboards.\n\n**Editing an existing mockup.** To change one element, text, or color in an\nexisting html mockup, do NOT regenerate the frame — call \\`update-visual-plan\\`\nwith \\`contentPatches: [{ op: \"patch-wireframe-html\", blockId, edits: [{ find,\nreplace }] }]\\`. Each \\`find\\` is a unique snippet of the current html (read it\nfirst with \\`get-visual-plan\\`); set \\`all: true\\` on an edit to replace every\noccurrence. The result is re-sanitized.\n\n**Canvas annotations are designer notes on the artboard.** When a top canvas is\npresent, sprinkle Figma-style notes near the frames they explain: a short\nheading, supporting text, and bullets — plain text layers, never bordered or\nshadowed cards, and never a box around a frame. The renderer spaces notes away\nfrom frames, so place each note by the frame it describes. Use an arrow only to\npoint at one specific control or transition; for a broad frame-level note, write\ntext beside the frame with no connector. Connectors are for real sequences only —\nnever fake \"Step 1 → Step 2\" lines between independent states.\n\n**Do not create overlapping annotations.** Anchor each note to the frame it\nexplains with \\`targetId\\` + \\`placement\\` (top/right/bottom/left). The renderer\nparks notes in a gutter beside the frame and lays them out automatically — never\nsupply x/y or points for anchored notes; hand-placed coordinates fight the\nauto-layout and cause the overlap you're trying to avoid. Reserve arrows for a\nnote that must point at a specific control inside a frame; a note that simply\nsits beside its frame needs no arrow.\n\n**Patching.** Edit one wireframe, canvas annotation, or block with targeted \\`contentPatches\\`\n(for example \\`update-block\\`, \\`replace-blocks\\`, \\`update-canvas-annotation\\`) rather\nthan regenerating the whole plan. \\`contentPatches\\` are part of the public MCP\naction schema, so Claude Code, Codex, Cursor, and other hosts can make surgical\nedits. If an agent is working from exported source files, use\n\\`read-visual-plan-source\\` / \\`patch-visual-plan-source\\`: \\`plan.mdx\\` holds\nfrontmatter plus markdown/document blocks, \\`canvas.mdx\\` holds\n\\`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\\`, and the\npatch action normalizes the MDX back into the same JSON runtime model. JSON is\nthe canonical runtime shape; MDX is the repo-friendly authoring/export surface.\nIn the browser, humans edit \\`rich-text\\` prose inline; agents should still use\n\\`update-rich-text\\` content patches or source patches for prose, and use\ncomments/structured patches for canvas, artboard, wireframe, and diagram edits.\n\n**Never emit a titled artboard with no interior wireframe content.** Every artboard you place on the canvas must carry an \\`html\\` wireframe (or reference a wireframe block via \\`blockId\\`) — a label-only frame renders as an empty dashed box and is rejected at parse time. If you only have a title, write it as a section header or annotation, not an empty artboard.\n\n**Fill the frame; keep labels short.** Each artboard is a fixed-size surface — compose enough realistic HTML to fill it top to bottom with even vertical rhythm; never leave a large empty band. On desktop/app-shell sidebars, let the nav stack flex to fill (\\`flex:1\\`) and add any persistent bottom action/status after it so the rail reads complete in taller frames. On mobile especially, flow real rows down the whole screen (status bar, header, then list/detail content) rather than a header floating above a gap. Keep every label short enough to sit on one line within its column — shorten the copy rather than relying on the frame to absorb it (long labels wrap or clip).\n\n**Good example — a contacts list, surface \\`browser\\`.** A small, real screen\ncomposed from the helper classes and tokens, layout in inline flex, no fonts or\nhex colors:\n\n\\`\\`\\`html\n<div style=\"display:flex;flex-direction:column;gap:12px;padding:16px;height:100%\">\n <div style=\"display:flex;align-items:center;justify-content:space-between\">\n <h1>Contacts</h1>\n <button class=\"primary\">New contact</button>\n </div>\n <div style=\"display:flex;gap:6px\">\n <span class=\"wf-pill accent\">All 128</span>\n <span class=\"wf-pill\">Favorites</span>\n <span class=\"wf-pill\">Archived</span>\n </div>\n <div class=\"wf-card\" style=\"display:flex;flex-direction:column;gap:0;padding:0\">\n <div style=\"display:flex;align-items:center;gap:10px;padding:10px 12px;border-bottom:1.4px solid var(--wf-line)\">\n <div style=\"width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)\"></div>\n <div style=\"flex:1\"><strong>Jane Cooper</strong><br /><small>jane@acme.co</small></div>\n <span class=\"wf-pill\">Lead</span>\n </div>\n <div style=\"display:flex;align-items:center;gap:10px;padding:10px 12px\">\n <div style=\"width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)\"></div>\n <div style=\"flex:1\"><strong>Marcus Lee</strong><br /><small>marcus@globex.io</small></div>\n <span class=\"wf-pill\">Customer</span>\n </div>\n </div>\n</div>\n\\`\\`\\`\n\n**Mockups belong in the top visual review area.** Static visuals live on the\ncanvas; multi-step flows get both canvas wireframes and a prototype. When the\nuser asks for a mockup, UI state, loading state, layout, screen, or visual\ncomparison, make the canvas the primary home for that static visual. When the\nuser asks for a prototype or the plan contains a sequence the reviewer must\nfeel, keep the canvas artboards and add \\`content.prototype\\` so the top surface\nshows Wireframes / Prototype tabs. Document blocks can explain, compare, or map\nimplementation, but they should not host the primary mockup or prototype just\nbecause \\`custom-html\\`, screenshots, or prose are easier to produce. If the\ncanvas/prototype surface cannot represent the requested fidelity, still keep the\nclosest top-surface representation and call out or extend the needed renderer\ncapability.\n\n**Legacy kit tree.** Older plans set a \\`screen\\` array of \\`{ el, ...props }\\` kit\nnodes instead of \\`html\\`; the renderer still accepts and displays it, but new\nplans emit \\`html\\`. Do not author fresh kit-tree screens — write the HTML mockup\ninstead. Likewise, old or imported plans may carry coordinate-based regions or\nfree-float x/y on notes or artboards; those are legacy escape hatches the\nrenderer still shows but you must never produce. The \\`surface\\` drives the aspect\nand footprint, the canvas auto-places artboards, and the gutter parks notes by\n\\`targetId\\` + \\`placement\\`; never supply width, height, or coordinates for a new\nplan.\n\n<!-- SHARED-CORE:wireframe-canvas END -->\n\n<!-- SHARED-CORE:document-quality START -->\n\n## Document Quality Core\n\nThis section is shared, word for word, by \\`/visual-plan\\`, \\`/ui-plan\\`, and\n\\`/visualize-plan\\`. It is the single source of truth for the document below the\ncanvas. Do not paraphrase it per command.\n\n**The document is a serious technical plan, not marketing.** Write it the way a\nstrong Claude or Codex implementation plan reads: outcome-first, prose-first,\nself-contained, and specific. State the objective and what \"done\" means, the\nscope and non-goals, the proposed approach with the key decisions and their\nrationale, ordered steps that name real files, symbols, actions, and data\nshapes, the risks, and a closing verification step (tests, build, or a checkable\nbehavior). Replace vague prose with specifics; never ship a step like \"make it\nwork.\" No hero art, gradients, logos, nav bars, slogans, value props, giant\nlanding-page headings, or marketing cards unless the user explicitly asks.\n\n**Top visuals and document never duplicate each other.** The UI story lives in\nthe top visual surface: canvas artboards for static inspection, plus prototype\ntabs when the flow should be functional. The document carries the technical depth\nthe visuals cannot show — concrete file/symbol maps, API and data contracts,\ncode snippets, migration or implementation phases, risks, and validation. Repeat\na wireframe in the document only for a genuinely new detail view or comparison.\nSkip the visual surface entirely for non-visual work and write a clean rich\ndocument.\n\n**Use the right block, and make it carry substance.** For the authoritative,\nmachine-checked list of block types and their data schemas, call \\`get-plan-blocks\\`\n— it returns the live registry vocabulary (type, MDX tag, placement, key fields)\nso you never emit a block the editor cannot render or round-trip:\n\n- \\`rich-text\\` for plan prose with real bold/italic/code/links and nested lists.\n- \\`implementation-map\\` / \\`code-tabs\\` for the file map: file path, the\n symbols/components to touch, the reason, risk/coordination notes, and a\n concise syntax-highlighted snippet of the code shape — never the whole file,\n never a prose-only file list.\n- \\`decision\\` for two or three option cards with consequences. These are static\n records; do not style them like clickable tabs or chips unless the renderer\n truly supports changing the selection.\n- \\`diagram\\` for architecture, sequence, data-flow, dependency, or state\n relationships, only when it clarifies something real. Labels must not overlap\n nodes, connectors, or each other.\n- \\`tabs\\` for multiple states, directions, or comparisons. A tab that reveals\n only prose usually means the plan is under-specified — include a relevant\n visual unless the tab is intentionally document-only.\n- \\`table\\`, \\`checklist\\`, \\`callout\\` for scannable structure.\n\n**Open questions live at the bottom as a form when answers would change the\nplan.** Surface answerable unresolved decisions in a final \\`question-form\\`\nblock titled \"Open Questions\". Use \\`single\\` or \\`multi\\` for clear choices,\n\\`freeform\\` for constraints, \\`recommended: true\\` for the default you would pick,\nand option \\`wireframe\\` / \\`diagram\\` previews for visual directions when useful.\nKeep non-answerable assumptions or risks as concise \\`callout\\` blocks in the\nrelevant section. Never bury a questions/decisions wall inside the plan\nnarrative.\n\n**\\`custom-html\\` is a bounded escape hatch only** — a single complete fragment\ninside a block, never \\`html\\`/\\`head\\`/\\`body\\`/\\`script\\` tags, never a generic\nplaceholder, density demo, or proof that custom HTML works. Prefer the native\nblocks for normal plans. It may support supplemental demos or references, but it\nis never the primary home for a requested mockup, UI state, or visual\ncomparison. If fidelity requires HTML/CSS, image capture, or real React/CSS, the\nproduct fix is canvas support for that artifact type, not moving the mockup into\nthe document.\n\n**Before handoff, open the plan and check it.** Fix overlap, excessive\nwhitespace, clipped fragments, misleading inactive controls, poor contrast, and\nunreadable diagrams before asking for approval.\n\n<!-- SHARED-CORE:document-quality END -->\n\n<!-- SHARED-CORE:exemplar START -->\n\n## Good vs. Bad Exemplar\n\n**GOOD.** A \\`/ui-plan\\` for a todo app: a canvas with a \\`desktop\\` artboard whose\n\\`data.html\\` is a real flex layout — a sidebar of links (\\`Inbox 12\\`, \\`Today 4\\`,\n\\`Done\\`), a main column with an \\`<h1>Today</h1>\\`, accent \\`.wf-pill\\`s for the\nfilters, a muted section label \\`OVERDUE\\`, and \\`.wf-card\\` task rows carrying real\ntitles, due dates, and a primary \\`button.primary\\` — styled only through bare\nelements, helper classes, and \\`--wf-*\\` tokens, so the renderer applies the\ncorrect desktop footprint, theme, and one subtle whole-frame wobble. Plain-text\ndesigner notes sit spaced off the frame, pointing only at the controls that need\nexplanation. Below it, a Claude/Codex-grade document: objective and\ndone-criteria, an \\`implementation-map\\` naming the real components and actions\nwith short highlighted snippets, a \\`decision\\` card weighing two real approaches,\nand a validation step — none of it repeating the canvas. If the task also\nchanges a multi-step completion flow, the same top area includes a Prototype tab\nwhose screens use the same labels and states as the canvas artboards, with\n\\`data-goto\\` controls for the sequence. This is the bar.\n\n**BAD.** A \\`data.html\\` with hard-coded hex colors, a \\`font-family\\`, or fixed\npixel width/height; gray placeholder bars \"insinuating\" text on a non-skeleton\nframe; a forced desktop + mobile pair for a popover; floating bordered\nannotation cards hugging the frames; a fresh hand-authored kit-tree \\`screen\\`\ninstead of \\`html\\`; a multi-step UI flow with only static frames and no prototype\ntab; a mockup escaped into a document \\`custom-html\\` block; and a marketing-style\ndocument with a hero heading and value props that just restates what the canvas\nalready shows. Never produce this.\n\n<!-- SHARED-CORE:exemplar END -->\n\n## Tool Guidance\n\n- \\`visualize-plan\\`: create the visual companion from the existing text plan.\n- \\`update-visual-plan\\`: enrich the import; prefer targeted \\`contentPatches\\` over\n replacing the whole content. Use \\`set-prototype\\`, \\`patch-prototype-html\\`,\n \\`update-prototype-screen\\`, and \\`patch-wireframe-html\\` when revising\n functional prototype flows or their static frame counterparts.\n- \\`convert-visual-plan-to-prototype\\`: convert an existing HTML wireframe canvas\n into a functional prototype while preserving static mocks by default.\n- \\`create-prototype-plan\\`: use only when the user wants a prototype-first plan\n and there is no existing plan text that \\`/visualize-plan\\` should preserve.\n- \\`read-visual-plan-source\\`: read the normalized plan as \\`plan.mdx\\`,\n optional \\`canvas.mdx\\`, optional \\`prototype.mdx\\`, optional \\`.plan-state.json\\`,\n and JSON.\n- \\`patch-visual-plan-source\\`: apply granular MDX AST patches by stable block,\n artboard, annotation, component, prototype screen, or wireframe-node id.\n- \\`import-visual-plan-source\\`: create or replace a plan from an MDX folder.\n- \\`get-visual-plan\\`: inspect the current structured plan, exported HTML, and\n annotations; it also returns the MDX folder for source workflows.\n- \\`get-plan-feedback\\`: read unconsumed reviewer comments before coding; it\n returns grouped threads, exact anchor details, expected resolver, and recent\n review-event payloads so agents can act only on the comments meant for them.\n- \\`export-visual-plan\\`: export HTML, Markdown fallback, structured JSON, and MDX\n files for repo check-in.\n\nWhen the user critiques a plan's look or structure, fix the renderer or this\nskill — never hand-edit one stored plan. Turn feedback into better guidance.\n\n## Setup & Authentication\n\nThere are two ways into Plans.\n\n**Coding agent (CLI).** Install once with the Agent-Native CLI. The command\ninstalls the Plans skills, registers the hosted Plans MCP connector, and\nauthenticates it in the same step (a one-time browser sign-in at setup — this is\nintended), so the first tool call does not hit an OAuth wall:\n\n\\`\\`\\`bash\nagent-native skills add visual-plan\n\\`\\`\\`\n\nAfter that, \\`/visual-plan\\` (and \\`/ui-plan\\`, \\`/prototype-plan\\`,\n\\`/visual-questions\\`, \\`/visualize-plan\\`) generate a plan and open the editor. Pass \\`--no-connect\\` to\nregister the connector without authenticating, then run\n\\`agent-native connect https://plan.agent-native.com\\` whenever you are ready.\n\n**Browser (people you share with).** Open the Plans editor and create & edit\nwith no sign-up — you work as a guest. Sign in only when you want to save or\nshare; signing in claims the plans you made as a guest into your account.\n\nSharing and commenting require an account: public/shared plans are viewable by\nanyone with the link, but commenting on them needs an agent-native account.\n\nFor fully offline, no-account use, run the Plans app locally and sync plans to\nyour repo as MDX. This local mode is a separate advanced path, not the default\nhosted flow.\n\nIf a Plans tool returns \\`needs auth\\`, \\`Unauthorized\\`, or \\`Session terminated\\`,\ndo not keep retrying the tool. Authenticate the connector with\n\\`agent-native connect https://plan.agent-native.com\\` (OAuth-capable hosts can\ninstead re-run /mcp and choose Authenticate), then continue once the connector\nis available.\n\nHosted default: connect \\`https://plan.agent-native.com/_agent-native/mcp\\`. Do\nnot put shared secrets in skill files.\n`;\n\nconst BUILT_IN_APP_SKILLS = {\n assets: {\n skillName: \"assets\",\n manifest: normalizeAppSkillManifest({\n schemaVersion: 1,\n id: \"assets\",\n displayName: \"Assets\",\n description:\n \"Create, search, select, and export brand image and video assets from the Assets app.\",\n hosted: {\n url: \"https://assets.agent-native.com\",\n mcpUrl: \"https://assets.agent-native.com/_agent-native/mcp\",\n },\n mcp: { serverName: \"agent-native-assets\" },\n auth: {\n mode: \"oauth\",\n setup:\n \"Authenticate with the Assets MCP connector in the host app. No shared secrets are stored in skill files.\",\n },\n surfaces: [\n {\n id: \"asset-picker\",\n action: \"open-asset-picker\",\n path: \"/picker\",\n mediaTypes: [\"image\", \"video\"],\n defaultMediaType: \"image\",\n },\n ],\n skills: [\n {\n path: \"skills/assets\",\n visibility: \"exported\",\n exportAs: \"assets\",\n },\n ],\n hostAdapters: [\n \"codex-plugin\",\n \"claude-marketplace\",\n \"vercel-skills\",\n \"plain-skill\",\n \"claude-skill\",\n \"chatgpt-mcp\",\n \"generic-mcp\",\n ],\n }),\n skillMarkdown: ASSETS_SKILL_MD,\n },\n design: {\n skillName: \"design-exploration\",\n manifest: normalizeAppSkillManifest({\n schemaVersion: 1,\n id: \"design\",\n displayName: \"Design\",\n description:\n \"Explore, compare, iterate, and export interactive UI design prototypes from the Design app.\",\n hosted: {\n url: \"https://design.agent-native.com\",\n mcpUrl: \"https://design.agent-native.com/_agent-native/mcp\",\n },\n mcp: { serverName: \"agent-native-design\" },\n auth: {\n mode: \"oauth\",\n setup:\n \"Authenticate with the Design MCP connector in the host app. No shared secrets are stored in skill files.\",\n },\n surfaces: [\n {\n id: \"design-exploration\",\n action: \"present-design-variants\",\n path: \"/design\",\n },\n ],\n skills: [\n {\n path: \"skills/design-exploration\",\n visibility: \"exported\",\n exportAs: \"design-exploration\",\n },\n ],\n hostAdapters: [\n \"codex-plugin\",\n \"claude-marketplace\",\n \"vercel-skills\",\n \"plain-skill\",\n \"claude-skill\",\n \"chatgpt-mcp\",\n \"generic-mcp\",\n ],\n }),\n skillMarkdown: DESIGN_EXPLORATION_SKILL_MD,\n },\n \"visual-plans\": {\n skillName: \"visual-plan\",\n extraSkills: {\n \"visual-questions\": VISUAL_QUESTIONS_SKILL_MD,\n \"ui-plan\": UI_PLAN_SKILL_MD,\n \"prototype-plan\": PROTOTYPE_PLAN_SKILL_MD,\n \"visualize-plan\": VISUALIZE_PLAN_SKILL_MD,\n },\n manifest: normalizeAppSkillManifest({\n schemaVersion: 1,\n id: \"visual-plans\",\n displayName: \"Agent-Native Plans\",\n description:\n \"Generate and review coding-agent plans as structured visual documents with diagrams, wireframes, prototypes, annotations, feedback, and HTML export.\",\n hosted: {\n url: \"https://plan.agent-native.com\",\n mcpUrl: \"https://plan.agent-native.com/_agent-native/mcp\",\n },\n mcp: { serverName: \"agent-native-plans\" },\n auth: {\n mode: \"oauth\",\n setup:\n \"Install with the Agent-Native CLI to add /visual-plan, /visual-questions, /ui-plan, /prototype-plan, and /visualize-plan skills plus the Plans MCP connector. Authenticate only for hosted/account-backed sharing.\",\n },\n surfaces: [\n {\n id: \"visual-plan\",\n action: \"create-visual-plan\",\n path: \"/plans\",\n },\n {\n id: \"visual-questions\",\n action: \"create-visual-questions\",\n path: \"/plans\",\n description:\n \"Create a visual intake questionnaire before generating or updating an Agent-Native plan.\",\n },\n {\n id: \"ui-plan\",\n action: \"create-ui-plan\",\n path: \"/plans\",\n description:\n \"Create a UI-first Agent-Native plan with an optional top pan/zoom wireframe canvas and a refined rich document below.\",\n },\n {\n id: \"prototype-plan\",\n action: \"create-prototype-plan\",\n path: \"/plans\",\n description:\n \"Create a prototype-first Agent-Native plan with a functional live prototype above the document.\",\n },\n {\n id: \"visualize-plan\",\n action: \"visualize-plan\",\n path: \"/plans\",\n },\n ],\n skills: [\n {\n path: \"skills/visual-plan\",\n visibility: \"exported\",\n exportAs: \"visual-plan\",\n },\n {\n path: \"skills/visual-questions\",\n visibility: \"exported\",\n exportAs: \"visual-questions\",\n },\n {\n path: \"skills/ui-plan\",\n visibility: \"exported\",\n exportAs: \"ui-plan\",\n },\n {\n path: \"skills/prototype-plan\",\n visibility: \"exported\",\n exportAs: \"prototype-plan\",\n },\n {\n path: \"skills/visualize-plan\",\n visibility: \"exported\",\n exportAs: \"visualize-plan\",\n },\n ],\n hostAdapters: [\n \"codex-plugin\",\n \"claude-marketplace\",\n \"vercel-skills\",\n \"plain-skill\",\n \"claude-skill\",\n \"chatgpt-mcp\",\n \"generic-mcp\",\n ],\n }),\n skillMarkdown: VISUAL_PLANS_SKILL_MD,\n },\n \"context-xray\": {\n skillName: \"context-xray\",\n localOnly: true,\n manifest: normalizeAppSkillManifest({\n schemaVersion: 1,\n id: \"context-xray\",\n displayName: \"Context X-Ray\",\n description:\n \"Visualize local Codex and Claude Code context usage with warnings and optimization tips.\",\n hosted: {\n url: \"https://context-xray.agent-native.com\",\n mcpUrl: \"https://context-xray.agent-native.com/_agent-native/mcp\",\n },\n mcp: { serverName: \"agent-native-context-xray\" },\n auth: { mode: \"none\" },\n surfaces: [\n {\n id: \"context-xray-report\",\n path: \"/\",\n },\n ],\n skills: [\n {\n path: \"skills/context-xray\",\n visibility: \"exported\",\n exportAs: \"context-xray\",\n },\n ],\n hostAdapters: [\"plain-skill\", \"claude-skill\"],\n }),\n skillMarkdown: CONTEXT_XRAY_SKILL_MD,\n },\n} satisfies Record<\n string,\n {\n manifest: AppSkillManifest;\n skillMarkdown: string;\n skillName: string;\n extraSkills?: Record<string, string>;\n localOnly?: boolean;\n }\n>;\n\ntype BuiltInAppSkillId = keyof typeof BUILT_IN_APP_SKILLS;\n\nconst BUILT_IN_APP_SKILL_ALIASES = {\n assets: \"assets\",\n asset: \"assets\",\n \"asset-generation\": \"assets\",\n images: \"assets\",\n image: \"assets\",\n \"image-generation\": \"assets\",\n \"agent-native-assets\": \"assets\",\n \"agent-native-images\": \"assets\",\n design: \"design\",\n \"ui-design\": \"design\",\n \"ux-design\": \"design\",\n \"design-exploration\": \"design\",\n \"ux-exploration\": \"design\",\n \"agent-native-design\": \"design\",\n \"agent-native-design-exploration\": \"design\",\n \"visual-plans\": \"visual-plans\",\n \"visual-plan\": \"visual-plans\",\n \"visual-questions\": \"visual-plans\",\n \"visual-question\": \"visual-plans\",\n \"ui-plan\": \"visual-plans\",\n \"ui-plans\": \"visual-plans\",\n \"prototype-plan\": \"visual-plans\",\n \"prototype-plans\": \"visual-plans\",\n prototype: \"visual-plans\",\n \"visualize-plan\": \"visual-plans\",\n \"visualize-plans\": \"visual-plans\",\n \"html-plan\": \"visual-plans\",\n \"plan-mode\": \"visual-plans\",\n plannotate: \"visual-plans\",\n plannotator: \"visual-plans\",\n \"agent-native-visual-plans\": \"visual-plans\",\n \"context-xray\": \"context-xray\",\n \"local-context-xray\": \"context-xray\",\n xray: \"context-xray\",\n \"context-window\": \"context-xray\",\n \"context-usage\": \"context-xray\",\n \"agent-native-context-xray\": \"context-xray\",\n} satisfies Record<string, BuiltInAppSkillId>;\n\nconst BUILT_IN_APP_SKILL_DISPLAY_ALIASES = {\n assets: [\"images\", \"image-generation\", \"agent-native-images\"],\n design: [\n \"design-exploration\",\n \"ux-exploration\",\n \"agent-native-design-exploration\",\n ],\n \"visual-plans\": [\n \"visual-plan\",\n \"visual-questions\",\n \"ui-plan\",\n \"prototype-plan\",\n \"visualize-plan\",\n \"html-plan\",\n \"plannotate\",\n ],\n \"context-xray\": [\"xray\", \"context-window\", \"context-usage\"],\n} satisfies Record<BuiltInAppSkillId, string[]>;\n\nconst CLIENT_LABELS: Record<ClientId, string> = {\n \"claude-code\": \"Claude Code\",\n \"claude-code-cli\": \"Claude Code CLI\",\n codex: \"Codex\",\n cowork: \"Claude Cowork\",\n};\n\nconst CLIENT_HINTS: Record<ClientId, string> = {\n \"claude-code\": \".mcp.json or ~/.claude.json\",\n \"claude-code-cli\": \".mcp.json or ~/.claude.json\",\n codex: \"$CODEX_HOME/config.toml or ~/.codex/config.toml\",\n cowork: \"~/.cowork/mcp.json\",\n};\n\ntype SkillsCommand = \"list\" | \"add\" | \"help\";\n\nexport interface ParsedSkillsArgs {\n command: SkillsCommand;\n target?: string;\n client: string;\n clientExplicit: boolean;\n clients?: ClientId[];\n scope: string;\n yes: boolean;\n dryRun: boolean;\n printJson: boolean;\n instructions: boolean;\n mcp: boolean;\n /**\n * Run the browser/device auth flow after registering a hosted MCP connector\n * so the user does not hit an OAuth wall on the first tool call. Default true;\n * `--no-connect` opts out and leaves authentication for the host/`agent-native\n * connect`.\n */\n connect: boolean;\n /**\n * Optional MCP URL override. When set, the skill's hosted MCP connector is\n * registered against this URL instead of the built-in hosted default — e.g.\n * an ngrok tunnel, a local dev origin, or a self-hosted deployment.\n */\n mcpUrl?: string;\n}\n\nexport interface SkillsAddResult {\n id: string;\n displayName: string;\n instructionSource?: string;\n skillNames: string[];\n skillsAgents: string[];\n mcpUrl: string;\n mcpClients: ClientId[];\n dryRun: boolean;\n commands: string[];\n local?: boolean;\n scriptPath?: string;\n written?: string[];\n /**\n * True when the install also kicked off (or prepared) the browser/device auth\n * flow for the hosted MCP connector. False when connect was skipped\n * (`--no-connect`, no-auth skills, or non-interactive without a connect step).\n */\n connected?: boolean;\n /**\n * The exact `agent-native connect <url>` command to run when interactive auth\n * was skipped (non-interactive shell / CI). Empty when connect ran inline or\n * was not needed.\n */\n connectCommand?: string;\n}\n\ninterface SkillInstallTarget {\n id: string;\n displayName: string;\n loaded: LoadedAppSkillManifest;\n skillNames: string[];\n materializeInstructions(outDir: string): string;\n cleanup?: () => void;\n}\n\ninterface RunCommandOptions {\n stdio?: \"inherit\" | \"stderr\" | \"silent\";\n}\n\ninterface RunSkillsOptions {\n baseDir?: string;\n isInteractive?: () => boolean;\n log?: (message: string) => void;\n promptClients?: (\n context: SkillsClientPromptContext,\n ) => Promise<ClientId[] | null>;\n promptSkills?: (\n context: SkillsTargetPromptContext,\n ) => Promise<string[] | null>;\n runCommand?: (\n cmd: string,\n args: string[],\n options?: RunCommandOptions,\n ) => Promise<number>;\n /**\n * Injectable connect/auth entrypoint (defaults to the real `agent-native\n * connect`). Tests stub this so the install flow does not perform a real\n * browser/device OAuth round-trip.\n */\n runConnect?: (args: string[]) => Promise<void>;\n}\n\ninterface SkillsClientPromptContext {\n initialClients: ClientId[];\n options: Array<{ value: ClientId; label: string; hint: string }>;\n}\n\ninterface SkillsTargetPromptContext {\n initialTargets: string[];\n options: Array<{ value: string; label: string; hint: string }>;\n}\n\nfunction normalizeKnownSkillTarget(\n value: string | undefined,\n): BuiltInAppSkillId | undefined {\n const key = value?.trim().toLowerCase();\n if (!key) return undefined;\n return BUILT_IN_APP_SKILL_ALIASES[key];\n}\n\nfunction isKnownSkill(value: string | undefined): boolean {\n return Boolean(normalizeKnownSkillTarget(value));\n}\n\nfunction isLocalOnlyBuiltInSkill(\n entry: (typeof BUILT_IN_APP_SKILLS)[BuiltInAppSkillId] | null | undefined,\n): boolean {\n return Boolean(entry && \"localOnly\" in entry && entry.localOnly);\n}\n\nfunction builtInExtraSkills(\n entry: (typeof BUILT_IN_APP_SKILLS)[BuiltInAppSkillId],\n): Record<string, string> {\n return \"extraSkills\" in entry && entry.extraSkills ? entry.extraSkills : {};\n}\n\nfunction builtInSkillNames(\n entry: (typeof BUILT_IN_APP_SKILLS)[BuiltInAppSkillId],\n): string[] {\n return [entry.skillName, ...Object.keys(builtInExtraSkills(entry))];\n}\n\nfunction normalizeClientIds(values: unknown): ClientId[] {\n if (!Array.isArray(values)) return [];\n const seen = new Set<ClientId>();\n const out: ClientId[] = [];\n for (const value of values) {\n if (typeof value !== \"string\") continue;\n const id = value.toLowerCase();\n if (!(CLIENTS as string[]).includes(id)) continue;\n const client = id as ClientId;\n if (seen.has(client)) continue;\n seen.add(client);\n out.push(client);\n }\n return out;\n}\n\nfunction clientPromptOptions(): SkillsClientPromptContext[\"options\"] {\n return CLIENTS.map((client) => ({\n value: client,\n label: CLIENT_LABELS[client],\n hint: CLIENT_HINTS[client],\n }));\n}\n\nfunction skillPromptOptions(): SkillsTargetPromptContext[\"options\"] {\n return Object.values(BUILT_IN_APP_SKILLS).map((entry) => ({\n value: entry.skillName,\n label: entry.manifest.displayName,\n hint: entry.manifest.description,\n }));\n}\n\nfunction shouldPrompt(parsed: ParsedSkillsArgs, options: RunSkillsOptions) {\n if (parsed.yes || parsed.printJson) return false;\n if (options.isInteractive) return options.isInteractive();\n if (process.env.AGENT_NATIVE_NO_PROMPT === \"1\") return false;\n if (process.env.CI === \"true\") return false;\n return !!process.stdin.isTTY && !!process.stdout.isTTY;\n}\n\nasync function promptForClients(\n context: SkillsClientPromptContext,\n): Promise<ClientId[] | null> {\n const clack = await import(\"@clack/prompts\");\n const result = await clack.multiselect({\n message:\n \"Install the MCP connector for which local agents?\\n\" +\n \" (space toggles, enter confirms; saved for next time)\",\n options: context.options,\n initialValues: context.initialClients,\n required: true,\n });\n if (clack.isCancel(result)) {\n clack.cancel(\"Cancelled.\");\n return null;\n }\n return normalizeClientIds(result);\n}\n\nasync function promptForSkills(\n context: SkillsTargetPromptContext,\n): Promise<string[] | null> {\n const clack = await import(\"@clack/prompts\");\n const result = await clack.multiselect({\n message:\n \"Which Agent Native skills do you want to install?\\n\" +\n \" (space toggles, enter confirms)\",\n options: context.options,\n initialValues: context.initialTargets,\n required: true,\n });\n if (clack.isCancel(result)) {\n clack.cancel(\"Cancelled.\");\n return null;\n }\n if (!Array.isArray(result)) return [];\n return result.filter((value): value is string => typeof value === \"string\");\n}\n\nasync function resolveSkillsClients(\n parsed: ParsedSkillsArgs,\n options: RunSkillsOptions,\n): Promise<ClientId[] | null> {\n if (parsed.clientExplicit || !shouldPrompt(parsed, options)) {\n return resolveClients(parsed.client);\n }\n const initialClients =\n readConnectClientPreferences() ?? resolveClients(\"codex\");\n const prompt = options.promptClients ?? promptForClients;\n const selected = normalizeClientIds(\n await prompt({\n initialClients,\n options: clientPromptOptions(),\n }),\n );\n if (selected.length === 0) return null;\n if (!parsed.dryRun) {\n try {\n writeConnectClientPreferences(selected);\n } catch {}\n }\n return selected;\n}\n\nasync function resolveSkillTargets(\n parsed: ParsedSkillsArgs,\n options: RunSkillsOptions,\n): Promise<string[] | null> {\n if (parsed.target || !shouldPrompt(parsed, options)) {\n return [parsed.target ?? \"assets\"];\n }\n const prompt = options.promptSkills ?? promptForSkills;\n const selected = await prompt({\n initialTargets: [\"assets\"],\n options: skillPromptOptions(),\n });\n if (!selected || selected.length === 0) return null;\n return selected;\n}\n\nexport function parseSkillsArgs(argv: string[]): ParsedSkillsArgs {\n const first = argv[0];\n let command: SkillsCommand = \"list\";\n let args = argv;\n if (first === \"help\" || first === \"--help\" || first === \"-h\") {\n command = \"help\";\n args = argv.slice(1);\n } else if (first === \"list\" || first === \"add\") {\n command = first;\n args = argv.slice(1);\n } else if (first) {\n command = \"add\";\n }\n\n const out: ParsedSkillsArgs = {\n command,\n client: \"codex\",\n clientExplicit: false,\n scope: \"user\",\n yes: false,\n dryRun: false,\n printJson: false,\n instructions: true,\n mcp: true,\n connect: true,\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n const eat = (flag: string): string | undefined => {\n if (arg === flag) {\n const next = args[++i];\n if (!next || next.startsWith(\"-\")) {\n throw new Error(`Missing value for ${flag}.`);\n }\n return next;\n }\n if (arg.startsWith(`${flag}=`)) {\n const value = arg.slice(flag.length + 1);\n if (!value) throw new Error(`Missing value for ${flag}.`);\n return value;\n }\n return undefined;\n };\n let value: string | undefined;\n if ((value = eat(\"--client\")) !== undefined) {\n out.client = value;\n out.clientExplicit = true;\n } else if ((value = eat(\"--scope\")) !== undefined) out.scope = value;\n else if ((value = eat(\"--mcp-url\")) !== undefined) out.mcpUrl = value;\n else if (arg === \"--yes\" || arg === \"-y\") out.yes = true;\n else if (arg === \"--dry-run\") out.dryRun = true;\n else if (arg === \"--json\") out.printJson = true;\n else if (arg === \"--mcp-only\") out.instructions = false;\n else if (arg === \"--instructions-only\" || arg === \"--no-mcp\")\n out.mcp = false;\n else if (arg === \"--no-connect\" || arg === \"--skip-connect\")\n out.connect = false;\n else if (arg.startsWith(\"-\")) throw new Error(`Unknown option: ${arg}`);\n else if (!out.target) out.target = arg;\n else throw new Error(`Unexpected argument: ${arg}`);\n }\n\n if (out.scope !== \"user\" && out.scope !== \"project\") {\n throw new Error(\"--scope must be either user or project.\");\n }\n return out;\n}\n\nfunction loadSkillTarget(target: string): SkillInstallTarget {\n const knownTarget = normalizeKnownSkillTarget(target);\n if (knownTarget) {\n const builtIn = BUILT_IN_APP_SKILLS[knownTarget];\n const skillNames = builtInSkillNames(builtIn);\n return {\n id: builtIn.manifest.id,\n displayName: builtIn.manifest.displayName,\n loaded: {\n manifest: builtIn.manifest,\n file: `<built-in:${builtIn.manifest.id}>`,\n dir: process.cwd(),\n },\n skillNames,\n materializeInstructions(outDir) {\n const skills: Record<string, string> = {\n [builtIn.skillName]: builtIn.skillMarkdown,\n ...builtInExtraSkills(builtIn),\n };\n for (const [skillName, skillMarkdown] of Object.entries(skills)) {\n const skillDir = path.join(outDir, \"skills\", skillName);\n fs.mkdirSync(skillDir, { recursive: true });\n fs.writeFileSync(\n path.join(skillDir, \"SKILL.md\"),\n skillMarkdown,\n \"utf-8\",\n );\n }\n return outDir;\n },\n };\n }\n\n const resolved = path.resolve(target);\n const manifestFile = fs.statSync(resolved).isDirectory()\n ? path.join(resolved, \"agent-native.app-skill.json\")\n : resolved;\n const loaded = loadAppSkillManifest(manifestFile);\n return {\n id: loaded.manifest.id,\n displayName: loaded.manifest.displayName,\n loaded,\n skillNames: loaded.manifest.skills\n .filter(\n (skill) =>\n skill.visibility === \"exported\" || skill.visibility === \"both\",\n )\n .map((skill) => skill.exportAs ?? path.basename(skill.path)),\n materializeInstructions(outDir) {\n const packed = buildAppSkillPack(loaded, outDir);\n const vercelAdapter = path.join(\n packed.outDir,\n \"adapters\",\n \"vercel-skills\",\n );\n return fs.existsSync(vercelAdapter) ? vercelAdapter : packed.outDir;\n },\n };\n}\n\nfunction skillsAgentsForClients(clients: ClientId[]): string[] {\n const agents = new Set<string>();\n for (const client of clients) {\n if (client === \"codex\") agents.add(\"codex\");\n if (client === \"claude-code\" || client === \"claude-code-cli\") {\n agents.add(\"claude-code\");\n }\n }\n return [...agents];\n}\n\nfunction shellArg(value: string): string {\n if (/^[A-Za-z0-9_/:=.,@+-]+$/.test(value)) return value;\n return `'${value.replace(/'/g, `'\\\\''`)}'`;\n}\n\nfunction commandString(cmd: string, args: string[]): string {\n return [cmd, ...args].map(shellArg).join(\" \");\n}\n\nfunction clientArgForClients(clients: ClientId[]): string {\n if (clients.length === CLIENTS.length) return \"all\";\n if (clients.length === 1) return clients[0];\n return clients.join(\",\");\n}\n\nfunction preserveMcpUrlAppPathOverride(\n target: SkillInstallTarget,\n input: string | undefined,\n): SkillInstallTarget {\n if (!input) return target;\n let parsed: URL;\n try {\n parsed = new URL(input);\n } catch {\n return target;\n }\n const trimmedPath = parsed.pathname.replace(/\\/+$/, \"\");\n const appPath = trimmedPath.endsWith(\"/_agent-native/mcp\")\n ? trimmedPath.slice(0, -\"/_agent-native/mcp\".length).replace(/\\/+$/, \"\")\n : trimmedPath;\n if (!appPath) return target;\n const url = `${parsed.origin}${appPath}`;\n return {\n ...target,\n loaded: {\n ...target.loaded,\n manifest: {\n ...target.loaded.manifest,\n hosted: { url, mcpUrl: `${url}/_agent-native/mcp` },\n },\n },\n };\n}\n\nfunction dryRunInstallCommand(\n parsed: ParsedSkillsArgs,\n target: string,\n): string {\n const clients = parsed.clients ?? resolveClients(parsed.client);\n const args = [\n \"skills\",\n \"add\",\n target,\n \"--client\",\n clientArgForClients(clients),\n \"--scope\",\n parsed.scope,\n ];\n if (parsed.mcpUrl) args.push(\"--mcp-url\", parsed.mcpUrl);\n if (parsed.instructions && !parsed.mcp) args.push(\"--instructions-only\");\n if (!parsed.instructions && parsed.mcp) args.push(\"--mcp-only\");\n if (!parsed.connect) args.push(\"--no-connect\");\n if (parsed.yes || isKnownSkill(target)) args.push(\"--yes\");\n return commandString(\"agent-native\", args);\n}\n\nasync function runCommand(\n cmd: string,\n args: string[],\n options: RunCommandOptions = {},\n): Promise<number> {\n return new Promise((resolve, reject) => {\n const pipeToStderr = options.stdio === \"stderr\";\n const silent = options.stdio === \"silent\";\n const stdoutChunks: Buffer[] = [];\n const stderrChunks: Buffer[] = [];\n const child = spawn(cmd, args, {\n stdio: pipeToStderr || silent ? [\"inherit\", \"pipe\", \"pipe\"] : \"inherit\",\n shell: process.platform === \"win32\",\n env: process.env,\n });\n if (pipeToStderr) {\n child.stdout?.on(\"data\", (chunk) => process.stderr.write(chunk));\n child.stderr?.on(\"data\", (chunk) => process.stderr.write(chunk));\n } else if (silent) {\n child.stdout?.on(\"data\", (chunk) =>\n stdoutChunks.push(Buffer.from(chunk)),\n );\n child.stderr?.on(\"data\", (chunk) =>\n stderrChunks.push(Buffer.from(chunk)),\n );\n }\n child.on(\"error\", reject);\n child.on(\"exit\", (code, signal) => {\n if (signal) {\n reject(new Error(`${cmd} was interrupted by ${signal}.`));\n return;\n }\n if (silent && code !== 0) {\n for (const chunk of stdoutChunks) process.stderr.write(chunk);\n for (const chunk of stderrChunks) process.stderr.write(chunk);\n }\n resolve(code ?? 0);\n });\n });\n}\n\n/**\n * Resolve a `--mcp-url` override into the `{ url, mcpUrl }` pair the manifest\n * expects. Accepts a bare origin (`https://x.ngrok-free.dev`) — appending the\n * standard `/_agent-native/mcp` path — or a full MCP URL already ending in it.\n */\nfunction resolveMcpUrlOverride(input: string): { url: string; mcpUrl: string } {\n let parsed: URL;\n try {\n parsed = new URL(input);\n } catch {\n throw new Error(`--mcp-url must be a valid URL (got \"${input}\").`);\n }\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n throw new Error(\"--mcp-url must use http:// or https://.\");\n }\n const origin = parsed.origin;\n const trimmedPath = parsed.pathname.replace(/\\/+$/, \"\");\n const mcpUrl = trimmedPath.endsWith(\"/_agent-native/mcp\")\n ? `${origin}${trimmedPath}`\n : `${origin}/_agent-native/mcp`;\n return { url: origin, mcpUrl };\n}\n\n/** Return a copy of the install target with its hosted MCP URL overridden. */\nfunction withMcpUrlOverride(\n target: SkillInstallTarget,\n input: string,\n): SkillInstallTarget {\n const { url, mcpUrl } = resolveMcpUrlOverride(input);\n return {\n ...target,\n loaded: {\n ...target.loaded,\n manifest: { ...target.loaded.manifest, hosted: { url, mcpUrl } },\n },\n };\n}\n\n/**\n * Whether we can run the interactive browser/device auth flow. CI and\n * non-TTY shells must not block on a browser approval, so we skip the inline\n * flow there and surface the exact `agent-native connect` command instead.\n */\nfunction canRunInteractiveConnect(options: RunSkillsOptions): boolean {\n if (options.isInteractive) return options.isInteractive();\n if (process.env.AGENT_NATIVE_NO_PROMPT === \"1\") return false;\n if (process.env.CI === \"true\") return false;\n return !!process.stdin.isTTY && !!process.stdout.isTTY;\n}\n\n/** Build the `agent-native connect <url> --client … --scope …` command. */\nfunction connectCommandFor(\n hostedUrl: string,\n clients: ClientId[],\n scope: string,\n): string {\n const args = [\n \"connect\",\n hostedUrl,\n \"--client\",\n clientArgForClients(clients),\n \"--scope\",\n scope,\n ];\n return commandString(\"agent-native\", args);\n}\n\n/**\n * Authenticate the freshly-registered hosted MCP connector so the user does not\n * hit the OAuth wall on their first tool call. Reuses the existing\n * `agent-native connect` flow (OAuth-capable clients get URL-only config plus a\n * `/mcp` authenticate prompt; Codex / Cowork run the browser device-code flow).\n * In non-interactive shells we skip the inline flow and return the command to\n * run instead. Failures here are non-fatal: the connector is already registered,\n * so the user can authenticate later.\n */\nasync function connectAfterEnsure(\n installTarget: SkillInstallTarget,\n clients: ClientId[],\n parsed: ParsedSkillsArgs,\n options: RunSkillsOptions,\n): Promise<{ connected: boolean; connectCommand: string }> {\n const hostedUrl = installTarget.loaded.manifest.hosted.url;\n const authMode = installTarget.loaded.manifest.auth?.mode ?? \"oauth\";\n const connectCommand = connectCommandFor(hostedUrl, clients, parsed.scope);\n\n // Skills whose connector needs no auth (e.g. open/local-only) never need the\n // connect step.\n if (authMode === \"none\") {\n return { connected: false, connectCommand: \"\" };\n }\n\n if (!canRunInteractiveConnect(options)) {\n options.log?.(\n `Authentication skipped (non-interactive). To finish auth, run: ${connectCommand}`,\n );\n return { connected: false, connectCommand };\n }\n\n options.log?.(`Authenticating ${installTarget.displayName}…`);\n try {\n await (options.runConnect ?? runConnect)([\n hostedUrl,\n \"--client\",\n clientArgForClients(clients),\n \"--scope\",\n parsed.scope,\n ]);\n return { connected: true, connectCommand: \"\" };\n } catch (err: any) {\n // Non-fatal: the MCP connector is registered. Surface the manual command.\n options.log?.(\n `Could not finish authentication automatically (${err?.message ?? err}). ` +\n `Run it later with: ${connectCommand}`,\n );\n return { connected: false, connectCommand };\n }\n}\n\nexport async function addAgentNativeSkill(\n parsed: ParsedSkillsArgs,\n options: RunSkillsOptions = {},\n): Promise<SkillsAddResult> {\n const target = parsed.target ?? \"assets\";\n const knownTarget = normalizeKnownSkillTarget(target);\n if (!knownTarget && !fs.existsSync(path.resolve(target))) {\n throw new Error(\n `Unknown skill or manifest path: ${target}. Run \"agent-native skills list\".`,\n );\n }\n const knownBuiltIn = knownTarget ? BUILT_IN_APP_SKILLS[knownTarget] : null;\n if (isLocalOnlyBuiltInSkill(knownBuiltIn)) {\n if (parsed.mcpUrl) {\n throw new Error(\n \"Context X-Ray is installed locally and does not use --mcp-url yet.\",\n );\n }\n if (!parsed.instructions && parsed.mcp) {\n throw new Error(\n \"Context X-Ray does not need MCP config yet. Run without --mcp-only.\",\n );\n }\n const clients = parsed.clients ?? resolveClients(parsed.client);\n const skillsAgents = skillsAgentsForClients(clients);\n if (parsed.dryRun) {\n return {\n id: knownBuiltIn.manifest.id,\n displayName: knownBuiltIn.manifest.displayName,\n skillNames: [knownBuiltIn.skillName],\n skillsAgents,\n mcpUrl: \"\",\n mcpClients: [],\n dryRun: true,\n local: true,\n commands: [dryRunInstallCommand(parsed, target)],\n };\n }\n const localInstall = installLocalContextXray({\n baseDir: options.baseDir ?? process.cwd(),\n clients,\n scope: parsed.scope,\n });\n return {\n id: knownBuiltIn.manifest.id,\n displayName: knownBuiltIn.manifest.displayName,\n instructionSource: localInstall.scriptPath,\n skillNames: [knownBuiltIn.skillName],\n skillsAgents,\n mcpUrl: \"\",\n mcpClients: [],\n dryRun: false,\n local: true,\n scriptPath: localInstall.scriptPath,\n written: localInstall.written,\n commands: localInstall.commands,\n };\n }\n let installTarget = loadSkillTarget(target);\n if (parsed.mcpUrl) {\n installTarget = withMcpUrlOverride(installTarget, parsed.mcpUrl);\n }\n const clients = parsed.clients ?? resolveClients(parsed.client);\n installTarget = preserveMcpUrlAppPathOverride(installTarget, parsed.mcpUrl);\n const skillsAgents = skillsAgentsForClients(clients);\n if (parsed.dryRun) {\n try {\n return {\n id: installTarget.id,\n displayName: installTarget.displayName,\n skillNames: installTarget.skillNames,\n skillsAgents,\n mcpUrl: installTarget.loaded.manifest.hosted.mcpUrl,\n mcpClients: clients,\n dryRun: true,\n commands: [dryRunInstallCommand(parsed, target)],\n };\n } finally {\n installTarget.cleanup?.();\n }\n }\n const commands: string[] = [];\n const tmpRoot = fs.mkdtempSync(path.join(os.tmpdir(), \"an-skills-add-\"));\n let instructionSource: string | undefined;\n let connected = false;\n let connectCommand: string | undefined;\n\n try {\n if (parsed.instructions) {\n if (skillsAgents.length === 0) {\n if (!parsed.mcp) {\n throw new Error(\n \"Skill instructions can only be installed for Codex or Claude Code clients. Use an MCP-capable client or omit --instructions-only.\",\n );\n }\n } else {\n instructionSource = installTarget.materializeInstructions(tmpRoot);\n const args = [\n \"--yes\",\n \"skills@latest\",\n \"add\",\n instructionSource,\n \"--copy\",\n ...installTarget.skillNames.flatMap((skill) => [\"--skill\", skill]),\n ...skillsAgents.flatMap((agent) => [\"-a\", agent]),\n ...(parsed.scope === \"user\" ? [\"-g\"] : []),\n ...(parsed.yes || knownTarget ? [\"-y\"] : []),\n ];\n commands.push(commandString(\"npx\", args));\n if (!parsed.dryRun) {\n const code = await (options.runCommand ?? runCommand)(\"npx\", args, {\n stdio: \"silent\",\n });\n if (code !== 0)\n throw new Error(`npx skills add exited with ${code}.`);\n }\n }\n }\n\n if (parsed.mcp) {\n commands.push(\n `agent-native app-skill ensure --manifest ${installTarget.loaded.file} --client ${parsed.client} --scope ${parsed.scope} --yes`,\n );\n if (!parsed.dryRun) {\n await ensureAppSkill(installTarget.loaded, {\n clients,\n scope: parsed.scope,\n baseDir: options.baseDir,\n yes: parsed.yes || Boolean(knownTarget),\n confirm: true,\n log: options.log,\n });\n\n // One-step install + authenticate: after registering a hosted MCP\n // connector, kick off the existing connect/device-code flow so the user\n // does not hit an OAuth wall on the first tool call. `--no-connect`\n // opts out; non-interactive shells get the exact command to run.\n if (parsed.connect) {\n const result = await connectAfterEnsure(\n installTarget,\n clients,\n parsed,\n options,\n );\n connected = result.connected;\n connectCommand = result.connectCommand || undefined;\n if (connectCommand) commands.push(connectCommand);\n }\n }\n }\n\n return {\n id: installTarget.id,\n displayName: installTarget.displayName,\n instructionSource,\n skillNames: installTarget.skillNames,\n skillsAgents,\n mcpUrl: installTarget.loaded.manifest.hosted.mcpUrl,\n mcpClients: clients,\n dryRun: parsed.dryRun,\n commands,\n connected,\n connectCommand,\n };\n } finally {\n fs.rmSync(tmpRoot, { recursive: true, force: true });\n installTarget.cleanup?.();\n }\n}\n\nfunction listSkills() {\n return Object.values(BUILT_IN_APP_SKILLS).map((entry) => ({\n id: entry.manifest.id,\n aliases:\n BUILT_IN_APP_SKILL_DISPLAY_ALIASES[\n entry.manifest.id as BuiltInAppSkillId\n ] ?? [],\n name: entry.manifest.displayName,\n description: entry.manifest.description,\n mcpUrl: isLocalOnlyBuiltInSkill(entry) ? \"\" : entry.manifest.hosted.mcpUrl,\n local: isLocalOnlyBuiltInSkill(entry),\n }));\n}\n\nexport async function runSkills(\n argv: string[],\n options: RunSkillsOptions = {},\n): Promise<void> {\n const parsed = parseSkillsArgs(argv);\n const log = parsed.printJson\n ? undefined\n : (message: string) => process.stdout.write(`${message}\\n`);\n\n if (parsed.command === \"help\") {\n process.stdout.write(`${HELP}\\n`);\n return;\n }\n\n if (parsed.command === \"list\") {\n const skills = listSkills();\n if (parsed.printJson) {\n process.stdout.write(`${JSON.stringify(skills, null, 2)}\\n`);\n return;\n }\n for (const skill of skills) {\n const description = skill.description.replace(/[.?!]?$/, \".\");\n const aliases = skill.aliases.length\n ? ` Aliases: ${skill.aliases.join(\", \")}.`\n : \"\";\n const target = skill.local ? \"local command\" : skill.mcpUrl;\n process.stdout.write(\n `${skill.id.padEnd(12)} ${description}${aliases} (${target})\\n`,\n );\n }\n return;\n }\n\n const targets = await resolveSkillTargets(parsed, options);\n if (!targets) return;\n const clients = await resolveSkillsClients(parsed, options);\n if (!clients) return;\n\n const results: SkillsAddResult[] = [];\n for (const target of targets) {\n results.push(\n await addAgentNativeSkill(\n {\n ...parsed,\n target,\n client: clientArgForClients(clients),\n clients,\n },\n {\n ...options,\n log,\n },\n ),\n );\n }\n\n if (parsed.printJson) {\n process.stdout.write(\n `${JSON.stringify(results.length === 1 ? results[0] : results, null, 2)}\\n`,\n );\n return;\n }\n\n if (parsed.dryRun) {\n process.stdout.write(\n `${results.flatMap((result) => result.commands).join(\"\\n\")}\\n`,\n );\n return;\n }\n\n const installedNames = results.map((result) => result.displayName).join(\", \");\n const skillsAgents = [\n ...new Set(results.flatMap((result) => result.skillsAgents)),\n ];\n const mcpClients = [\n ...new Set(results.flatMap((result) => result.mcpClients)),\n ];\n const mcpUrls = [\n ...new Set(results.map((result) => result.mcpUrl).filter(Boolean)),\n ];\n const localCommands = [\n ...new Set(\n results\n .filter((result) => result.local)\n .flatMap((result) => result.commands),\n ),\n ];\n const authConnected = results.some((result) => result.connected);\n const pendingConnectCommands = [\n ...new Set(\n results\n .map((result) => result.connectCommand)\n .filter((command): command is string => Boolean(command)),\n ),\n ];\n const authLine = authConnected\n ? \"Authentication: completed.\"\n : pendingConnectCommands.length\n ? `Authentication: pending — run ${pendingConnectCommands.join(\" && \")}`\n : \"\";\n process.stdout.write(\n [\n `Installed ${installedNames} skill${results.length === 1 ? \"\" : \"s\"}.`,\n skillsAgents.length\n ? `Skill instructions: ${skillsAgents.join(\", \")}.`\n : \"Skill instructions: skipped.\",\n mcpClients.length\n ? `MCP config: ${mcpClients.join(\", \")}.`\n : \"MCP config: not required.\",\n mcpUrls.length\n ? `MCP URL${mcpUrls.length === 1 ? \"\" : \"s\"}: ${mcpUrls.join(\", \")}.`\n : \"\",\n authLine,\n localCommands.length ? `Local command: ${localCommands.join(\", \")}.` : \"\",\n \"Restart or reload selected agent clients if the skill is not visible yet.\",\n parsed.clientExplicit\n ? \"\"\n : `To add another client later, rerun with --client <client> (for example: --client claude-code).`,\n ]\n .filter(Boolean)\n .join(\"\\n\") + \"\\n\",\n );\n}\n"]}
1
+ {"version":3,"file":"skills.js","sourceRoot":"","sources":["../../src/cli/skills.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,oBAAoB,EACpB,yBAAyB,GAG1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,4BAA4B,EAC5B,cAAc,EACd,UAAU,EACV,6BAA6B,GAC9B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,OAAO,EAAiB,MAAM,yBAAyB,CAAC;AAEjE,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAgCsB,CAAC;AAEpC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+EvB,CAAC;AAEF,MAAM,2BAA2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqEnC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uCAoCY,CAAC;AAExC,MAAM,CAAC,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AC,CAAC,8BAA8B;QAClC,UAAU,CAAC,MAAM;YACf,CAAC,CAAC,eAAe,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACzC,CAAC,CAAC,2BAA2B;QAC/B,OAAO,CAAC,MAAM;YACZ,CAAC,CAAC,UAAU,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACrE,CAAC,CAAC,EAAE;QACN,QAAQ;QACR,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACzE,2EAA2E;QAC3E,MAAM,CAAC,cAAc;YACnB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,gGAAgG;KACrG;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CACrB,CAAC;AACJ,CAAC","sourcesContent":["/**\n * `agent-native skills` is the friendly install surface for app-backed skills.\n * The lower-level `app-skill` commands remain the packaging primitives; this\n * command handles the common \"install Assets for my agent\" path in one step.\n */\n\nimport fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { spawn } from \"node:child_process\";\n\nimport {\n buildAppSkillPack,\n ensureAppSkill,\n loadAppSkillManifest,\n normalizeAppSkillManifest,\n type AppSkillManifest,\n type LoadedAppSkillManifest,\n} from \"./app-skill.js\";\nimport {\n readConnectClientPreferences,\n resolveClients,\n runConnect,\n writeConnectClientPreferences,\n} from \"./connect.js\";\nimport {\n CONTEXT_XRAY_SKILL_MD,\n installLocalContextXray,\n} from \"./context-xray-local.js\";\nimport { CLIENTS, type ClientId } from \"./mcp-config-writers.js\";\n\nconst HELP = `agent-native skills\n\nUsage:\n agent-native skills list\n agent-native skills add assets|design-exploration|visual-plan|visual-questions|ui-plan|prototype-plan|plan-design|visualize-plan|context-xray [--client codex|claude-code|claude-code-cli|cowork|all] [--scope user|project] [--mcp-url <url>] [--no-connect] [--yes] [--dry-run] [--json]\n agent-native skills add <manifest-or-app-dir> [--client ...] [--yes]\n\nExamples:\n agent-native skills add assets\n agent-native skills add design-exploration\n agent-native skills add visual-plan\n agent-native skills add visual-plan --no-connect\n agent-native skills add context-xray --client all\n agent-native skills add assets --client claude-code\n agent-native skills add assets --mcp-url https://my-app.ngrok-free.dev\n agent-native skills add ./dist/assets-skill --client codex\n\nThe add command installs the SKILL.md instructions, registers the app-backed\nMCP connector, and then authenticates it in one step so you do not hit an OAuth\nwall on the first tool call. Authentication reuses \"agent-native connect\":\nOAuth-capable clients (Claude Code) get a URL-only entry and a /mcp authenticate\nprompt, while Codex / Cowork run the browser device-code flow. In a\nnon-interactive shell or CI the auth step is skipped and the exact\n\"agent-native connect <url>\" command is printed instead.\n\nRunning \"npx skills add ...\" directly installs instructions only; use this Agent\nNative CLI path when you want MCP setup and auth too. Pass --no-connect to\nregister the connector without authenticating (leave auth to the host or run\n\"agent-native connect\" later). Pass --mcp-url to register that connector against\na custom origin (an ngrok tunnel, a local dev server, or a self-hosted\ndeployment) instead of the built-in hosted default — a bare origin gets the\nstandard /_agent-native/mcp path appended. Use app-skill pack for marketplace\nbundles and custom adapter output.`;\n\nconst ASSETS_SKILL_MD = `---\nname: assets\ndescription: >-\n Use Assets for image or video generation requests, brand-safe media,\n human picker UI, search/list/export actions, and cross-app asset selection.\n Prefer this over generic image tools when installed.\nmetadata:\n visibility: exported\n---\n\n# Assets\n\nUse the Assets app when a workflow needs reusable brand media, a human picker,\nor generated image/video assets that another app can reference by ID and URL.\nWhen this skill is available, route plain image-generation requests here instead\nof using a generic image generator.\n\n## Choose The Path\n\n- Use \\`open-asset-picker\\` when a person should browse, search, generate, and\n select an asset in UI. Pass \\`mediaType: \"image\"\\` by default, or\n \\`mediaType: \"video\"\\` for video libraries. When the user asks to create a\n specific image and choose the best option, pass \\`prompt\\`,\n \\`autoGenerate: true\\`, and \\`count: 3\\` so the picker opens with candidates\n to preview and select.\n- Use unattended actions when the agent already knows what to do:\n \\`search-assets\\`, \\`list-assets\\`, \\`generate-image\\`,\n \\`generate-image-batch\\`, \\`generate-video\\`,\n \\`refresh-generation-run\\`, and \\`export-asset\\`.\n- Use browser/deep-link fallback when the host cannot render MCP Apps inline.\n Surface the returned picker link. If it opens in a normal browser tab, have\n the user select an asset there and paste back the copied handoff summary.\n Treat Codex, Claude Code, and Claude Desktop Code as link-out hosts; do not\n promise inline MCP App rendering there.\n If the skill instructions are available but the MCP tool namespace has not\n appeared yet, use the Assets browser fallback URL shape instead of switching\n to a generic generator:\n \\`https://assets.agent-native.com/library?mediaType=image&prompt=...&autoGenerate=1&count=3\\`.\n When reporting the final selected image in Codex or Claude Code, include the\n asset link and, if an inline preview is important, download the selected\n \\`previewUrl\\`/\\`downloadUrl\\` to a local temp image and embed that absolute\n local path. Remote CDN markdown images can fail to render in code-editor chat\n surfaces.\n\n## Image And Video Workflows\n\n1. Pick or match the library with \\`list-libraries\\` or \\`match-library\\`.\n2. For images, call \\`generate-image\\` or \\`generate-image-batch\\`. Image\n actions are synchronous: one batch call should return the finished image\n candidates, so do not poll or regenerate unless a returned slot failed.\n3. For videos, call \\`generate-video\\` and poll \\`refresh-generation-run\\`\n until the run completes.\n4. Preserve returned \\`assetId\\`, \\`runId\\`, \\`previewUrl\\`, \\`downloadUrl\\`,\n media type, and dimensions so the caller can attach or embed the result.\n\n## Cross-App Use\n\n- Hosted default: connect \\`https://assets.agent-native.com/_agent-native/mcp\\`.\n Do not put shared secrets in skill files.\n- For CLI/code-editor clients, keep any \\`agent-native connect\\` command\n running until browser authorization finishes. Stopping it early can leave the\n browser approved but the local MCP config unwritten. Restart or reload the\n agent client after installing or connecting if Assets tools do not appear in\n the live session.\n- Local customization: use \\`agent-native app-skill launch --local\\` from an\n Assets app-skill manifest, or pass \\`--into <path>\\` for editable source.\n- Do not call image/video providers directly from another app. Assets owns\n generation, picker UI, search/list/export, and asset context.\n- If an Assets tool call returns \\`Session terminated\\`, \\`needs auth\\`, or\n another connector/session error, do not keep retrying the tool. Tell the user\n to reconnect or authenticate the Assets MCP connector, then continue after it\n is available.\n- Do not hand-roll MCP HTTP requests with curl from the agent session. Use the\n host-exposed Assets tools after restart/reload, or use the returned\n browser/deep-link fallback.\n- If a batch image generation request times out in browser fallback, retry with\n \\`count: 1\\` only after telling the user the multi-candidate request timed out.\n- If you inspect local MCP config, redact \\`Authorization\\`, \\`http_headers\\`,\n and token values. Never paste bearer tokens into chat or logs.\n`;\n\nconst DESIGN_EXPLORATION_SKILL_MD = `---\nname: design-exploration\ndescription: >-\n Use Design for UI/UX exploration, side-by-side design directions,\n interactive prototype previews, user selection, iteration, and design-to-code\n handoff through the hosted Design MCP app.\nmetadata:\n visibility: exported\n---\n\n# Design Exploration\n\nUse the Design app when a workflow needs visual UI exploration, prototype\niteration, or a human-in-the-loop choice among design directions.\n\n## Choose The Path\n\n- Use \\`create-design\\` first to create a project shell. Do not report the\n design as ready until it has renderable HTML.\n- For open-ended UX exploration, generate distinct, complete HTML directions\n (2-5, three by default) and call \\`present-design-variants\\`. The inline\n Design MCP app shows the options, lets the user pick one, and persists the\n selected variant.\n- If the Design app opens as a browser link instead of inline (CLI hosts like\n Codex / Claude Code, where the deep link carries \\`handoff=chat\\`), the user\n picks a direction there and the editor shows a copyable summary — ask them to\n paste it back into chat so you can continue from the chosen direction. The\n \\`present-design-variants\\` result's \\`fallbackInstructions\\` describe this.\n- For direct refinements to an already chosen direction, call\n \\`get-design-snapshot\\`, edit from the current tuned HTML, then call\n \\`generate-design\\`.\n- Use \\`export-coding-handoff\\` when the user wants to implement the chosen\n design in a codebase.\n\n## Exploration Defaults\n\n1. Default to three variants unless the user asks for a different count\n (\\`present-design-variants\\` accepts 2-5; three is the sweet spot).\n2. Make variants structurally and stylistically distinct, not just color swaps.\n3. Each variant must be a complete standalone HTML document that renders\n without a build step.\n4. For product UI redesigns, prefer cleaner hierarchy, progressive disclosure,\n and realistic controls over decorative mockups.\n5. After \\`present-design-variants\\`, wait for the user's pick before\n generating the next version. If they say \"I like #2 but...\", snapshot the\n chosen design and refine that direction with \\`generate-design\\`.\n\n## Cross-App Use\n\n- Hosted default: connect \\`https://design.agent-native.com/_agent-native/mcp\\`.\n Do not put shared secrets in skill files.\n- For CLI/code-editor clients, keep any \\`agent-native connect\\` command\n running until browser authorization finishes. Stopping it early can leave the\n browser approved but the local MCP config unwritten. Restart or reload the\n agent client after installing or connecting if Design tools do not appear in\n the live session.\n- Dispatch can expose Design alongside other apps. Use Design for UI/UX design\n tasks, Assets for image/media selection, Slides for decks, and so on.\n- Keep the loop visual: surface the inline MCP App or the returned \"Open\n design\" link instead of pasting large HTML blobs into chat.\n- If a Design tool call returns \\`Session terminated\\`, \\`needs auth\\`, or\n another connector/session error, do not keep retrying the tool. Tell the user\n to reconnect or authenticate the Design MCP connector, then continue after it\n is available.\n- Do not hand-roll MCP HTTP requests with curl from the agent session. Use the\n host-exposed Design tools after restart/reload, or use the returned\n browser/deep-link fallback.\n- If you inspect local MCP config, redact \\`Authorization\\`, \\`http_headers\\`,\n and token values. Never paste bearer tokens into chat or logs.\n`;\n\n/**\n * Shared setup/auth block for every Plans skill (`/visual-plan`, `/ui-plan`,\n * `/prototype-plan`, `/plan-design`, `/visual-questions`, `/visualize-plan`). Interpolated into each skill markdown\n * so the install + one-step authenticate instructions never drift between them.\n * Keep this in sync with the copies under `templates/plan/.agents/skills/*` and\n * top-level `skills/*` (this skill's SKILL.md is triplicated with no sync test).\n */\nconst PLAN_SETUP_AUTH_MD = `## Setup & Authentication\n\nThere are two ways into Plans.\n\n**Coding agent (CLI).** Install once with the Agent-Native CLI. The command\ninstalls the Plans skills, registers the hosted Plans MCP connector, and\nauthenticates it in the same step (a one-time browser sign-in at setup — this is\nintended), so the first tool call does not hit an OAuth wall:\n\n\\`\\`\\`bash\nagent-native skills add visual-plan\n\\`\\`\\`\n\nAfter that, \\`/visual-plan\\` (and \\`/ui-plan\\`, \\`/prototype-plan\\`, \\`/plan-design\\`,\n\\`/visual-questions\\`, \\`/visualize-plan\\`) generate a plan and open the editor. Pass \\`--no-connect\\` to\nregister the connector without authenticating, then run\n\\`agent-native connect https://plan.agent-native.com\\` whenever you are ready.\n\n**Browser (people you share with).** Open the Plans editor and create & edit\nwith no sign-up — you work as a guest. Sign in only when you want to save or\nshare; signing in claims the plans you made as a guest into your account.\n\nSharing and commenting require an account: public/shared plans are viewable by\nanyone with the link, but commenting on them needs an agent-native account.\n\nFor fully offline, no-account use, run the Plans app locally and sync plans to\nyour repo as MDX. This local mode is a separate advanced path, not the default\nhosted flow.\n\nIf a Plans tool returns \\`needs auth\\`, \\`Unauthorized\\`, or \\`Session terminated\\`,\ndo not keep retrying the tool. Authenticate the connector with\n\\`agent-native connect https://plan.agent-native.com\\` (OAuth-capable hosts can\ninstead re-run /mcp and choose Authenticate), then continue once the connector\nis available.\n\nHosted default: connect \\`https://plan.agent-native.com/_agent-native/mcp\\`. Do\nnot put shared secrets in skill files.`;\n\nexport const VISUAL_PLANS_SKILL_MD = `---\nname: visual-plan\ndescription: >-\n Use Agent-Native Plans when coding-agent work needs an interactive structured\n plan document with diagrams, wireframes, mockups, prototypes, annotations,\n and comments.\nmetadata:\n visibility: exported\n---\n\n# Agent-Native Plans\n\nAgent-Native Plans is structured visual planning mode for coding agents. Build\nthe plan you would normally write in Markdown, but as a scannable document with\neditable blocks mixed in: an optional top visual review area (wireframe canvas,\nlive prototype, or both in tabs) and a Notion-like technical document below. The\nuser reacts to visuals first and reads prose only where it helps.\n\n\\`/visual-plan\\` is the canonical command and the main entry point. Use \\`/ui-plan\\`\nwhen the work is primarily product UI and review should start with the screens.\nUse \\`/prototype-plan\\` when review should start with a functional live prototype.\nUse \\`/plan-design\\` when review should start with full-fidelity branded design.\nUse \\`/visual-questions\\` only when the user explicitly wants a visual intake form\nbefore planning. Use \\`/visualize-plan\\` to turn an existing Codex, Claude Code,\nMarkdown, or pasted plan into a visual companion.\n\n## When To Use\n\nCreate a visual plan when work is multi-file, ambiguous, long-running, risky, or\nUI-heavy, when architecture / data flow / UI direction / options / open\nquestions would be clearer visually, or when the user needs to react to a\ndirection before you implement.\n\n## Plan Discipline\n\n- **Gate hard.** A polished visual plan is the most expensive plan form; only\n invest when a wrong direction is costly. Skip it for trivial, unambiguous work\n — typos, one-line fixes, a single well-specified function, anything whose diff\n you could describe in one sentence — and just make the change. Never pad a plan\n with filler and never ship a single-step plan.\n- **Research before you draft.** Read the real files, actions, schema, and\n patterns first; name actual files, symbols, and data shapes instead of\n inventing them. Check existing \\`actions/\\` before proposing endpoints and prefer\n named client helpers over raw fetch. Delegate wide exploration to a sub-agent.\n- **Planning is read-only.** Make no source edits while building or reviewing the\n plan. Start editing only after the user approves the direction.\n- **Clarify vs. assume.** Do not ask how to build it — explore and present the\n approach and options in the plan. Ask a clarifying question only when an\n ambiguity would change the design and you cannot resolve it from the code; use\n the host agent's normal ask-user-question flow and batch 2-4 high-leverage\n questions before finalizing. Do not call \\`create-visual-questions\\` from\n \\`/visual-plan\\`; keep any answerable follow-up inside the plan itself as a\n bottom \\`question-form\\` Open Questions block. Otherwise state the assumption\n explicitly and proceed, and put anything unresolved in an open-questions block.\n- **The plan is the approval gate.** After surfacing it, ask the user to review\n and approve before you write code, and name which files/areas the work touches.\n Presenting the plan and requesting sign-off is the approval step — do not ask a\n separate \"does this look good?\" question.\n- **The document is the source of truth, not the chat.** When scope shifts,\n update the plan with \\`update-visual-plan\\` rather than only changing course in\n chat, and re-read the approved plan before major steps.\n\n## Core Workflow\n\n1. Follow the host agent's normal planning flow: inspect the codebase, delegate\n wide exploration when useful, gather the info needed, and ask native\n clarifying questions as needed before generating the plan.\n2. Decide the top visual surface with the rules below, then call\n \\`create-visual-plan\\` with the title, brief, source, repo path, and structured \\`content\\` blocks.\n3. Compose any top visual surface from the kit and write the document with\n native blocks (see the cores below). Keep the document close to the Markdown\n plan the agent would normally output; add diagrams, wireframes, prototypes,\n and visual callouts only where they clarify the plan. Skip the top visual\n surface for non-visual work.\n4. Surface the returned Plans link or inline MCP App and ask the user to review.\n Always include the actual URL in chat so the next step is a click in CLI or\n other text-only hosts. When the host exposes an embedded browser/preview panel\n and a tool can open arbitrary URLs there, open the returned plan URL\n automatically for convenient review; do not rely on this as the only handoff.\n5. Call \\`get-plan-feedback\\` before editing, after review, after any long pause,\n and before the final response. Treat \\`anchorDetails\\`, resolver intent, recent\n review events, and any focused screenshots from browser handoff as the source\n of truth for exactly what changed and exactly what each comment points at.\n6. Apply changes with \\`update-visual-plan\\`, preferring targeted \\`contentPatches\\`.\n When the user wants source-control friendly edits, use\n \\`patch-visual-plan-source\\` against the MDX files instead of regenerating the\n plan.\n7. Export with \\`export-visual-plan\\` only when the user wants a shareable receipt\n or repo-check-in artifacts.\n\n## Visual Surface Choice\n\nChoose the surface before creating the plan. Do not add visual chrome by\ndefault:\n\n- **No visual surface** for architecture-only, backend-only, data migration,\n copy-only, or otherwise non-visual plans. Use a strong document with diagrams\n only when relationships need a visual explanation.\n- **Canvas only** for one static screen, a before/after comparison, a component\n state, a small popover, or a visual direction that does not require clicking.\n Put those wireframes in \\`content.canvas\\` and omit \\`content.prototype\\`.\n- **Canvas + prototype** for multi-step UI flows, onboarding, wizards,\n review/approval flows, navigation changes, or anything where the reviewer\n needs to operate the behavior. Keep the static wireframes in\n \\`content.canvas\\`, add the aligned functional prototype in\n \\`content.prototype\\`, and rely on the top visual tabs to switch between them.\n- **Prototype-first** when the user explicitly asks for \\`/prototype-plan\\`, asks\n to operate the UI, or when interaction is the main question. Use\n \\`create-prototype-plan\\`, which still preserves static mocks where useful.\n\nFor mixed canvas + prototype plans, reuse the same real labels, app statuses,\nand screen ids across both surfaces. The canvas is the inspectable static reference;\nthe prototype is the interactive version of that same flow, not a separate\ndesign direction.\n\n<!-- SHARED-CORE:wireframe-canvas START -->\n\n## Wireframe & Canvas Core\n\nThis section is shared, word for word, by \\`/visual-plan\\`, \\`/ui-plan\\`, and\n\\`/visualize-plan\\`. It is the single source of truth for how wireframes and the\ncanvas work. Do not paraphrase it per command.\n\n**A wireframe is an HTML mockup. The renderer owns the look; you write the\ncontent.** Set \\`data.html\\` to a self-contained, semantic HTML fragment of the\nscreen and set \\`data.surface\\`. The renderer owns the surface footprint/aspect,\nthe dark/light theme, the hand-drawn font, and the rough.js sketch overlay — you\nnever write \\`<html>\\`/\\`<body>\\`/\\`<script>\\`/\\`<style>\\` tags, font-family, hex colors,\nor any width/height/coordinates. You write real HTML layout and real product\ncontent; the renderer styles and roughens it.\n\n**A wireframe block's data is an HTML screen plus a surface:**\n\n\\`\\`\\`json\n{\n \"surface\": \"browser\",\n \"html\": \"<div style=\\\\\"display:flex;flex-direction:column;gap:10px;padding:16px;height:100%\\\\\"><h1>Sign in</h1><p class=\\\\\"wf-muted\\\\\">Use your work email to continue.</p><div class=\\\\\"wf-card\\\\\" style=\\\\\"display:flex;flex-direction:column;gap:10px\\\\\"><label>Email<input value=\\\\\"jane@acme.co\\\\\" /></label><label>Password<input value=\\\\\"••••••••\\\\\" /></label><label style=\\\\\"display:flex;align-items:center;gap:8px\\\\\"><input type=\\\\\"checkbox\\\\\" checked /> Remember me</label><button class=\\\\\"primary\\\\\">Sign in</button></div><a href=\\\\\"#\\\\\">Forgot password?</a></div>\"\n}\n\\`\\`\\`\n\n**Write PLAIN semantic HTML and let the renderer style it.** Bare elements\n(\\`h1\\`/\\`h2\\`/\\`h3\\`, \\`p\\`, \\`button\\`, \\`input\\`, \\`<input type=\"checkbox\">\\`, \\`a\\`, \\`hr\\`)\nare auto-themed — no classes needed. Helper classes carry the rest:\n\n- \\`.wf-card\\` / \\`.wf-box\\` — a bordered, padded container (a panel, a list item).\n- \\`.wf-pill\\` / \\`.wf-chip\\` — a rounded tag or filter; add \\`.accent\\`\n (\\`<span class=\"wf-pill accent\">\\`) for the accent-filled variant.\n- \\`.wf-muted\\` — secondary/muted text (or use \\`<small>\\`).\n- \\`button.primary\\` or any element with \\`[data-primary]\\` — the accent-filled\n primary button.\n\n**Use the \\`--wf-*\\` tokens for any custom color, never hex.** The renderer flips\nthese on light/dark, so reading them is what keeps a mockup correct in both\nthemes. For any inline border, background, or text color, reference a token:\n\\`style=\"border:1.4px solid var(--wf-line)\"\\`. The tokens are \\`--wf-ink\\` (text),\n\\`--wf-muted\\` (secondary text), \\`--wf-line\\` (borders/dividers), \\`--wf-paper\\`\n(page background), \\`--wf-card\\` (raised surface), \\`--wf-accent\\` /\n\\`--wf-accent-fg\\` / \\`--wf-accent-soft\\` (brand action), \\`--wf-warn\\`, \\`--wf-ok\\`,\nand \\`--wf-radius\\`. Never hard-code a hex color and never set \\`font-family\\` — the\nrenderer owns the sketch/clean font.\n\n**Lay out with inline \\`style\\` flex/grid.** You write the real layout —\n\\`display:flex; flex-direction:column; gap:10px; padding:16px\\` and so on — and the\nrenderer never repositions anything. Compose the actual product: reproduce the\ncurrent screen, then show the modification. Real labels, real counts, real dates,\nreal button text grounded in the screen you read; not lorem or gray bars.\n\n**Surface presets — match the real footprint, never default to desktop+mobile.**\nPick the \\`surface\\` that matches what the user will actually see:\n\n- \\`browser\\`: a web page that needs a browser chrome frame around it.\n- \\`desktop\\`: a full desktop app page or app shell.\n- \\`mobile\\`: a phone screen, only when the work is genuinely mobile.\n- \\`popover\\`: a small floating menu, dropdown, or inline popover.\n- \\`panel\\`: a side panel, inspector, or sidebar widget.\n\nThe surface locks the footprint and aspect; never set width/height/coordinates.\nA sidebar popover renders as a small surface, not a desktop page and a phone\nframe. Do not emit \\`desktop\\` + \\`mobile\\` variants unless responsive behavior\nactually changes the layout. For a component or widget, show one broader\napp-context frame only when placement affects understanding, then the focused\ncomponent states.\n\n**Modify, don't redesign.** When the task changes an existing screen, reproduce\nthe current screen's real layout and footprint FIRST, then change only the delta\nand call it out with a single annotation. Do not restack the page into a new\nlayout. For net-new surfaces, compose from the real app shell.\n\n**Zoom in on sub-surfaces, don't redraw the page.** For a small sub-surface (a\npopover, menu, dialog, toast), show the full screen once, then add a small\nseparate artboard whose \\`html\\` contains ONLY that sub-surface — do not re-draw\nthe whole page around it, and do not scale a duplicate up. Pick the matching\n\\`surface\\` (e.g. \\`popover\\`) so the footprint is right; never widen a popover to\npage width.\n\n**Loading / skeleton states.** Set \\`data.skeleton: true\\` on the wireframe and\nfill the \\`html\\` with neutral, textless placeholder geometry — boxes and bars\nbuilt as \\`<div>\\`s with \\`background:var(--wf-line)\\` and explicit heights/widths,\nno labels or copy. The renderer drops borders, sketch, and color into the\nskeleton register automatically. Never escape to a \\`custom-html\\` document block\nto fake a loader, and never move a mockup out of the canvas — mockups always\nlive in canvas artboards.\n\n**Editing an existing mockup.** To change one element, text, or color in an\nexisting html mockup, do NOT regenerate the frame — call \\`update-visual-plan\\`\nwith \\`contentPatches: [{ op: \"patch-wireframe-html\", blockId, edits: [{ find,\nreplace }] }]\\`. Each \\`find\\` is a unique snippet of the current html (read it\nfirst with \\`get-visual-plan\\`); set \\`all: true\\` on an edit to replace every\noccurrence. The result is re-sanitized.\n\n**Canvas annotations are designer notes on the artboard.** When a top canvas is\npresent, sprinkle Figma-style notes near the frames they explain: a short\nheading, supporting text, and bullets — plain text layers, never bordered or\nshadowed cards, and never a box around a frame. The renderer spaces notes away\nfrom frames, so place each note by the frame it describes. Use an arrow only to\npoint at one specific control or transition; for a broad frame-level note, write\ntext beside the frame with no connector. Connectors are for real sequences only —\nnever fake \"Step 1 → Step 2\" lines between independent states.\n\n**Do not create overlapping annotations.** Anchor each note to the frame it\nexplains with \\`targetId\\` + \\`placement\\` (top/right/bottom/left). The renderer\nparks notes in a gutter beside the frame and lays them out automatically — never\nsupply x/y or points for anchored notes; hand-placed coordinates fight the\nauto-layout and cause the overlap you're trying to avoid. Reserve arrows for a\nnote that must point at a specific control inside a frame; a note that simply\nsits beside its frame needs no arrow.\n\n**Patching.** Edit one wireframe, canvas annotation, or block with targeted \\`contentPatches\\`\n(for example \\`update-block\\`, \\`replace-blocks\\`, \\`update-canvas-annotation\\`) rather\nthan regenerating the whole plan. \\`contentPatches\\` are part of the public MCP\naction schema, so Claude Code, Codex, Cursor, and other hosts can make surgical\nedits. If an agent is working from exported source files, use\n\\`read-visual-plan-source\\` / \\`patch-visual-plan-source\\`: \\`plan.mdx\\` holds\nfrontmatter plus markdown/document blocks, \\`canvas.mdx\\` holds\n\\`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\\`, and the\npatch action normalizes the MDX back into the same JSON runtime model. JSON is\nthe canonical runtime shape; MDX is the repo-friendly authoring/export surface.\nIn the browser, humans edit \\`rich-text\\` prose inline; agents should still use\n\\`update-rich-text\\` content patches or source patches for prose, and use\ncomments/structured patches for canvas, artboard, wireframe, and diagram edits.\n\n**Never emit a titled artboard with no interior wireframe content.** Every artboard you place on the canvas must carry an \\`html\\` wireframe (or reference a wireframe block via \\`blockId\\`) — a label-only frame renders as an empty dashed box and is rejected at parse time. If you only have a title, write it as a section header or annotation, not an empty artboard.\n\n**Fill the frame; keep labels short.** Each artboard is a fixed-size surface — compose enough realistic HTML to fill it top to bottom with even vertical rhythm; never leave a large empty band. On desktop/app-shell sidebars, let the nav stack flex to fill (\\`flex:1\\`) and add any persistent bottom action/status after it so the rail reads complete in taller frames. On mobile especially, flow real rows down the whole screen (status bar, header, then list/detail content) rather than a header floating above a gap. Keep every label short enough to sit on one line within its column — shorten the copy rather than relying on the frame to absorb it (long labels wrap or clip).\n\n**Good example — a contacts list, surface \\`browser\\`.** A small, real screen\ncomposed from the helper classes and tokens, layout in inline flex, no fonts or\nhex colors:\n\n\\`\\`\\`html\n<div style=\"display:flex;flex-direction:column;gap:12px;padding:16px;height:100%\">\n <div style=\"display:flex;align-items:center;justify-content:space-between\">\n <h1>Contacts</h1>\n <button class=\"primary\">New contact</button>\n </div>\n <div style=\"display:flex;gap:6px\">\n <span class=\"wf-pill accent\">All 128</span>\n <span class=\"wf-pill\">Favorites</span>\n <span class=\"wf-pill\">Archived</span>\n </div>\n <div class=\"wf-card\" style=\"display:flex;flex-direction:column;gap:0;padding:0\">\n <div style=\"display:flex;align-items:center;gap:10px;padding:10px 12px;border-bottom:1.4px solid var(--wf-line)\">\n <div style=\"width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)\"></div>\n <div style=\"flex:1\"><strong>Jane Cooper</strong><br /><small>jane@acme.co</small></div>\n <span class=\"wf-pill\">Lead</span>\n </div>\n <div style=\"display:flex;align-items:center;gap:10px;padding:10px 12px\">\n <div style=\"width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)\"></div>\n <div style=\"flex:1\"><strong>Marcus Lee</strong><br /><small>marcus@globex.io</small></div>\n <span class=\"wf-pill\">Customer</span>\n </div>\n </div>\n</div>\n\\`\\`\\`\n\n**Mockups belong in the top visual review area.** Static visuals live on the\ncanvas; multi-step flows get both canvas wireframes and a prototype. When the\nuser asks for a mockup, UI state, loading state, layout, screen, or visual\ncomparison, make the canvas the primary home for that static visual. When the\nuser asks for a prototype or the plan contains a sequence the reviewer must\nfeel, keep the canvas artboards and add \\`content.prototype\\` so the top surface\nshows Wireframes / Prototype tabs. Document blocks can explain, compare, or map\nimplementation, but they should not host the primary mockup or prototype just\nbecause \\`custom-html\\`, screenshots, or prose are easier to produce. If the\ncanvas/prototype surface cannot represent the requested fidelity, still keep the\nclosest top-surface representation and call out or extend the needed renderer\ncapability.\n\n**Legacy kit tree.** Older plans set a \\`screen\\` array of \\`{ el, ...props }\\` kit\nnodes instead of \\`html\\`; the renderer still accepts and displays it, but new\nplans emit \\`html\\`. Do not author fresh kit-tree screens — write the HTML mockup\ninstead. Likewise, old or imported plans may carry coordinate-based regions or\nfree-float x/y on notes or artboards; those are legacy escape hatches the\nrenderer still shows but you must never produce. The \\`surface\\` drives the aspect\nand footprint, the canvas auto-places artboards, and the gutter parks notes by\n\\`targetId\\` + \\`placement\\`; never supply width, height, or coordinates for a new\nplan.\n\n<!-- SHARED-CORE:wireframe-canvas END -->\n\n<!-- SHARED-CORE:document-quality START -->\n\n## Document Quality Core\n\nThis section is shared, word for word, by \\`/visual-plan\\`, \\`/ui-plan\\`, and\n\\`/visualize-plan\\`. It is the single source of truth for the document below the\ncanvas. Do not paraphrase it per command.\n\n**The document is a serious technical plan, not marketing.** Write it the way a\nstrong Claude or Codex implementation plan reads: outcome-first, prose-first,\nself-contained, and specific. State the objective and what \"done\" means, the\nscope and non-goals, the proposed approach with the key decisions and their\nrationale, ordered steps that name real files, symbols, actions, and data\nshapes, the risks, and a closing verification step (tests, build, or a checkable\nbehavior). Replace vague prose with specifics; never ship a step like \"make it\nwork.\" No hero art, gradients, logos, nav bars, slogans, value props, giant\nlanding-page headings, or marketing cards unless the user explicitly asks.\n\n**Top visuals and document never duplicate each other.** The UI story lives in\nthe top visual surface: canvas artboards for static inspection, plus prototype\ntabs when the flow should be functional. The document carries the technical depth\nthe visuals cannot show — concrete file/symbol maps, API and data contracts,\ncode snippets, migration or implementation phases, risks, and validation. Repeat\na wireframe in the document only for a genuinely new detail view or comparison.\nSkip the visual surface entirely for non-visual work and write a clean rich\ndocument.\n\n**Use the right block, and make it carry substance.** For the authoritative,\nmachine-checked list of block types and their data schemas, call \\`get-plan-blocks\\`\n— it returns the live registry vocabulary (type, MDX tag, placement, key fields)\nso you never emit a block the editor cannot render or round-trip:\n\n- \\`rich-text\\` for plan prose with real bold/italic/code/links and nested lists.\n- \\`implementation-map\\` / \\`code-tabs\\` for the file map: file path, the\n symbols/components to touch, the reason, risk/coordination notes, and a\n concise syntax-highlighted snippet of the code shape — never the whole file,\n never a prose-only file list.\n- \\`decision\\` for two or three option cards with consequences. These are static\n records; do not style them like clickable tabs or chips unless the renderer\n truly supports changing the selection.\n- \\`diagram\\` for architecture, sequence, data-flow, dependency, or state\n relationships, only when it clarifies something real. Labels must not overlap\n nodes, connectors, or each other.\n- \\`tabs\\` for multiple states, directions, or comparisons. A tab that reveals\n only prose usually means the plan is under-specified — include a relevant\n visual unless the tab is intentionally document-only.\n- \\`table\\`, \\`checklist\\`, \\`callout\\` for scannable structure.\n\n**Open questions live at the bottom as a form when answers would change the\nplan.** Surface answerable unresolved decisions in a final \\`question-form\\`\nblock titled \"Open Questions\". Use \\`single\\` or \\`multi\\` for clear choices,\n\\`freeform\\` for constraints, \\`recommended: true\\` for the default you would pick,\nand option \\`wireframe\\` / \\`diagram\\` previews for visual directions when useful.\nKeep non-answerable assumptions or risks as concise \\`callout\\` blocks in the\nrelevant section. Never bury a questions/decisions wall inside the plan\nnarrative.\n\n**\\`custom-html\\` is a bounded escape hatch only** — a single complete fragment\ninside a block, never \\`html\\`/\\`head\\`/\\`body\\`/\\`script\\` tags, never a generic\nplaceholder, density demo, or proof that custom HTML works. Prefer the native\nblocks for normal plans. It may support supplemental demos or references, but it\nis never the primary home for a requested mockup, UI state, or visual\ncomparison. If fidelity requires HTML/CSS, image capture, or real React/CSS, the\nproduct fix is canvas support for that artifact type, not moving the mockup into\nthe document.\n\n**Before handoff, open the plan and check it.** Fix overlap, excessive\nwhitespace, clipped fragments, misleading inactive controls, poor contrast, and\nunreadable diagrams before asking for approval.\n\n<!-- SHARED-CORE:document-quality END -->\n\n<!-- SHARED-CORE:exemplar START -->\n\n## Good vs. Bad Exemplar\n\n**GOOD.** A \\`/ui-plan\\` for a todo app: a canvas with a \\`desktop\\` artboard whose\n\\`data.html\\` is a real flex layout — a sidebar of links (\\`Inbox 12\\`, \\`Today 4\\`,\n\\`Done\\`), a main column with an \\`<h1>Today</h1>\\`, accent \\`.wf-pill\\`s for the\nfilters, a muted section label \\`OVERDUE\\`, and \\`.wf-card\\` task rows carrying real\ntitles, due dates, and a primary \\`button.primary\\` — styled only through bare\nelements, helper classes, and \\`--wf-*\\` tokens, so the renderer applies the\ncorrect desktop footprint, theme, and one subtle whole-frame wobble. Plain-text\ndesigner notes sit spaced off the frame, pointing only at the controls that need\nexplanation. Below it, a Claude/Codex-grade document: objective and\ndone-criteria, an \\`implementation-map\\` naming the real components and actions\nwith short highlighted snippets, a \\`decision\\` card weighing two real approaches,\nand a validation step — none of it repeating the canvas. If the task also\nchanges a multi-step completion flow, the same top area includes a Prototype tab\nwhose screens use the same labels and states as the canvas artboards, with\n\\`data-goto\\` controls for the sequence. This is the bar.\n\n**BAD.** A \\`data.html\\` with hard-coded hex colors, a \\`font-family\\`, or fixed\npixel width/height; gray placeholder bars \"insinuating\" text on a non-skeleton\nframe; a forced desktop + mobile pair for a popover; floating bordered\nannotation cards hugging the frames; a fresh hand-authored kit-tree \\`screen\\`\ninstead of \\`html\\`; a multi-step UI flow with only static frames and no prototype\ntab; a mockup escaped into a document \\`custom-html\\` block; and a marketing-style\ndocument with a hero heading and value props that just restates what the canvas\nalready shows. Never produce this.\n\n<!-- SHARED-CORE:exemplar END -->\n\n## Tool Guidance\n\n- \\`create-visual-plan\\`: start one structured visual plan per agent task/run;\n \\`content\\` may include no visual surface, canvas only, or canvas + prototype.\n- \\`create-ui-plan\\`: start a UI-first plan when the work is primarily product UI.\n- \\`create-prototype-plan\\`: start a prototype-first plan with a functional top\n review surface.\n- \\`create-plan-design\\`: start a full-fidelity branded Design-tab plan with an\n optional matching Prototype tab.\n- \\`convert-visual-plan-to-prototype\\`: convert an existing HTML wireframe canvas\n into a prototype plan.\n- \\`create-visual-questions\\`: use only for the explicit \\`/visual-questions\\`\n command, not as \\`/visual-plan\\` preflight.\n- \\`visualize-plan\\`: build a visual companion from an existing text plan.\n- \\`update-visual-plan\\`: revise content, status, or comments; prefer\n \\`contentPatches\\` over regenerating the whole plan.\n- \\`read-visual-plan-source\\`: read the normalized plan as \\`plan.mdx\\`,\n optional \\`canvas.mdx\\`, optional \\`.plan-state.json\\`, and JSON.\n- \\`patch-visual-plan-source\\`: apply granular MDX AST patches by stable block,\n artboard, annotation, component, or wireframe-node id.\n- \\`import-visual-plan-source\\`: create or replace a plan from an MDX folder.\n- \\`get-visual-plan\\`: read the current structured plan, exported HTML, and\n annotations; it also returns the MDX folder for source workflows.\n- \\`get-plan-feedback\\`: read unconsumed human feedback. Use it frequently; it\n returns grouped threads, exact anchor details, expected resolver, and recent\n review-event payloads so agents can act only on the comments meant for them.\n- \\`export-visual-plan\\`: export HTML, Markdown fallback, structured JSON, and MDX\n files for repo check-in.\n\nWhen the user critiques a plan's look or structure, fix the renderer or this\nskill — never hand-edit one stored plan. Turn feedback into better guidance.\n\n## Setup & Authentication\n\nThere are two ways into Plans.\n\n**Coding agent (CLI).** Install once with the Agent-Native CLI. The command\ninstalls the Plans skills, registers the hosted Plans MCP connector, and\nauthenticates it in the same step (a one-time browser sign-in at setup — this is\nintended), so the first tool call does not hit an OAuth wall:\n\n\\`\\`\\`bash\nagent-native skills add visual-plan\n\\`\\`\\`\n\nAfter that, \\`/visual-plan\\` (and \\`/ui-plan\\`, \\`/prototype-plan\\`, \\`/plan-design\\`,\n\\`/visual-questions\\`, \\`/visualize-plan\\`) generate a plan and open the editor. Pass \\`--no-connect\\` to\nregister the connector without authenticating, then run\n\\`agent-native connect https://plan.agent-native.com\\` whenever you are ready.\n\n**Browser (people you share with).** Open the Plans editor and create & edit\nwith no sign-up — you work as a guest. Sign in only when you want to save or\nshare; signing in claims the plans you made as a guest into your account.\n\nSharing and commenting require an account: public/shared plans are viewable by\nanyone with the link, but commenting on them needs an agent-native account.\n\nFor fully offline, no-account use, run the Plans app locally and sync plans to\nyour repo as MDX. This local mode is a separate advanced path, not the default\nhosted flow.\n\nIf a Plans tool returns \\`needs auth\\`, \\`Unauthorized\\`, or \\`Session terminated\\`,\ndo not keep retrying the tool. Authenticate the connector with\n\\`agent-native connect https://plan.agent-native.com\\` (OAuth-capable hosts can\ninstead re-run /mcp and choose Authenticate), then continue once the connector\nis available.\n\nHosted default: connect \\`https://plan.agent-native.com/_agent-native/mcp\\`. Do\nnot put shared secrets in skill files.\n`;\n\nexport const UI_PLAN_SKILL_MD = `---\nname: ui-plan\ndescription: >-\n Use Agent-Native Plans for UI-first planning with an optional top pan/zoom\n wireframe canvas, a refined Notion-like document, rich tabs, diagrams,\n comments, drawing, and agent handoff.\nmetadata:\n visibility: exported\n---\n\n# UI Plan\n\nUse \\`/ui-plan\\` when the task is primarily about product UI, user flows,\ninteraction details, component layout, or visual direction. The reviewable UI\ncomes first; implementation detail comes after the user has something concrete to\nreact to.\n\n\\`/visual-plan\\` remains the general command for architecture, backend, refactors,\nand mixed work. Use \\`/prototype-plan\\` when the UI review needs a functional live\nprototype instead of static screens. Use \\`/plan-design\\` when polish, brand, or\nvisual fidelity are material to the decision. Use \\`/visual-questions\\` only when\nthe user explicitly wants visual intake before planning, and \\`/visualize-plan\\`\nwhen a text plan already exists.\n\n## Plan Discipline\n\n- **Gate hard.** Use a UI plan when the surface is new, ambiguous, spans several\n screens or states, or the direction needs agreement before coding. Skip it for\n cosmetic one-liners — a color, a label, a spacing tweak — and just make the\n change. Never ship a single-step or filler plan.\n- **Research before you draft.** Read the real components, routes, and design\n tokens first; ground every mockup and the file map in actual files and symbols.\n Delegate wide exploration to a sub-agent when the surface is large.\n- **Planning is read-only.** Make no source edits while building or reviewing.\n Start editing only after the user approves the UI direction.\n- **Clarify vs. assume.** Do not ask how to build the UI — present the direction\n and options as mockups and tabs. Ask a clarifying question only when an\n ambiguity would change the design; use the host agent's normal\n ask-user-question flow and batch 2-4 before finalizing. Do not call\n \\`create-visual-questions\\` from \\`/ui-plan\\`; keep answerable follow-up inside\n the same plan as a bottom \\`question-form\\` Open Questions block. Otherwise\n state the assumption in the plan and proceed.\n- **The plan is the approval gate.** Ask the user to review and approve the UI\n direction before you write code, and name the files/areas the work touches.\n\n## UI-First Workflow\n\n1. Follow the host agent's normal planning flow: inspect the codebase, gather\n the UI/component context needed, and ask native clarifying questions as needed\n before generating the plan.\n2. Call \\`create-ui-plan\\` with a UI-specific title, brief, source, repo path, and\n structured \\`content\\`. The canvas comes first, the document second.\n3. Compose the top canvas from the kit (see the cores below): the key artboards\n with real product content, designer notes, and connectors only for real\n sequences. Skip the canvas when wireframes would not clarify the work.\n4. Continue below as a concise technical document that stays close to the\n Markdown plan the agent would normally output — not a second copy of the\n canvas — covering concrete files, contracts, phases, risks, and validation.\n5. Call \\`get-plan-feedback\\` before implementation, after review, after a long\n pause, and before the final response. Treat \\`anchorDetails\\`, resolver intent,\n recent review events, and any focused screenshots from browser handoff as the\n source of truth for exactly what changed and exactly what each UI comment\n points at. Apply changes with \\`update-visual-plan\\`, preferring\n \\`contentPatches\\` for one frame, annotation, node, tab, or block. When the\n user wants source-control friendly edits, use \\`patch-visual-plan-source\\`\n against the MDX files instead of regenerating the plan.\n\n## Agent Handoff\n\nAfter the canvas and document, add a short handoff that names the chosen UI\ndirection, unresolved visual questions, and feedback that must be read before\ncode changes. Never claim feedback has been applied until \\`get-plan-feedback\\` or\nthe user has supplied it.\n\n<!-- SHARED-CORE:wireframe-canvas START -->\n\n## Wireframe & Canvas Core\n\nThis section is shared, word for word, by \\`/visual-plan\\`, \\`/ui-plan\\`, and\n\\`/visualize-plan\\`. It is the single source of truth for how wireframes and the\ncanvas work. Do not paraphrase it per command.\n\n**A wireframe is an HTML mockup. The renderer owns the look; you write the\ncontent.** Set \\`data.html\\` to a self-contained, semantic HTML fragment of the\nscreen and set \\`data.surface\\`. The renderer owns the surface footprint/aspect,\nthe dark/light theme, the hand-drawn font, and the rough.js sketch overlay — you\nnever write \\`<html>\\`/\\`<body>\\`/\\`<script>\\`/\\`<style>\\` tags, font-family, hex colors,\nor any width/height/coordinates. You write real HTML layout and real product\ncontent; the renderer styles and roughens it.\n\n**A wireframe block's data is an HTML screen plus a surface:**\n\n\\`\\`\\`json\n{\n \"surface\": \"browser\",\n \"html\": \"<div style=\\\\\"display:flex;flex-direction:column;gap:10px;padding:16px;height:100%\\\\\"><h1>Sign in</h1><p class=\\\\\"wf-muted\\\\\">Use your work email to continue.</p><div class=\\\\\"wf-card\\\\\" style=\\\\\"display:flex;flex-direction:column;gap:10px\\\\\"><label>Email<input value=\\\\\"jane@acme.co\\\\\" /></label><label>Password<input value=\\\\\"••••••••\\\\\" /></label><label style=\\\\\"display:flex;align-items:center;gap:8px\\\\\"><input type=\\\\\"checkbox\\\\\" checked /> Remember me</label><button class=\\\\\"primary\\\\\">Sign in</button></div><a href=\\\\\"#\\\\\">Forgot password?</a></div>\"\n}\n\\`\\`\\`\n\n**Write PLAIN semantic HTML and let the renderer style it.** Bare elements\n(\\`h1\\`/\\`h2\\`/\\`h3\\`, \\`p\\`, \\`button\\`, \\`input\\`, \\`<input type=\"checkbox\">\\`, \\`a\\`, \\`hr\\`)\nare auto-themed — no classes needed. Helper classes carry the rest:\n\n- \\`.wf-card\\` / \\`.wf-box\\` — a bordered, padded container (a panel, a list item).\n- \\`.wf-pill\\` / \\`.wf-chip\\` — a rounded tag or filter; add \\`.accent\\`\n (\\`<span class=\"wf-pill accent\">\\`) for the accent-filled variant.\n- \\`.wf-muted\\` — secondary/muted text (or use \\`<small>\\`).\n- \\`button.primary\\` or any element with \\`[data-primary]\\` — the accent-filled\n primary button.\n\n**Use the \\`--wf-*\\` tokens for any custom color, never hex.** The renderer flips\nthese on light/dark, so reading them is what keeps a mockup correct in both\nthemes. For any inline border, background, or text color, reference a token:\n\\`style=\"border:1.4px solid var(--wf-line)\"\\`. The tokens are \\`--wf-ink\\` (text),\n\\`--wf-muted\\` (secondary text), \\`--wf-line\\` (borders/dividers), \\`--wf-paper\\`\n(page background), \\`--wf-card\\` (raised surface), \\`--wf-accent\\` /\n\\`--wf-accent-fg\\` / \\`--wf-accent-soft\\` (brand action), \\`--wf-warn\\`, \\`--wf-ok\\`,\nand \\`--wf-radius\\`. Never hard-code a hex color and never set \\`font-family\\` — the\nrenderer owns the sketch/clean font.\n\n**Lay out with inline \\`style\\` flex/grid.** You write the real layout —\n\\`display:flex; flex-direction:column; gap:10px; padding:16px\\` and so on — and the\nrenderer never repositions anything. Compose the actual product: reproduce the\ncurrent screen, then show the modification. Real labels, real counts, real dates,\nreal button text grounded in the screen you read; not lorem or gray bars.\n\n**Surface presets — match the real footprint, never default to desktop+mobile.**\nPick the \\`surface\\` that matches what the user will actually see:\n\n- \\`browser\\`: a web page that needs a browser chrome frame around it.\n- \\`desktop\\`: a full desktop app page or app shell.\n- \\`mobile\\`: a phone screen, only when the work is genuinely mobile.\n- \\`popover\\`: a small floating menu, dropdown, or inline popover.\n- \\`panel\\`: a side panel, inspector, or sidebar widget.\n\nThe surface locks the footprint and aspect; never set width/height/coordinates.\nA sidebar popover renders as a small surface, not a desktop page and a phone\nframe. Do not emit \\`desktop\\` + \\`mobile\\` variants unless responsive behavior\nactually changes the layout. For a component or widget, show one broader\napp-context frame only when placement affects understanding, then the focused\ncomponent states.\n\n**Modify, don't redesign.** When the task changes an existing screen, reproduce\nthe current screen's real layout and footprint FIRST, then change only the delta\nand call it out with a single annotation. Do not restack the page into a new\nlayout. For net-new surfaces, compose from the real app shell.\n\n**Zoom in on sub-surfaces, don't redraw the page.** For a small sub-surface (a\npopover, menu, dialog, toast), show the full screen once, then add a small\nseparate artboard whose \\`html\\` contains ONLY that sub-surface — do not re-draw\nthe whole page around it, and do not scale a duplicate up. Pick the matching\n\\`surface\\` (e.g. \\`popover\\`) so the footprint is right; never widen a popover to\npage width.\n\n**Loading / skeleton states.** Set \\`data.skeleton: true\\` on the wireframe and\nfill the \\`html\\` with neutral, textless placeholder geometry — boxes and bars\nbuilt as \\`<div>\\`s with \\`background:var(--wf-line)\\` and explicit heights/widths,\nno labels or copy. The renderer drops borders, sketch, and color into the\nskeleton register automatically. Never escape to a \\`custom-html\\` document block\nto fake a loader, and never move a mockup out of the canvas — mockups always\nlive in canvas artboards.\n\n**Editing an existing mockup.** To change one element, text, or color in an\nexisting html mockup, do NOT regenerate the frame — call \\`update-visual-plan\\`\nwith \\`contentPatches: [{ op: \"patch-wireframe-html\", blockId, edits: [{ find,\nreplace }] }]\\`. Each \\`find\\` is a unique snippet of the current html (read it\nfirst with \\`get-visual-plan\\`); set \\`all: true\\` on an edit to replace every\noccurrence. The result is re-sanitized.\n\n**Canvas annotations are designer notes on the artboard.** When a top canvas is\npresent, sprinkle Figma-style notes near the frames they explain: a short\nheading, supporting text, and bullets — plain text layers, never bordered or\nshadowed cards, and never a box around a frame. The renderer spaces notes away\nfrom frames, so place each note by the frame it describes. Use an arrow only to\npoint at one specific control or transition; for a broad frame-level note, write\ntext beside the frame with no connector. Connectors are for real sequences only —\nnever fake \"Step 1 → Step 2\" lines between independent states.\n\n**Do not create overlapping annotations.** Anchor each note to the frame it\nexplains with \\`targetId\\` + \\`placement\\` (top/right/bottom/left). The renderer\nparks notes in a gutter beside the frame and lays them out automatically — never\nsupply x/y or points for anchored notes; hand-placed coordinates fight the\nauto-layout and cause the overlap you're trying to avoid. Reserve arrows for a\nnote that must point at a specific control inside a frame; a note that simply\nsits beside its frame needs no arrow.\n\n**Patching.** Edit one wireframe, canvas annotation, or block with targeted \\`contentPatches\\`\n(for example \\`update-block\\`, \\`replace-blocks\\`, \\`update-canvas-annotation\\`) rather\nthan regenerating the whole plan. \\`contentPatches\\` are part of the public MCP\naction schema, so Claude Code, Codex, Cursor, and other hosts can make surgical\nedits. If an agent is working from exported source files, use\n\\`read-visual-plan-source\\` / \\`patch-visual-plan-source\\`: \\`plan.mdx\\` holds\nfrontmatter plus markdown/document blocks, \\`canvas.mdx\\` holds\n\\`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\\`, and the\npatch action normalizes the MDX back into the same JSON runtime model. JSON is\nthe canonical runtime shape; MDX is the repo-friendly authoring/export surface.\nIn the browser, humans edit \\`rich-text\\` prose inline; agents should still use\n\\`update-rich-text\\` content patches or source patches for prose, and use\ncomments/structured patches for canvas, artboard, wireframe, and diagram edits.\n\n**Never emit a titled artboard with no interior wireframe content.** Every artboard you place on the canvas must carry an \\`html\\` wireframe (or reference a wireframe block via \\`blockId\\`) — a label-only frame renders as an empty dashed box and is rejected at parse time. If you only have a title, write it as a section header or annotation, not an empty artboard.\n\n**Fill the frame; keep labels short.** Each artboard is a fixed-size surface — compose enough realistic HTML to fill it top to bottom with even vertical rhythm; never leave a large empty band. On desktop/app-shell sidebars, let the nav stack flex to fill (\\`flex:1\\`) and add any persistent bottom action/status after it so the rail reads complete in taller frames. On mobile especially, flow real rows down the whole screen (status bar, header, then list/detail content) rather than a header floating above a gap. Keep every label short enough to sit on one line within its column — shorten the copy rather than relying on the frame to absorb it (long labels wrap or clip).\n\n**Good example — a contacts list, surface \\`browser\\`.** A small, real screen\ncomposed from the helper classes and tokens, layout in inline flex, no fonts or\nhex colors:\n\n\\`\\`\\`html\n<div style=\"display:flex;flex-direction:column;gap:12px;padding:16px;height:100%\">\n <div style=\"display:flex;align-items:center;justify-content:space-between\">\n <h1>Contacts</h1>\n <button class=\"primary\">New contact</button>\n </div>\n <div style=\"display:flex;gap:6px\">\n <span class=\"wf-pill accent\">All 128</span>\n <span class=\"wf-pill\">Favorites</span>\n <span class=\"wf-pill\">Archived</span>\n </div>\n <div class=\"wf-card\" style=\"display:flex;flex-direction:column;gap:0;padding:0\">\n <div style=\"display:flex;align-items:center;gap:10px;padding:10px 12px;border-bottom:1.4px solid var(--wf-line)\">\n <div style=\"width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)\"></div>\n <div style=\"flex:1\"><strong>Jane Cooper</strong><br /><small>jane@acme.co</small></div>\n <span class=\"wf-pill\">Lead</span>\n </div>\n <div style=\"display:flex;align-items:center;gap:10px;padding:10px 12px\">\n <div style=\"width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)\"></div>\n <div style=\"flex:1\"><strong>Marcus Lee</strong><br /><small>marcus@globex.io</small></div>\n <span class=\"wf-pill\">Customer</span>\n </div>\n </div>\n</div>\n\\`\\`\\`\n\n**Mockups belong in the top visual review area.** Static visuals live on the\ncanvas; multi-step flows get both canvas wireframes and a prototype. When the\nuser asks for a mockup, UI state, loading state, layout, screen, or visual\ncomparison, make the canvas the primary home for that static visual. When the\nuser asks for a prototype or the plan contains a sequence the reviewer must\nfeel, keep the canvas artboards and add \\`content.prototype\\` so the top surface\nshows Wireframes / Prototype tabs. Document blocks can explain, compare, or map\nimplementation, but they should not host the primary mockup or prototype just\nbecause \\`custom-html\\`, screenshots, or prose are easier to produce. If the\ncanvas/prototype surface cannot represent the requested fidelity, still keep the\nclosest top-surface representation and call out or extend the needed renderer\ncapability.\n\n**Legacy kit tree.** Older plans set a \\`screen\\` array of \\`{ el, ...props }\\` kit\nnodes instead of \\`html\\`; the renderer still accepts and displays it, but new\nplans emit \\`html\\`. Do not author fresh kit-tree screens — write the HTML mockup\ninstead. Likewise, old or imported plans may carry coordinate-based regions or\nfree-float x/y on notes or artboards; those are legacy escape hatches the\nrenderer still shows but you must never produce. The \\`surface\\` drives the aspect\nand footprint, the canvas auto-places artboards, and the gutter parks notes by\n\\`targetId\\` + \\`placement\\`; never supply width, height, or coordinates for a new\nplan.\n\n<!-- SHARED-CORE:wireframe-canvas END -->\n\n<!-- SHARED-CORE:document-quality START -->\n\n## Document Quality Core\n\nThis section is shared, word for word, by \\`/visual-plan\\`, \\`/ui-plan\\`, and\n\\`/visualize-plan\\`. It is the single source of truth for the document below the\ncanvas. Do not paraphrase it per command.\n\n**The document is a serious technical plan, not marketing.** Write it the way a\nstrong Claude or Codex implementation plan reads: outcome-first, prose-first,\nself-contained, and specific. State the objective and what \"done\" means, the\nscope and non-goals, the proposed approach with the key decisions and their\nrationale, ordered steps that name real files, symbols, actions, and data\nshapes, the risks, and a closing verification step (tests, build, or a checkable\nbehavior). Replace vague prose with specifics; never ship a step like \"make it\nwork.\" No hero art, gradients, logos, nav bars, slogans, value props, giant\nlanding-page headings, or marketing cards unless the user explicitly asks.\n\n**Top visuals and document never duplicate each other.** The UI story lives in\nthe top visual surface: canvas artboards for static inspection, plus prototype\ntabs when the flow should be functional. The document carries the technical depth\nthe visuals cannot show — concrete file/symbol maps, API and data contracts,\ncode snippets, migration or implementation phases, risks, and validation. Repeat\na wireframe in the document only for a genuinely new detail view or comparison.\nSkip the visual surface entirely for non-visual work and write a clean rich\ndocument.\n\n**Use the right block, and make it carry substance.** For the authoritative,\nmachine-checked list of block types and their data schemas, call \\`get-plan-blocks\\`\n— it returns the live registry vocabulary (type, MDX tag, placement, key fields)\nso you never emit a block the editor cannot render or round-trip:\n\n- \\`rich-text\\` for plan prose with real bold/italic/code/links and nested lists.\n- \\`implementation-map\\` / \\`code-tabs\\` for the file map: file path, the\n symbols/components to touch, the reason, risk/coordination notes, and a\n concise syntax-highlighted snippet of the code shape — never the whole file,\n never a prose-only file list.\n- \\`decision\\` for two or three option cards with consequences. These are static\n records; do not style them like clickable tabs or chips unless the renderer\n truly supports changing the selection.\n- \\`diagram\\` for architecture, sequence, data-flow, dependency, or state\n relationships, only when it clarifies something real. Labels must not overlap\n nodes, connectors, or each other.\n- \\`tabs\\` for multiple states, directions, or comparisons. A tab that reveals\n only prose usually means the plan is under-specified — include a relevant\n visual unless the tab is intentionally document-only.\n- \\`table\\`, \\`checklist\\`, \\`callout\\` for scannable structure.\n\n**Open questions live at the bottom as a form when answers would change the\nplan.** Surface answerable unresolved decisions in a final \\`question-form\\`\nblock titled \"Open Questions\". Use \\`single\\` or \\`multi\\` for clear choices,\n\\`freeform\\` for constraints, \\`recommended: true\\` for the default you would pick,\nand option \\`wireframe\\` / \\`diagram\\` previews for visual directions when useful.\nKeep non-answerable assumptions or risks as concise \\`callout\\` blocks in the\nrelevant section. Never bury a questions/decisions wall inside the plan\nnarrative.\n\n**\\`custom-html\\` is a bounded escape hatch only** — a single complete fragment\ninside a block, never \\`html\\`/\\`head\\`/\\`body\\`/\\`script\\` tags, never a generic\nplaceholder, density demo, or proof that custom HTML works. Prefer the native\nblocks for normal plans. It may support supplemental demos or references, but it\nis never the primary home for a requested mockup, UI state, or visual\ncomparison. If fidelity requires HTML/CSS, image capture, or real React/CSS, the\nproduct fix is canvas support for that artifact type, not moving the mockup into\nthe document.\n\n**Before handoff, open the plan and check it.** Fix overlap, excessive\nwhitespace, clipped fragments, misleading inactive controls, poor contrast, and\nunreadable diagrams before asking for approval.\n\n<!-- SHARED-CORE:document-quality END -->\n\n<!-- SHARED-CORE:exemplar START -->\n\n## Good vs. Bad Exemplar\n\n**GOOD.** A \\`/ui-plan\\` for a todo app: a canvas with a \\`desktop\\` artboard whose\n\\`data.html\\` is a real flex layout — a sidebar of links (\\`Inbox 12\\`, \\`Today 4\\`,\n\\`Done\\`), a main column with an \\`<h1>Today</h1>\\`, accent \\`.wf-pill\\`s for the\nfilters, a muted section label \\`OVERDUE\\`, and \\`.wf-card\\` task rows carrying real\ntitles, due dates, and a primary \\`button.primary\\` — styled only through bare\nelements, helper classes, and \\`--wf-*\\` tokens, so the renderer applies the\ncorrect desktop footprint, theme, and one subtle whole-frame wobble. Plain-text\ndesigner notes sit spaced off the frame, pointing only at the controls that need\nexplanation. Below it, a Claude/Codex-grade document: objective and\ndone-criteria, an \\`implementation-map\\` naming the real components and actions\nwith short highlighted snippets, a \\`decision\\` card weighing two real approaches,\nand a validation step — none of it repeating the canvas. If the task also\nchanges a multi-step completion flow, the same top area includes a Prototype tab\nwhose screens use the same labels and states as the canvas artboards, with\n\\`data-goto\\` controls for the sequence. This is the bar.\n\n**BAD.** A \\`data.html\\` with hard-coded hex colors, a \\`font-family\\`, or fixed\npixel width/height; gray placeholder bars \"insinuating\" text on a non-skeleton\nframe; a forced desktop + mobile pair for a popover; floating bordered\nannotation cards hugging the frames; a fresh hand-authored kit-tree \\`screen\\`\ninstead of \\`html\\`; a multi-step UI flow with only static frames and no prototype\ntab; a mockup escaped into a document \\`custom-html\\` block; and a marketing-style\ndocument with a hero heading and value props that just restates what the canvas\nalready shows. Never produce this.\n\n<!-- SHARED-CORE:exemplar END -->\n\n## Tool Guidance\n\n- \\`create-ui-plan\\`: create the UI-first structured visual plan.\n- \\`create-prototype-plan\\`: create a prototype-first plan when UI review needs a\n functional live prototype.\n- \\`create-plan-design\\`: create a full-fidelity branded design plan when polish,\n brand, and detailed visual direction are primary review inputs.\n- \\`convert-visual-plan-to-prototype\\`: convert an existing HTML wireframe canvas\n into a prototype plan.\n- \\`create-visual-questions\\`: use only for the explicit \\`/visual-questions\\`\n command, not as \\`/ui-plan\\` preflight.\n- \\`update-visual-plan\\`: revise content, mockups, comments, or handoff notes;\n prefer targeted \\`contentPatches\\`.\n- \\`read-visual-plan-source\\`: read the normalized plan as \\`plan.mdx\\`,\n optional \\`canvas.mdx\\`, optional \\`.plan-state.json\\`, and JSON.\n- \\`patch-visual-plan-source\\`: apply granular MDX AST patches by stable block,\n artboard, annotation, component, or wireframe-node id.\n- \\`import-visual-plan-source\\`: create or replace a plan from an MDX folder.\n- \\`get-visual-plan\\`: inspect the current structured plan, exported HTML, and\n annotations; it also returns the MDX folder for source workflows.\n- \\`get-plan-feedback\\`: read unconsumed reviewer comments before coding; it\n returns grouped threads, exact anchor details, expected resolver, and recent\n review-event payloads so agents can act only on the comments meant for them.\n- \\`export-visual-plan\\`: export HTML, Markdown fallback, structured JSON, and MDX\n files for repo check-in.\n\nWhen the user critiques a plan's look or structure, fix the renderer or this\nskill — never hand-edit one stored plan. Turn feedback into better guidance.\n\n## Setup & Authentication\n\nThere are two ways into Plans.\n\n**Coding agent (CLI).** Install once with the Agent-Native CLI. The command\ninstalls the Plans skills, registers the hosted Plans MCP connector, and\nauthenticates it in the same step (a one-time browser sign-in at setup — this is\nintended), so the first tool call does not hit an OAuth wall:\n\n\\`\\`\\`bash\nagent-native skills add visual-plan\n\\`\\`\\`\n\nAfter that, \\`/visual-plan\\` (and \\`/ui-plan\\`, \\`/prototype-plan\\`, \\`/plan-design\\`,\n\\`/visual-questions\\`, \\`/visualize-plan\\`) generate a plan and open the editor. Pass \\`--no-connect\\` to\nregister the connector without authenticating, then run\n\\`agent-native connect https://plan.agent-native.com\\` whenever you are ready.\n\n**Browser (people you share with).** Open the Plans editor and create & edit\nwith no sign-up — you work as a guest. Sign in only when you want to save or\nshare; signing in claims the plans you made as a guest into your account.\n\nSharing and commenting require an account: public/shared plans are viewable by\nanyone with the link, but commenting on them needs an agent-native account.\n\nFor fully offline, no-account use, run the Plans app locally and sync plans to\nyour repo as MDX. This local mode is a separate advanced path, not the default\nhosted flow.\n\nIf a Plans tool returns \\`needs auth\\`, \\`Unauthorized\\`, or \\`Session terminated\\`,\ndo not keep retrying the tool. Authenticate the connector with\n\\`agent-native connect https://plan.agent-native.com\\` (OAuth-capable hosts can\ninstead re-run /mcp and choose Authenticate), then continue once the connector\nis available.\n\nHosted default: connect \\`https://plan.agent-native.com/_agent-native/mcp\\`. Do\nnot put shared secrets in skill files.\n`;\n\nexport const PROTOTYPE_PLAN_SKILL_MD = `---\nname: prototype-plan\ndescription: >-\n Use Agent-Native Plans for /prototype-plan when work needs a functional\n prototype-first plan, static mocks, comments, review toggles, or conversion\n from a visual plan.\nmetadata:\n visibility: exported\n---\n\n# Prototype Plan\n\n\\`/prototype-plan\\` creates a plan whose primary review surface is a live,\nfunctional prototype above the document. Use it when the user needs to feel a\nflow, operate basic UI state, or comment on interaction before implementation\nhardens the decision.\n\n## Rule\n\nMake the prototype answer a concrete question. The plan should say what is being\ntested, show the functional prototype first, then keep static mocks and implementation\nnotes in the document below.\n\n## When To Use\n\nUse \\`/prototype-plan\\` when the user asks for a prototype, wants to click through\nand operate UI states, needs design review before code, wants comments pinned to\nlive screens, or asks to move a visual plan into a prototype.\n\nPrefer \\`/visual-plan\\` for architecture, data flow, or non-interactive planning.\nPrefer \\`/ui-plan\\` when static screen review is enough. Use \\`/visualize-plan\\`\nfirst only when the user hands you an existing Markdown/Codex/Claude plan that\nneeds a visual companion before becoming interactive.\n\n## Core Workflow\n\n1. Inspect the real codebase and decide the question the prototype should\n answer. Good examples: \"Does this onboarding flow feel short enough?\" or\n \"Which dashboard density should we implement?\"\n2. Call \\`create-prototype-plan\\` with a title, brief, and screen HTML. Default to\n one functional prototype screen when local UI behavior is enough; use 2-4\n screens only for true routes, steps, or materially different contexts. The\n returned plan opens with the prototype viewer on top and static mocks, flow\n diagram, implementation map, and verification below.\n3. Make controls actually work. Use the renderer's safe Alpine-like directives:\n \\`x-data\\`, \\`x-model\\`, \\`x-for\\`, \\`x-text\\`, \\`x-show\\`, \\`:class\\`, \\`@click\\`, and\n \\`@keydown.enter\\`. Use safe helper verbs such as \\`remove(list, item)\\`,\n \\`setAll(list, 'done', true)\\`, \\`removeWhere(list, 'done', true)\\`, and counters\n such as \\`count(list)\\`, \\`countWhere(list, 'done', true)\\`, and\n \\`remaining(list, 'done')\\` when they help. Use \\`data-goto=\"screen-id\"\\` only\n for true screen/route changes, not for every button press.\n4. Show important app feedback inside the prototype itself: selected filters,\n checked rows, typed drafts, validation messages, permissions, progress, or\n empty states.\n5. Surface the returned Plans link and ask the user to click through, comment on\n the prototype or static mocks, and approve the direction before code changes.\n6. Before implementing or revising, call \\`get-plan-feedback\\`. Treat prototype\n anchors, screenshots, and resolver intent as the source of truth.\n7. Update with \\`update-visual-plan\\` content patches. Use\n \\`patch-prototype-html\\`, \\`update-prototype-screen\\`, or \\`set-prototype\\` for\n targeted prototype edits instead of regenerating the whole plan.\n\n## Converting A Visual Plan\n\nWhen a visual plan already has HTML canvas wireframes, call\n\\`convert-visual-plan-to-prototype\\` with the plan id. This derives prototype\nscreens from the canvas frames, preserves the canvas/static mocks by default,\nand changes the top review surface to the prototype viewer.\n\nUse \\`removeCanvas: true\\` only when the user explicitly wants the old canvas\ngone. Otherwise keep static mocks available for source export and detailed\nreview.\n\n## Prototype Screen HTML\n\nWrite bounded semantic HTML fragments only:\n\n\\`\\`\\`html\n<div style=\"display:flex;flex-direction:column;gap:14px;padding:18px;height:100%\">\n <header style=\"display:flex;justify-content:space-between;gap:12px\">\n <div>\n <h1>Launch checklist</h1>\n <p class=\"wf-muted\">Reviewer can add, complete, filter, and remove tasks.</p>\n </div>\n <span class=\"wf-pill accent\">Live prototype</span>\n </header>\n <section\n class=\"wf-card\"\n x-data=\"{ draft: '', filter: 'all', todos: [{ text: 'Check copy', done: false }, { text: 'Confirm owner', done: true }] }\"\n style=\"display:flex;flex-direction:column;gap:10px\"\n >\n <div style=\"display:flex;gap:8px\">\n <input x-model=\"draft\" @keydown.enter=\"draft && todos.push({ text: draft, done: false }); draft = ''\" placeholder=\"Add task\" />\n <button class=\"primary\" @click=\"draft && todos.push({ text: draft, done: false }); draft = ''\">Add</button>\n </div>\n <div style=\"display:flex;gap:8px\">\n <button @click=\"filter = 'all'\" :class=\"{ primary: filter === 'all' }\">All</button>\n <button @click=\"filter = 'done'\" :class=\"{ primary: filter === 'done' }\">Done</button>\n <button @click=\"setAll(todos, 'done', true)\">Mark all done</button>\n </div>\n <p class=\"wf-muted\"><span x-text=\"remaining(todos, 'done')\"></span> open / <span x-text=\"count(todos)\"></span> total</p>\n <div\n class=\"wf-box\"\n x-for=\"todo in todos\"\n x-show=\"filter === 'all' || (filter === 'done' && todo.done)\"\n :class=\"{ 'is-done': todo.done }\"\n style=\"display:flex;justify-content:space-between;gap:10px\"\n >\n <label style=\"display:flex;gap:8px\"><input type=\"checkbox\" x-model=\"todo.done\" /><span x-text=\"todo.text\"></span></label>\n <button @click=\"remove(todos, todo)\">Remove</button>\n </div>\n <button @click=\"removeWhere(todos, 'done', true)\">Clear completed</button>\n </section>\n</div>\n\\`\\`\\`\n\nUse real labels, counts, dates, and controls grounded in the target app. Keep\nsurfaces honest: \\`browser\\` for web pages, \\`desktop\\` for app shells, \\`mobile\\`\nonly for real mobile work, \\`panel\\` for side panels, and \\`popover\\` for menus.\n\nDo not include \\`<html>\\`, \\`<body>\\`, \\`<script>\\`, \\`<style>\\`, browser \\`on*\\`\nhandler attributes such as \\`onclick\\`, fake APIs, raw secrets, or customer data.\nThe renderer owns sketchy/clean mode, theme, surface sizing, rough outlines, and\ncomment overlays.\n\n## Review Surface\n\nPrototype plans support:\n\n- real local controls through safe prototype directives\n- optional screen/route transitions from \\`data-goto\\`\n- rough vs clean mode through the shared wireframe toggle\n- dark vs light mode through the shared theme toggle\n- comment visibility from the prototype toolbar\n- Figma-style comments pinned directly on live prototype screens\n- a popout URL with \\`?prototype=1\\` for focused browser review\n- static wireframe mocks in the document body where they help implementation\n\n## Source Files\n\nRuntime JSON is canonical. Source export uses:\n\n- \\`plan.mdx\\` for document blocks\n- \\`prototype.mdx\\` for \\`<Prototype>\\`, \\`<PrototypeScreen>\\`, and\n \\`<PrototypeTransition>\\`\n- \\`canvas.mdx\\` for static mocks when a canvas is present\n- \\`.plan-state.json\\` for persisted viewport state\n\nPatch source with \\`patch-visual-plan-source\\` only when the user wants\nsource-control friendly edits. Patch runtime content when the user is simply\nreviewing and iterating.\n\n## Related Skills\n\n- \\`visual-plan\\`\n- \\`ui-plan\\`\n- \\`visualize-plan\\`\n- \\`visual-questions\\`\n`;\n\nexport const PLAN_DESIGN_SKILL_MD =\n [\n \"---\",\n \"name: plan-design\",\n \"description: >-\",\n \" Use Agent-Native Plans for full-fidelity UI design planning with a Design\",\n \" canvas tab and optional interactive Prototype tab before implementation.\",\n \"metadata:\",\n \" visibility: exported\",\n \"---\",\n \"\",\n \"# Plan Design\",\n \"\",\n \"Use `/plan-design` when the user needs a high-fidelity product design before\",\n \"implementation: polished branded screens, realistic content, visual direction,\",\n \"and interaction review. It is the full-fidelity companion to `/visual-plan` and\",\n \"`/prototype-plan`: the top review surface should show `Design` and, when the\",\n \"flow needs interaction, `Prototype`.\",\n \"\",\n \"## When To Use\",\n \"\",\n \"Use this for UI-heavy work where brand, visual hierarchy, polished layout, or\",\n \"interaction feel are material to the decision. Skip it for small copy, spacing,\",\n \"or obvious component changes.\",\n \"\",\n \"## Research First\",\n \"\",\n \"Before creating the plan:\",\n \"\",\n \"1. Inspect the real app shell, routes, components, CSS variables, Tailwind\",\n \" tokens, theme files, and any relevant screenshots.\",\n \"2. If `design.md` exists, treat it as the primary design brief and pass its\",\n \" important content into `create-plan-design.designMd`.\",\n \"3. If a `.fig` local-copy file or parsed brand kit is available, use the\",\n \" Design/brand-kit parsing actions from the app or shared tooling first, then\",\n \" pass the extracted token summary into `brandKit`.\",\n \"4. Parse existing codebase style info when possible: CSS custom properties,\",\n \" Tailwind config, global CSS, font declarations, spacing/radius tokens, and\",\n \" component conventions. Pass the compact evidence into `codebaseStyles`.\",\n \"5. Ground every screen in actual product content. Avoid lorem ipsum, generic\",\n \" marketing filler, and placeholder gray boxes unless designing an explicit\",\n \" loading state.\",\n \"\",\n \"## Create The Plan\",\n \"\",\n \"Call `create-plan-design` with:\",\n \"\",\n \"- `title`, `brief`, `repoPath`, and any `implementationNotes`.\",\n \"- `designMd`, `brandKit`, `codebaseStyles`, or `designNotes` when available.\",\n \"- `screens`: one to six full-fidelity HTML/CSS screen fragments. Each screen\",\n \" must include a bounded `html` fragment, optional scoped `css`, a `surface`,\",\n \" and stable `data-design-id` attributes on elements a reviewer might edit.\",\n \"- `transitions` only when the Prototype tab should support true screen/step\",\n ' navigation. Use `data-goto=\"screen-id\"` in the screen HTML for those controls.',\n \"\",\n \"The Design tab is the visual source of truth. The Prototype tab is for behavior\",\n \"and should reuse the same visual styling where practical. Do not create a\",\n \"separate design direction in the prototype.\",\n \"\",\n \"## Full-Fidelity HTML Rules\",\n \"\",\n \"- Write bounded fragments only: no `<html>`, `<head>`, `<body>`, `<script>`,\",\n \" `<style>`, external imports, iframes, SVG, or executable URLs.\",\n \"- Put CSS in the screen `css` field. The renderer scopes it to the artboard.\",\n \"- Use real CSS and CSS variables. Tailwind-like class names are fine only when\",\n \" the provided `css` defines them or the classes are harmless semantic hooks.\",\n '- Use `renderMode: \"design\"` on design screen data when authoring full',\n \" structured content directly.\",\n '- Add `data-design-id=\"meaningful-name\"` to editable elements such as hero',\n \" panels, key buttons, cards, nav items, pricing rows, chart panels, and state\",\n \" chips. Keep ids stable and descriptive.\",\n \"- Keep the design responsive within the selected surface. Text must not clip,\",\n \" overlap, or rely on viewport-sized type.\",\n \"\",\n \"## Targeted Style Edits\",\n \"\",\n \"When a reviewer selects an element in the Design tab or asks for a specific\",\n \"style change, avoid regenerating the whole plan. Use:\",\n \"\",\n \"```json\",\n \"{\",\n ' \"op\": \"update-design-element-style\",',\n ' \"frameId\": \"frame-overview\",',\n ' \"elementId\": \"primary-cta\",',\n ' \"styles\": {',\n ' \"background-color\": \"#0f766e\",',\n ' \"border-radius\": \"10px\"',\n \" }\",\n \"}\",\n \"```\",\n \"\",\n \"Use `frameId` for inline canvas designs or `blockId` for a referenced wireframe\",\n \"block. Set a style value to `null` to remove it. Use `patch-wireframe-html` or\",\n \"`patch-prototype-html` for text/content changes inside a fragment.\",\n \"\",\n \"## Document Handoff\",\n \"\",\n \"Below the visual surface, keep the document concise and implementation-oriented:\",\n \"actual files and symbols, state/actions/contracts, open questions, risks, and\",\n \"verification. The document should not repeat the same screens in prose.\",\n \"\",\n \"Before implementation, call `get-plan-feedback` and treat comments, selected\",\n \"element details, and recent review events as the source of truth.\",\n \"\",\n \"## Related Skills\",\n \"\",\n \"- `visual-plan`\",\n \"- `ui-plan`\",\n \"- `prototype-plan`\",\n \"- `frontend-design`\",\n ].join(\"\\n\") + \"\\n\";\n\nexport const VISUAL_QUESTIONS_SKILL_MD = `---\nname: visual-questions\ndescription: >-\n Use Agent-Native Plans to ask rich visual intake questions when\n /visual-questions is explicitly requested before creating a UI plan or visual\n plan.\nmetadata:\n visibility: both\n---\n\n# Visual Questions\n\nUse \\`/visual-questions\\` when the next best step is not a plan yet, but a\nreviewable visual intake: single-choice chips, multi-select chips, freeform\nnotes, mockup choices, sketch diagrams, and a generated answer summary that feeds\nthe next planning prompt. It composes with \\`/visual-plan\\`, \\`/ui-plan\\`,\n\\`/prototype-plan\\`, \\`/plan-design\\`, and \\`/visualize-plan\\`.\n\n## When To Use\n\n- The user asks to be shown options before the agent writes a plan.\n- UI direction, form factor, layout model, feature set, or visual style is fuzzy\n enough that 2-6 answers would materially change the plan.\n- The user would benefit from choosing between visual mockups or diagrams rather\n than answering text-only prompts.\n\nGate hard: skip this for tiny, unambiguous changes. If the agent can reasonably\ninfer the answer, prefer \\`/ui-plan\\`, \\`/prototype-plan\\`, \\`/plan-design\\`, or\n\\`/visual-plan\\` directly and put assumptions in the plan.\n\nVisual questions are an explicit intake command, not an automatic preflight for\n\\`/visual-plan\\`, \\`/ui-plan\\`, \\`/prototype-plan\\`, or \\`/plan-design\\`.\n\n## Workflow\n\n1. Call \\`create-visual-questions\\` with a clear title, brief, source, and repo\n path when known.\n2. Omit \\`questions\\` for the default UI intake. Provide a custom \\`questions\\` array\n only when the task has domain-specific choices.\n3. Surface the returned Plans link and ask the user to answer visually.\n4. The generated summary drives the next step: \\`create-ui-plan\\` for static UI\n review, \\`create-prototype-plan\\` for click-through UI flows,\n \\`create-plan-design\\` for high-fidelity branded UI review,\n \\`create-visual-plan\\` for general plans, \\`visualize-plan\\` when a text plan\n already exists, or \\`update-visual-plan\\` with targeted \\`contentPatches\\` to\n fold answers into an active plan.\n5. If the user leaves comments, call \\`get-plan-feedback\\` before using the answers.\n\n## Question Types\n\nSupported \\`questions\\` entries:\n\n- \\`single\\`: chip group where one option wins.\n- \\`multi\\`: chip group where multiple options can be selected.\n- \\`freeform\\`: textarea for constraints, inspirations, or things to avoid.\n- \\`visual\\`: visual options with sketch previews — use for layout direction, flow\n depth, surface choice, or diagram choices.\n\nEach option can include \\`label\\`, \\`value\\`, \\`description\\`, \\`recommended\\`,\n\\`preview\\`, and \\`bullets\\`. Valid \\`preview\\` values match the wireframe surfaces:\n\\`desktop\\`, \\`mobile\\`, \\`popover\\`, \\`panel\\`, \\`component\\`, \\`split\\`, \\`flow\\`, and\n\\`diagram\\`. Pick the preview that matches the real footprint — do not offer a\ndesktop/mobile pair for a popover, panel, or component.\n\n## Quality Bar\n\n- Ask only decision-changing questions. A beautiful form with low-value questions\n is still friction.\n- Prefer visible, answerable options over abstract prose.\n- Use visual tabs when users need to compare layout or flow shapes.\n- Keep the output calm and document-like, not a landing page.\n- The generated answer summary is not the final plan; it is the intake prompt for\n the next agent step.\n\n## Tool Guidance\n\n- \\`create-visual-questions\\`: create the interactive intake plan.\n- \\`get-visual-plan\\`: inspect the current visual question plan.\n- \\`get-plan-feedback\\`: read comments before creating or updating the next plan.\n- \\`create-ui-plan\\`: create a UI-first plan from the answers.\n- \\`create-prototype-plan\\`: create a prototype-first plan from the answers when\n interaction feel matters.\n- \\`create-plan-design\\`: create a high-fidelity branded design plan from the\n answers when visual polish is the primary review input.\n- \\`create-visual-plan\\`: create a general visual plan from the answers.\n- \\`visualize-plan\\`: enrich an existing text plan after answers are gathered.\n- \\`export-visual-plan\\`: export answer plans as HTML, Markdown fallback,\n structured JSON, and MDX files when the intake needs to be checked into a repo.\n- \\`read-visual-plan-source\\` / \\`patch-visual-plan-source\\`: inspect or patch the\n MDX source if another agent is operating from checked-in plan files.\n\n## Setup & Authentication\n\nThere are two ways into Plans.\n\n**Coding agent (CLI).** Install once with the Agent-Native CLI. The command\ninstalls the Plans skills, registers the hosted Plans MCP connector, and\nauthenticates it in the same step (a one-time browser sign-in at setup — this is\nintended), so the first tool call does not hit an OAuth wall:\n\n\\`\\`\\`bash\nagent-native skills add visual-plan\n\\`\\`\\`\n\nAfter that, \\`/visual-plan\\` (and \\`/ui-plan\\`, \\`/prototype-plan\\`, \\`/plan-design\\`,\n\\`/visual-questions\\`, \\`/visualize-plan\\`) generate a plan and open the editor. Pass \\`--no-connect\\` to\nregister the connector without authenticating, then run\n\\`agent-native connect https://plan.agent-native.com\\` whenever you are ready.\n\n**Browser (people you share with).** Open the Plans editor and create & edit\nwith no sign-up — you work as a guest. Sign in only when you want to save or\nshare; signing in claims the plans you made as a guest into your account.\n\nSharing and commenting require an account: public/shared plans are viewable by\nanyone with the link, but commenting on them needs an agent-native account.\n\nFor fully offline, no-account use, run the Plans app locally and sync plans to\nyour repo as MDX. This local mode is a separate advanced path, not the default\nhosted flow.\n\nIf a Plans tool returns \\`needs auth\\`, \\`Unauthorized\\`, or \\`Session terminated\\`,\ndo not keep retrying the tool. Authenticate the connector with\n\\`agent-native connect https://plan.agent-native.com\\` (OAuth-capable hosts can\ninstead re-run /mcp and choose Authenticate), then continue once the connector\nis available.\n\nHosted default: connect \\`https://plan.agent-native.com/_agent-native/mcp\\`. Do\nnot put shared secrets in skill files.\n`;\n\nexport const VISUALIZE_PLAN_SKILL_MD = `---\nname: visualize-plan\ndescription: >-\n Convert an existing Codex, Claude Code, Markdown, or pasted plan into an\n Agent-Native Plans visual companion with diagrams, wireframes, prototypes,\n annotations, and feedback.\nmetadata:\n visibility: exported\n---\n\n# Visualize Plan\n\nUse \\`/visualize-plan\\` when a plan already exists and the user wants it easier to\nreview. The native Codex or Claude Code plan can stay where it is; Agent-Native\nPlans creates a structured visual companion beside it — diagrams, wireframes,\nstate sketches, functional prototypes, option cards, and comment prompts instead\nof a wall of text. It still reads like a plan, not a marketing page.\n\nUse \\`/prototype-plan\\` instead when the user wants a functional prototype as the first\nartifact and there is no text plan to preserve. When a text plan already exists,\n\\`/visualize-plan\\` should decide whether it needs no visual surface, canvas only,\nor canvas + prototype; call \\`convert-visual-plan-to-prototype\\` after\nvisualization when its HTML wireframes should drive a prototype review.\n\n## Plan Discipline\n\n- **Gate hard.** A visual companion is worth it only when the source plan is\n long, risky, or hard to react to as text. If the source plan is for trivial,\n unambiguous work, skip the companion and just implement.\n- **Stay grounded and read-only.** Preserve the source plan's intent, do not\n invent codebase facts, and label anything inferred as inferred. Make no source\n edits while building or reviewing the companion.\n- **The companion is the approval gate.** Ask the user to review and approve the\n direction before you write code, and name which files/areas the work touches.\n Carry answerable unresolved assumptions and open questions into a bottom\n \\`question-form\\` block instead of guessing silently.\n\n## Workflow\n\n1. Gather the existing plan text from the user's paste, a referenced file, or\n recent visible agent context. Do not invent the source plan. If no plan text\n exists and the work is UI-heavy, use \\`/ui-plan\\` or \\`/prototype-plan\\` instead.\n2. Call \\`visualize-plan\\` with \\`planText\\`, \\`title\\`, \\`brief\\`, \\`source\\`, and\n \\`repoPath\\` when available.\n3. Surface the returned Plans link or inline MCP App.\n4. Decide the top visual surface with the rules below, then enrich the import\n with \\`update-visual-plan\\` (prefer targeted \\`contentPatches\\`): add canvas\n wireframes for user-visible UI, add \\`content.prototype\\` for multi-step flows,\n add diagrams for architecture or data flow, add option cards for real\n tradeoffs, and add explicit open questions. Apply the two cores below — the\n companion must meet the same quality bar as a fresh plan, not be a thinner\n ruleset. Label inferred visuals as inferred. When the user wants\n source-control friendly edits, use \\`patch-visual-plan-source\\` against the MDX\n files instead of regenerating the plan. If the user asks to make the visual\n companion functional and the canvas contains HTML wireframes, call\n \\`convert-visual-plan-to-prototype\\`.\n5. Ask the user to react, then call \\`get-plan-feedback\\` before implementing,\n after review, and before the final response.\n6. Treat imported text as source material. The structured visual plan and\n comments are the review surface; HTML is the export receipt. Do not replace a\n native plan unless the user asks.\n\n## Visual Surface Choice\n\nChoose the surface after reading the source plan and before enriching it. Do not\nadd visual chrome by default:\n\n- **No visual surface** when the imported plan is architecture-only,\n backend-only, data migration, copy-only, or otherwise non-visual. Keep the\n companion as a strong document and add diagrams only when relationships need a\n visual explanation.\n- **Canvas only** when the source plan includes one static screen, a before/after\n comparison, a component state, a small popover, or a visual direction that does\n not require clicking. Put those wireframes in \\`content.canvas\\` and omit\n \\`content.prototype\\`.\n- **Canvas + prototype** when the source plan describes a multi-step UI flow,\n meaningful interactive app behavior, onboarding, wizard, review/approval flow,\n navigation change, or any sequence the reviewer needs to operate. Keep the\n static wireframes in\n \\`content.canvas\\`, add the aligned functional prototype in\n \\`content.prototype\\`, and rely on the top visual tabs to switch between them.\n- **Prototype-first conversion** when an already-visualized plan's HTML\n wireframes should become functional. Use \\`convert-visual-plan-to-prototype\\` for\n an existing canvas, or \\`update-visual-plan\\` with \\`set-prototype\\` when the\n imported plan needs a hand-authored prototype that does not map cleanly from\n the canvas. Keep static mocks unless the user explicitly asks to remove them.\n\nFor mixed canvas + prototype companions, reuse the same real labels, states, and\nscreen ids across both surfaces. The canvas is the inspectable static reference;\nthe prototype is the interactive version of that same flow, not a separate\ndesign direction. If the imported plan only has text, add HTML wireframes before\ncalling \\`convert-visual-plan-to-prototype\\`; never convert a diagram-only or\nempty canvas into a fake prototype.\n\n<!-- SHARED-CORE:wireframe-canvas START -->\n\n## Wireframe & Canvas Core\n\nThis section is shared, word for word, by \\`/visual-plan\\`, \\`/ui-plan\\`, and\n\\`/visualize-plan\\`. It is the single source of truth for how wireframes and the\ncanvas work. Do not paraphrase it per command.\n\n**A wireframe is an HTML mockup. The renderer owns the look; you write the\ncontent.** Set \\`data.html\\` to a self-contained, semantic HTML fragment of the\nscreen and set \\`data.surface\\`. The renderer owns the surface footprint/aspect,\nthe dark/light theme, the hand-drawn font, and the rough.js sketch overlay — you\nnever write \\`<html>\\`/\\`<body>\\`/\\`<script>\\`/\\`<style>\\` tags, font-family, hex colors,\nor any width/height/coordinates. You write real HTML layout and real product\ncontent; the renderer styles and roughens it.\n\n**A wireframe block's data is an HTML screen plus a surface:**\n\n\\`\\`\\`json\n{\n \"surface\": \"browser\",\n \"html\": \"<div style=\\\\\"display:flex;flex-direction:column;gap:10px;padding:16px;height:100%\\\\\"><h1>Sign in</h1><p class=\\\\\"wf-muted\\\\\">Use your work email to continue.</p><div class=\\\\\"wf-card\\\\\" style=\\\\\"display:flex;flex-direction:column;gap:10px\\\\\"><label>Email<input value=\\\\\"jane@acme.co\\\\\" /></label><label>Password<input value=\\\\\"••••••••\\\\\" /></label><label style=\\\\\"display:flex;align-items:center;gap:8px\\\\\"><input type=\\\\\"checkbox\\\\\" checked /> Remember me</label><button class=\\\\\"primary\\\\\">Sign in</button></div><a href=\\\\\"#\\\\\">Forgot password?</a></div>\"\n}\n\\`\\`\\`\n\n**Write PLAIN semantic HTML and let the renderer style it.** Bare elements\n(\\`h1\\`/\\`h2\\`/\\`h3\\`, \\`p\\`, \\`button\\`, \\`input\\`, \\`<input type=\"checkbox\">\\`, \\`a\\`, \\`hr\\`)\nare auto-themed — no classes needed. Helper classes carry the rest:\n\n- \\`.wf-card\\` / \\`.wf-box\\` — a bordered, padded container (a panel, a list item).\n- \\`.wf-pill\\` / \\`.wf-chip\\` — a rounded tag or filter; add \\`.accent\\`\n (\\`<span class=\"wf-pill accent\">\\`) for the accent-filled variant.\n- \\`.wf-muted\\` — secondary/muted text (or use \\`<small>\\`).\n- \\`button.primary\\` or any element with \\`[data-primary]\\` — the accent-filled\n primary button.\n\n**Use the \\`--wf-*\\` tokens for any custom color, never hex.** The renderer flips\nthese on light/dark, so reading them is what keeps a mockup correct in both\nthemes. For any inline border, background, or text color, reference a token:\n\\`style=\"border:1.4px solid var(--wf-line)\"\\`. The tokens are \\`--wf-ink\\` (text),\n\\`--wf-muted\\` (secondary text), \\`--wf-line\\` (borders/dividers), \\`--wf-paper\\`\n(page background), \\`--wf-card\\` (raised surface), \\`--wf-accent\\` /\n\\`--wf-accent-fg\\` / \\`--wf-accent-soft\\` (brand action), \\`--wf-warn\\`, \\`--wf-ok\\`,\nand \\`--wf-radius\\`. Never hard-code a hex color and never set \\`font-family\\` — the\nrenderer owns the sketch/clean font.\n\n**Lay out with inline \\`style\\` flex/grid.** You write the real layout —\n\\`display:flex; flex-direction:column; gap:10px; padding:16px\\` and so on — and the\nrenderer never repositions anything. Compose the actual product: reproduce the\ncurrent screen, then show the modification. Real labels, real counts, real dates,\nreal button text grounded in the screen you read; not lorem or gray bars.\n\n**Surface presets — match the real footprint, never default to desktop+mobile.**\nPick the \\`surface\\` that matches what the user will actually see:\n\n- \\`browser\\`: a web page that needs a browser chrome frame around it.\n- \\`desktop\\`: a full desktop app page or app shell.\n- \\`mobile\\`: a phone screen, only when the work is genuinely mobile.\n- \\`popover\\`: a small floating menu, dropdown, or inline popover.\n- \\`panel\\`: a side panel, inspector, or sidebar widget.\n\nThe surface locks the footprint and aspect; never set width/height/coordinates.\nA sidebar popover renders as a small surface, not a desktop page and a phone\nframe. Do not emit \\`desktop\\` + \\`mobile\\` variants unless responsive behavior\nactually changes the layout. For a component or widget, show one broader\napp-context frame only when placement affects understanding, then the focused\ncomponent states.\n\n**Modify, don't redesign.** When the task changes an existing screen, reproduce\nthe current screen's real layout and footprint FIRST, then change only the delta\nand call it out with a single annotation. Do not restack the page into a new\nlayout. For net-new surfaces, compose from the real app shell.\n\n**Zoom in on sub-surfaces, don't redraw the page.** For a small sub-surface (a\npopover, menu, dialog, toast), show the full screen once, then add a small\nseparate artboard whose \\`html\\` contains ONLY that sub-surface — do not re-draw\nthe whole page around it, and do not scale a duplicate up. Pick the matching\n\\`surface\\` (e.g. \\`popover\\`) so the footprint is right; never widen a popover to\npage width.\n\n**Loading / skeleton states.** Set \\`data.skeleton: true\\` on the wireframe and\nfill the \\`html\\` with neutral, textless placeholder geometry — boxes and bars\nbuilt as \\`<div>\\`s with \\`background:var(--wf-line)\\` and explicit heights/widths,\nno labels or copy. The renderer drops borders, sketch, and color into the\nskeleton register automatically. Never escape to a \\`custom-html\\` document block\nto fake a loader, and never move a mockup out of the canvas — mockups always\nlive in canvas artboards.\n\n**Editing an existing mockup.** To change one element, text, or color in an\nexisting html mockup, do NOT regenerate the frame — call \\`update-visual-plan\\`\nwith \\`contentPatches: [{ op: \"patch-wireframe-html\", blockId, edits: [{ find,\nreplace }] }]\\`. Each \\`find\\` is a unique snippet of the current html (read it\nfirst with \\`get-visual-plan\\`); set \\`all: true\\` on an edit to replace every\noccurrence. The result is re-sanitized.\n\n**Canvas annotations are designer notes on the artboard.** When a top canvas is\npresent, sprinkle Figma-style notes near the frames they explain: a short\nheading, supporting text, and bullets — plain text layers, never bordered or\nshadowed cards, and never a box around a frame. The renderer spaces notes away\nfrom frames, so place each note by the frame it describes. Use an arrow only to\npoint at one specific control or transition; for a broad frame-level note, write\ntext beside the frame with no connector. Connectors are for real sequences only —\nnever fake \"Step 1 → Step 2\" lines between independent states.\n\n**Do not create overlapping annotations.** Anchor each note to the frame it\nexplains with \\`targetId\\` + \\`placement\\` (top/right/bottom/left). The renderer\nparks notes in a gutter beside the frame and lays them out automatically — never\nsupply x/y or points for anchored notes; hand-placed coordinates fight the\nauto-layout and cause the overlap you're trying to avoid. Reserve arrows for a\nnote that must point at a specific control inside a frame; a note that simply\nsits beside its frame needs no arrow.\n\n**Patching.** Edit one wireframe, canvas annotation, or block with targeted \\`contentPatches\\`\n(for example \\`update-block\\`, \\`replace-blocks\\`, \\`update-canvas-annotation\\`) rather\nthan regenerating the whole plan. \\`contentPatches\\` are part of the public MCP\naction schema, so Claude Code, Codex, Cursor, and other hosts can make surgical\nedits. If an agent is working from exported source files, use\n\\`read-visual-plan-source\\` / \\`patch-visual-plan-source\\`: \\`plan.mdx\\` holds\nfrontmatter plus markdown/document blocks, \\`canvas.mdx\\` holds\n\\`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>\\`, and the\npatch action normalizes the MDX back into the same JSON runtime model. JSON is\nthe canonical runtime shape; MDX is the repo-friendly authoring/export surface.\nIn the browser, humans edit \\`rich-text\\` prose inline; agents should still use\n\\`update-rich-text\\` content patches or source patches for prose, and use\ncomments/structured patches for canvas, artboard, wireframe, and diagram edits.\n\n**Never emit a titled artboard with no interior wireframe content.** Every artboard you place on the canvas must carry an \\`html\\` wireframe (or reference a wireframe block via \\`blockId\\`) — a label-only frame renders as an empty dashed box and is rejected at parse time. If you only have a title, write it as a section header or annotation, not an empty artboard.\n\n**Fill the frame; keep labels short.** Each artboard is a fixed-size surface — compose enough realistic HTML to fill it top to bottom with even vertical rhythm; never leave a large empty band. On desktop/app-shell sidebars, let the nav stack flex to fill (\\`flex:1\\`) and add any persistent bottom action/status after it so the rail reads complete in taller frames. On mobile especially, flow real rows down the whole screen (status bar, header, then list/detail content) rather than a header floating above a gap. Keep every label short enough to sit on one line within its column — shorten the copy rather than relying on the frame to absorb it (long labels wrap or clip).\n\n**Good example — a contacts list, surface \\`browser\\`.** A small, real screen\ncomposed from the helper classes and tokens, layout in inline flex, no fonts or\nhex colors:\n\n\\`\\`\\`html\n<div style=\"display:flex;flex-direction:column;gap:12px;padding:16px;height:100%\">\n <div style=\"display:flex;align-items:center;justify-content:space-between\">\n <h1>Contacts</h1>\n <button class=\"primary\">New contact</button>\n </div>\n <div style=\"display:flex;gap:6px\">\n <span class=\"wf-pill accent\">All 128</span>\n <span class=\"wf-pill\">Favorites</span>\n <span class=\"wf-pill\">Archived</span>\n </div>\n <div class=\"wf-card\" style=\"display:flex;flex-direction:column;gap:0;padding:0\">\n <div style=\"display:flex;align-items:center;gap:10px;padding:10px 12px;border-bottom:1.4px solid var(--wf-line)\">\n <div style=\"width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)\"></div>\n <div style=\"flex:1\"><strong>Jane Cooper</strong><br /><small>jane@acme.co</small></div>\n <span class=\"wf-pill\">Lead</span>\n </div>\n <div style=\"display:flex;align-items:center;gap:10px;padding:10px 12px\">\n <div style=\"width:32px;height:32px;border-radius:999px;background:var(--wf-accent-soft)\"></div>\n <div style=\"flex:1\"><strong>Marcus Lee</strong><br /><small>marcus@globex.io</small></div>\n <span class=\"wf-pill\">Customer</span>\n </div>\n </div>\n</div>\n\\`\\`\\`\n\n**Mockups belong in the top visual review area.** Static visuals live on the\ncanvas; multi-step flows get both canvas wireframes and a prototype. When the\nuser asks for a mockup, UI state, loading state, layout, screen, or visual\ncomparison, make the canvas the primary home for that static visual. When the\nuser asks for a prototype or the plan contains a sequence the reviewer must\nfeel, keep the canvas artboards and add \\`content.prototype\\` so the top surface\nshows Wireframes / Prototype tabs. Document blocks can explain, compare, or map\nimplementation, but they should not host the primary mockup or prototype just\nbecause \\`custom-html\\`, screenshots, or prose are easier to produce. If the\ncanvas/prototype surface cannot represent the requested fidelity, still keep the\nclosest top-surface representation and call out or extend the needed renderer\ncapability.\n\n**Legacy kit tree.** Older plans set a \\`screen\\` array of \\`{ el, ...props }\\` kit\nnodes instead of \\`html\\`; the renderer still accepts and displays it, but new\nplans emit \\`html\\`. Do not author fresh kit-tree screens — write the HTML mockup\ninstead. Likewise, old or imported plans may carry coordinate-based regions or\nfree-float x/y on notes or artboards; those are legacy escape hatches the\nrenderer still shows but you must never produce. The \\`surface\\` drives the aspect\nand footprint, the canvas auto-places artboards, and the gutter parks notes by\n\\`targetId\\` + \\`placement\\`; never supply width, height, or coordinates for a new\nplan.\n\n<!-- SHARED-CORE:wireframe-canvas END -->\n\n<!-- SHARED-CORE:document-quality START -->\n\n## Document Quality Core\n\nThis section is shared, word for word, by \\`/visual-plan\\`, \\`/ui-plan\\`, and\n\\`/visualize-plan\\`. It is the single source of truth for the document below the\ncanvas. Do not paraphrase it per command.\n\n**The document is a serious technical plan, not marketing.** Write it the way a\nstrong Claude or Codex implementation plan reads: outcome-first, prose-first,\nself-contained, and specific. State the objective and what \"done\" means, the\nscope and non-goals, the proposed approach with the key decisions and their\nrationale, ordered steps that name real files, symbols, actions, and data\nshapes, the risks, and a closing verification step (tests, build, or a checkable\nbehavior). Replace vague prose with specifics; never ship a step like \"make it\nwork.\" No hero art, gradients, logos, nav bars, slogans, value props, giant\nlanding-page headings, or marketing cards unless the user explicitly asks.\n\n**Top visuals and document never duplicate each other.** The UI story lives in\nthe top visual surface: canvas artboards for static inspection, plus prototype\ntabs when the flow should be functional. The document carries the technical depth\nthe visuals cannot show — concrete file/symbol maps, API and data contracts,\ncode snippets, migration or implementation phases, risks, and validation. Repeat\na wireframe in the document only for a genuinely new detail view or comparison.\nSkip the visual surface entirely for non-visual work and write a clean rich\ndocument.\n\n**Use the right block, and make it carry substance.** For the authoritative,\nmachine-checked list of block types and their data schemas, call \\`get-plan-blocks\\`\n— it returns the live registry vocabulary (type, MDX tag, placement, key fields)\nso you never emit a block the editor cannot render or round-trip:\n\n- \\`rich-text\\` for plan prose with real bold/italic/code/links and nested lists.\n- \\`implementation-map\\` / \\`code-tabs\\` for the file map: file path, the\n symbols/components to touch, the reason, risk/coordination notes, and a\n concise syntax-highlighted snippet of the code shape — never the whole file,\n never a prose-only file list.\n- \\`decision\\` for two or three option cards with consequences. These are static\n records; do not style them like clickable tabs or chips unless the renderer\n truly supports changing the selection.\n- \\`diagram\\` for architecture, sequence, data-flow, dependency, or state\n relationships, only when it clarifies something real. Labels must not overlap\n nodes, connectors, or each other.\n- \\`tabs\\` for multiple states, directions, or comparisons. A tab that reveals\n only prose usually means the plan is under-specified — include a relevant\n visual unless the tab is intentionally document-only.\n- \\`table\\`, \\`checklist\\`, \\`callout\\` for scannable structure.\n\n**Open questions live at the bottom as a form when answers would change the\nplan.** Surface answerable unresolved decisions in a final \\`question-form\\`\nblock titled \"Open Questions\". Use \\`single\\` or \\`multi\\` for clear choices,\n\\`freeform\\` for constraints, \\`recommended: true\\` for the default you would pick,\nand option \\`wireframe\\` / \\`diagram\\` previews for visual directions when useful.\nKeep non-answerable assumptions or risks as concise \\`callout\\` blocks in the\nrelevant section. Never bury a questions/decisions wall inside the plan\nnarrative.\n\n**\\`custom-html\\` is a bounded escape hatch only** — a single complete fragment\ninside a block, never \\`html\\`/\\`head\\`/\\`body\\`/\\`script\\` tags, never a generic\nplaceholder, density demo, or proof that custom HTML works. Prefer the native\nblocks for normal plans. It may support supplemental demos or references, but it\nis never the primary home for a requested mockup, UI state, or visual\ncomparison. If fidelity requires HTML/CSS, image capture, or real React/CSS, the\nproduct fix is canvas support for that artifact type, not moving the mockup into\nthe document.\n\n**Before handoff, open the plan and check it.** Fix overlap, excessive\nwhitespace, clipped fragments, misleading inactive controls, poor contrast, and\nunreadable diagrams before asking for approval.\n\n<!-- SHARED-CORE:document-quality END -->\n\n<!-- SHARED-CORE:exemplar START -->\n\n## Good vs. Bad Exemplar\n\n**GOOD.** A \\`/ui-plan\\` for a todo app: a canvas with a \\`desktop\\` artboard whose\n\\`data.html\\` is a real flex layout — a sidebar of links (\\`Inbox 12\\`, \\`Today 4\\`,\n\\`Done\\`), a main column with an \\`<h1>Today</h1>\\`, accent \\`.wf-pill\\`s for the\nfilters, a muted section label \\`OVERDUE\\`, and \\`.wf-card\\` task rows carrying real\ntitles, due dates, and a primary \\`button.primary\\` — styled only through bare\nelements, helper classes, and \\`--wf-*\\` tokens, so the renderer applies the\ncorrect desktop footprint, theme, and one subtle whole-frame wobble. Plain-text\ndesigner notes sit spaced off the frame, pointing only at the controls that need\nexplanation. Below it, a Claude/Codex-grade document: objective and\ndone-criteria, an \\`implementation-map\\` naming the real components and actions\nwith short highlighted snippets, a \\`decision\\` card weighing two real approaches,\nand a validation step — none of it repeating the canvas. If the task also\nchanges a multi-step completion flow, the same top area includes a Prototype tab\nwhose screens use the same labels and states as the canvas artboards, with\n\\`data-goto\\` controls for the sequence. This is the bar.\n\n**BAD.** A \\`data.html\\` with hard-coded hex colors, a \\`font-family\\`, or fixed\npixel width/height; gray placeholder bars \"insinuating\" text on a non-skeleton\nframe; a forced desktop + mobile pair for a popover; floating bordered\nannotation cards hugging the frames; a fresh hand-authored kit-tree \\`screen\\`\ninstead of \\`html\\`; a multi-step UI flow with only static frames and no prototype\ntab; a mockup escaped into a document \\`custom-html\\` block; and a marketing-style\ndocument with a hero heading and value props that just restates what the canvas\nalready shows. Never produce this.\n\n<!-- SHARED-CORE:exemplar END -->\n\n## Tool Guidance\n\n- \\`visualize-plan\\`: create the visual companion from the existing text plan.\n- \\`update-visual-plan\\`: enrich the import; prefer targeted \\`contentPatches\\` over\n replacing the whole content. Use \\`set-prototype\\`, \\`patch-prototype-html\\`,\n \\`update-prototype-screen\\`, and \\`patch-wireframe-html\\` when revising\n functional prototype flows or their static frame counterparts.\n- \\`convert-visual-plan-to-prototype\\`: convert an existing HTML wireframe canvas\n into a functional prototype while preserving static mocks by default.\n- \\`create-prototype-plan\\`: use only when the user wants a prototype-first plan\n and there is no existing plan text that \\`/visualize-plan\\` should preserve.\n- \\`read-visual-plan-source\\`: read the normalized plan as \\`plan.mdx\\`,\n optional \\`canvas.mdx\\`, optional \\`prototype.mdx\\`, optional \\`.plan-state.json\\`,\n and JSON.\n- \\`patch-visual-plan-source\\`: apply granular MDX AST patches by stable block,\n artboard, annotation, component, prototype screen, or wireframe-node id.\n- \\`import-visual-plan-source\\`: create or replace a plan from an MDX folder.\n- \\`get-visual-plan\\`: inspect the current structured plan, exported HTML, and\n annotations; it also returns the MDX folder for source workflows.\n- \\`get-plan-feedback\\`: read unconsumed reviewer comments before coding; it\n returns grouped threads, exact anchor details, expected resolver, and recent\n review-event payloads so agents can act only on the comments meant for them.\n- \\`export-visual-plan\\`: export HTML, Markdown fallback, structured JSON, and MDX\n files for repo check-in.\n\nWhen the user critiques a plan's look or structure, fix the renderer or this\nskill — never hand-edit one stored plan. Turn feedback into better guidance.\n\n## Setup & Authentication\n\nThere are two ways into Plans.\n\n**Coding agent (CLI).** Install once with the Agent-Native CLI. The command\ninstalls the Plans skills, registers the hosted Plans MCP connector, and\nauthenticates it in the same step (a one-time browser sign-in at setup — this is\nintended), so the first tool call does not hit an OAuth wall:\n\n\\`\\`\\`bash\nagent-native skills add visual-plan\n\\`\\`\\`\n\nAfter that, \\`/visual-plan\\` (and \\`/ui-plan\\`, \\`/prototype-plan\\`, \\`/plan-design\\`,\n\\`/visual-questions\\`, \\`/visualize-plan\\`) generate a plan and open the editor. Pass \\`--no-connect\\` to\nregister the connector without authenticating, then run\n\\`agent-native connect https://plan.agent-native.com\\` whenever you are ready.\n\n**Browser (people you share with).** Open the Plans editor and create & edit\nwith no sign-up — you work as a guest. Sign in only when you want to save or\nshare; signing in claims the plans you made as a guest into your account.\n\nSharing and commenting require an account: public/shared plans are viewable by\nanyone with the link, but commenting on them needs an agent-native account.\n\nFor fully offline, no-account use, run the Plans app locally and sync plans to\nyour repo as MDX. This local mode is a separate advanced path, not the default\nhosted flow.\n\nIf a Plans tool returns \\`needs auth\\`, \\`Unauthorized\\`, or \\`Session terminated\\`,\ndo not keep retrying the tool. Authenticate the connector with\n\\`agent-native connect https://plan.agent-native.com\\` (OAuth-capable hosts can\ninstead re-run /mcp and choose Authenticate), then continue once the connector\nis available.\n\nHosted default: connect \\`https://plan.agent-native.com/_agent-native/mcp\\`. Do\nnot put shared secrets in skill files.\n`;\n\nconst BUILT_IN_APP_SKILLS = {\n assets: {\n skillName: \"assets\",\n manifest: normalizeAppSkillManifest({\n schemaVersion: 1,\n id: \"assets\",\n displayName: \"Assets\",\n description:\n \"Create, search, select, and export brand image and video assets from the Assets app.\",\n hosted: {\n url: \"https://assets.agent-native.com\",\n mcpUrl: \"https://assets.agent-native.com/_agent-native/mcp\",\n },\n mcp: { serverName: \"agent-native-assets\" },\n auth: {\n mode: \"oauth\",\n setup:\n \"Authenticate with the Assets MCP connector in the host app. No shared secrets are stored in skill files.\",\n },\n surfaces: [\n {\n id: \"asset-picker\",\n action: \"open-asset-picker\",\n path: \"/picker\",\n mediaTypes: [\"image\", \"video\"],\n defaultMediaType: \"image\",\n },\n ],\n skills: [\n {\n path: \"skills/assets\",\n visibility: \"exported\",\n exportAs: \"assets\",\n },\n ],\n hostAdapters: [\n \"codex-plugin\",\n \"claude-marketplace\",\n \"vercel-skills\",\n \"plain-skill\",\n \"claude-skill\",\n \"chatgpt-mcp\",\n \"generic-mcp\",\n ],\n }),\n skillMarkdown: ASSETS_SKILL_MD,\n },\n design: {\n skillName: \"design-exploration\",\n manifest: normalizeAppSkillManifest({\n schemaVersion: 1,\n id: \"design\",\n displayName: \"Design\",\n description:\n \"Explore, compare, iterate, and export interactive UI design prototypes from the Design app.\",\n hosted: {\n url: \"https://design.agent-native.com\",\n mcpUrl: \"https://design.agent-native.com/_agent-native/mcp\",\n },\n mcp: { serverName: \"agent-native-design\" },\n auth: {\n mode: \"oauth\",\n setup:\n \"Authenticate with the Design MCP connector in the host app. No shared secrets are stored in skill files.\",\n },\n surfaces: [\n {\n id: \"design-exploration\",\n action: \"present-design-variants\",\n path: \"/design\",\n },\n ],\n skills: [\n {\n path: \"skills/design-exploration\",\n visibility: \"exported\",\n exportAs: \"design-exploration\",\n },\n ],\n hostAdapters: [\n \"codex-plugin\",\n \"claude-marketplace\",\n \"vercel-skills\",\n \"plain-skill\",\n \"claude-skill\",\n \"chatgpt-mcp\",\n \"generic-mcp\",\n ],\n }),\n skillMarkdown: DESIGN_EXPLORATION_SKILL_MD,\n },\n \"visual-plans\": {\n skillName: \"visual-plan\",\n extraSkills: {\n \"visual-questions\": VISUAL_QUESTIONS_SKILL_MD,\n \"ui-plan\": UI_PLAN_SKILL_MD,\n \"prototype-plan\": PROTOTYPE_PLAN_SKILL_MD,\n \"plan-design\": PLAN_DESIGN_SKILL_MD,\n \"visualize-plan\": VISUALIZE_PLAN_SKILL_MD,\n },\n manifest: normalizeAppSkillManifest({\n schemaVersion: 1,\n id: \"visual-plans\",\n displayName: \"Agent-Native Plans\",\n description:\n \"Generate and review coding-agent plans as structured visual documents with diagrams, wireframes, prototypes, annotations, feedback, and HTML export.\",\n hosted: {\n url: \"https://plan.agent-native.com\",\n mcpUrl: \"https://plan.agent-native.com/_agent-native/mcp\",\n },\n mcp: { serverName: \"agent-native-plans\" },\n auth: {\n mode: \"oauth\",\n setup:\n \"Install with the Agent-Native CLI to add the /visual-plan, /ui-plan, /prototype-plan, /plan-design, /visual-questions, and /visualize-plan skills plus the Plans MCP connector. Authenticate only for hosted/account-backed sharing.\",\n },\n surfaces: [\n {\n id: \"visual-plan\",\n action: \"create-visual-plan\",\n path: \"/plans\",\n },\n {\n id: \"visual-questions\",\n action: \"create-visual-questions\",\n path: \"/plans\",\n description:\n \"Create a visual intake questionnaire before generating or updating an Agent-Native plan.\",\n },\n {\n id: \"ui-plan\",\n action: \"create-ui-plan\",\n path: \"/plans\",\n description:\n \"Create a UI-first Agent-Native plan with an optional top pan/zoom wireframe canvas and a refined rich document below.\",\n },\n {\n id: \"prototype-plan\",\n action: \"create-prototype-plan\",\n path: \"/plans\",\n description:\n \"Create a prototype-first Agent-Native plan with a functional live prototype above the document.\",\n },\n {\n id: \"plan-design\",\n action: \"create-plan-design\",\n path: \"/plans\",\n description:\n \"Create a full-fidelity Agent-Native design plan with a Design canvas tab and optional matching Prototype tab.\",\n },\n {\n id: \"visualize-plan\",\n action: \"visualize-plan\",\n path: \"/plans\",\n },\n ],\n skills: [\n {\n path: \"skills/visual-plan\",\n visibility: \"exported\",\n exportAs: \"visual-plan\",\n },\n {\n path: \"skills/visual-questions\",\n visibility: \"exported\",\n exportAs: \"visual-questions\",\n },\n {\n path: \"skills/ui-plan\",\n visibility: \"exported\",\n exportAs: \"ui-plan\",\n },\n {\n path: \"skills/prototype-plan\",\n visibility: \"exported\",\n exportAs: \"prototype-plan\",\n },\n {\n path: \"skills/plan-design\",\n visibility: \"exported\",\n exportAs: \"plan-design\",\n },\n {\n path: \"skills/visualize-plan\",\n visibility: \"exported\",\n exportAs: \"visualize-plan\",\n },\n ],\n hostAdapters: [\n \"codex-plugin\",\n \"claude-marketplace\",\n \"vercel-skills\",\n \"plain-skill\",\n \"claude-skill\",\n \"chatgpt-mcp\",\n \"generic-mcp\",\n ],\n }),\n skillMarkdown: VISUAL_PLANS_SKILL_MD,\n },\n \"context-xray\": {\n skillName: \"context-xray\",\n localOnly: true,\n manifest: normalizeAppSkillManifest({\n schemaVersion: 1,\n id: \"context-xray\",\n displayName: \"Context X-Ray\",\n description:\n \"Visualize local Codex and Claude Code context usage with warnings and optimization tips.\",\n hosted: {\n url: \"https://context-xray.agent-native.com\",\n mcpUrl: \"https://context-xray.agent-native.com/_agent-native/mcp\",\n },\n mcp: { serverName: \"agent-native-context-xray\" },\n auth: { mode: \"none\" },\n surfaces: [\n {\n id: \"context-xray-report\",\n path: \"/\",\n },\n ],\n skills: [\n {\n path: \"skills/context-xray\",\n visibility: \"exported\",\n exportAs: \"context-xray\",\n },\n ],\n hostAdapters: [\"plain-skill\", \"claude-skill\"],\n }),\n skillMarkdown: CONTEXT_XRAY_SKILL_MD,\n },\n} satisfies Record<\n string,\n {\n manifest: AppSkillManifest;\n skillMarkdown: string;\n skillName: string;\n extraSkills?: Record<string, string>;\n localOnly?: boolean;\n }\n>;\n\ntype BuiltInAppSkillId = keyof typeof BUILT_IN_APP_SKILLS;\n\nconst BUILT_IN_APP_SKILL_ALIASES = {\n assets: \"assets\",\n asset: \"assets\",\n \"asset-generation\": \"assets\",\n images: \"assets\",\n image: \"assets\",\n \"image-generation\": \"assets\",\n \"agent-native-assets\": \"assets\",\n \"agent-native-images\": \"assets\",\n design: \"design\",\n \"ui-design\": \"design\",\n \"ux-design\": \"design\",\n \"design-exploration\": \"design\",\n \"ux-exploration\": \"design\",\n \"agent-native-design\": \"design\",\n \"agent-native-design-exploration\": \"design\",\n \"visual-plans\": \"visual-plans\",\n \"visual-plan\": \"visual-plans\",\n \"visual-questions\": \"visual-plans\",\n \"visual-question\": \"visual-plans\",\n \"ui-plan\": \"visual-plans\",\n \"ui-plans\": \"visual-plans\",\n \"prototype-plan\": \"visual-plans\",\n \"prototype-plans\": \"visual-plans\",\n \"plan-design\": \"visual-plans\",\n \"plan-designs\": \"visual-plans\",\n \"design-plan\": \"visual-plans\",\n \"design-plans\": \"visual-plans\",\n prototype: \"visual-plans\",\n \"visualize-plan\": \"visual-plans\",\n \"visualize-plans\": \"visual-plans\",\n \"html-plan\": \"visual-plans\",\n \"plan-mode\": \"visual-plans\",\n plannotate: \"visual-plans\",\n plannotator: \"visual-plans\",\n \"agent-native-visual-plans\": \"visual-plans\",\n \"context-xray\": \"context-xray\",\n \"local-context-xray\": \"context-xray\",\n xray: \"context-xray\",\n \"context-window\": \"context-xray\",\n \"context-usage\": \"context-xray\",\n \"agent-native-context-xray\": \"context-xray\",\n} satisfies Record<string, BuiltInAppSkillId>;\n\nconst BUILT_IN_APP_SKILL_DISPLAY_ALIASES = {\n assets: [\"images\", \"image-generation\", \"agent-native-images\"],\n design: [\n \"design-exploration\",\n \"ux-exploration\",\n \"agent-native-design-exploration\",\n ],\n \"visual-plans\": [\n \"visual-plan\",\n \"visual-questions\",\n \"ui-plan\",\n \"prototype-plan\",\n \"plan-design\",\n \"visualize-plan\",\n \"html-plan\",\n \"plannotate\",\n ],\n \"context-xray\": [\"xray\", \"context-window\", \"context-usage\"],\n} satisfies Record<BuiltInAppSkillId, string[]>;\n\nconst CLIENT_LABELS: Record<ClientId, string> = {\n \"claude-code\": \"Claude Code\",\n \"claude-code-cli\": \"Claude Code CLI\",\n codex: \"Codex\",\n cowork: \"Claude Cowork\",\n};\n\nconst CLIENT_HINTS: Record<ClientId, string> = {\n \"claude-code\": \".mcp.json or ~/.claude.json\",\n \"claude-code-cli\": \".mcp.json or ~/.claude.json\",\n codex: \"$CODEX_HOME/config.toml or ~/.codex/config.toml\",\n cowork: \"~/.cowork/mcp.json\",\n};\n\ntype SkillsCommand = \"list\" | \"add\" | \"help\";\n\nexport interface ParsedSkillsArgs {\n command: SkillsCommand;\n target?: string;\n client: string;\n clientExplicit: boolean;\n clients?: ClientId[];\n scope: string;\n yes: boolean;\n dryRun: boolean;\n printJson: boolean;\n instructions: boolean;\n mcp: boolean;\n /**\n * Run the browser/device auth flow after registering a hosted MCP connector\n * so the user does not hit an OAuth wall on the first tool call. Default true;\n * `--no-connect` opts out and leaves authentication for the host/`agent-native\n * connect`.\n */\n connect: boolean;\n /**\n * Optional MCP URL override. When set, the skill's hosted MCP connector is\n * registered against this URL instead of the built-in hosted default — e.g.\n * an ngrok tunnel, a local dev origin, or a self-hosted deployment.\n */\n mcpUrl?: string;\n}\n\nexport interface SkillsAddResult {\n id: string;\n displayName: string;\n instructionSource?: string;\n skillNames: string[];\n skillsAgents: string[];\n mcpUrl: string;\n mcpClients: ClientId[];\n dryRun: boolean;\n commands: string[];\n local?: boolean;\n scriptPath?: string;\n written?: string[];\n /**\n * True when the install also kicked off (or prepared) the browser/device auth\n * flow for the hosted MCP connector. False when connect was skipped\n * (`--no-connect`, no-auth skills, or non-interactive without a connect step).\n */\n connected?: boolean;\n /**\n * The exact `agent-native connect <url>` command to run when interactive auth\n * was skipped (non-interactive shell / CI). Empty when connect ran inline or\n * was not needed.\n */\n connectCommand?: string;\n}\n\ninterface SkillInstallTarget {\n id: string;\n displayName: string;\n loaded: LoadedAppSkillManifest;\n skillNames: string[];\n materializeInstructions(outDir: string): string;\n cleanup?: () => void;\n}\n\ninterface RunCommandOptions {\n stdio?: \"inherit\" | \"stderr\" | \"silent\";\n}\n\ninterface RunSkillsOptions {\n baseDir?: string;\n isInteractive?: () => boolean;\n log?: (message: string) => void;\n promptClients?: (\n context: SkillsClientPromptContext,\n ) => Promise<ClientId[] | null>;\n promptSkills?: (\n context: SkillsTargetPromptContext,\n ) => Promise<string[] | null>;\n runCommand?: (\n cmd: string,\n args: string[],\n options?: RunCommandOptions,\n ) => Promise<number>;\n /**\n * Injectable connect/auth entrypoint (defaults to the real `agent-native\n * connect`). Tests stub this so the install flow does not perform a real\n * browser/device OAuth round-trip.\n */\n runConnect?: (args: string[]) => Promise<void>;\n}\n\ninterface SkillsClientPromptContext {\n initialClients: ClientId[];\n options: Array<{ value: ClientId; label: string; hint: string }>;\n}\n\ninterface SkillsTargetPromptContext {\n initialTargets: string[];\n options: Array<{ value: string; label: string; hint: string }>;\n}\n\nfunction normalizeKnownSkillTarget(\n value: string | undefined,\n): BuiltInAppSkillId | undefined {\n const key = value?.trim().toLowerCase();\n if (!key) return undefined;\n return BUILT_IN_APP_SKILL_ALIASES[key];\n}\n\nfunction isKnownSkill(value: string | undefined): boolean {\n return Boolean(normalizeKnownSkillTarget(value));\n}\n\nfunction isLocalOnlyBuiltInSkill(\n entry: (typeof BUILT_IN_APP_SKILLS)[BuiltInAppSkillId] | null | undefined,\n): boolean {\n return Boolean(entry && \"localOnly\" in entry && entry.localOnly);\n}\n\nfunction builtInExtraSkills(\n entry: (typeof BUILT_IN_APP_SKILLS)[BuiltInAppSkillId],\n): Record<string, string> {\n return \"extraSkills\" in entry && entry.extraSkills ? entry.extraSkills : {};\n}\n\nfunction builtInSkillNames(\n entry: (typeof BUILT_IN_APP_SKILLS)[BuiltInAppSkillId],\n): string[] {\n return [entry.skillName, ...Object.keys(builtInExtraSkills(entry))];\n}\n\nfunction normalizeClientIds(values: unknown): ClientId[] {\n if (!Array.isArray(values)) return [];\n const seen = new Set<ClientId>();\n const out: ClientId[] = [];\n for (const value of values) {\n if (typeof value !== \"string\") continue;\n const id = value.toLowerCase();\n if (!(CLIENTS as string[]).includes(id)) continue;\n const client = id as ClientId;\n if (seen.has(client)) continue;\n seen.add(client);\n out.push(client);\n }\n return out;\n}\n\nfunction clientPromptOptions(): SkillsClientPromptContext[\"options\"] {\n return CLIENTS.map((client) => ({\n value: client,\n label: CLIENT_LABELS[client],\n hint: CLIENT_HINTS[client],\n }));\n}\n\nfunction skillPromptOptions(): SkillsTargetPromptContext[\"options\"] {\n return Object.values(BUILT_IN_APP_SKILLS).map((entry) => ({\n value: entry.skillName,\n label: entry.manifest.displayName,\n hint: entry.manifest.description,\n }));\n}\n\nfunction shouldPrompt(parsed: ParsedSkillsArgs, options: RunSkillsOptions) {\n if (parsed.yes || parsed.printJson) return false;\n if (options.isInteractive) return options.isInteractive();\n if (process.env.AGENT_NATIVE_NO_PROMPT === \"1\") return false;\n if (process.env.CI === \"true\") return false;\n return !!process.stdin.isTTY && !!process.stdout.isTTY;\n}\n\nasync function promptForClients(\n context: SkillsClientPromptContext,\n): Promise<ClientId[] | null> {\n const clack = await import(\"@clack/prompts\");\n const result = await clack.multiselect({\n message:\n \"Install the MCP connector for which local agents?\\n\" +\n \" (space toggles, enter confirms; saved for next time)\",\n options: context.options,\n initialValues: context.initialClients,\n required: true,\n });\n if (clack.isCancel(result)) {\n clack.cancel(\"Cancelled.\");\n return null;\n }\n return normalizeClientIds(result);\n}\n\nasync function promptForSkills(\n context: SkillsTargetPromptContext,\n): Promise<string[] | null> {\n const clack = await import(\"@clack/prompts\");\n const result = await clack.multiselect({\n message:\n \"Which Agent Native skills do you want to install?\\n\" +\n \" (space toggles, enter confirms)\",\n options: context.options,\n initialValues: context.initialTargets,\n required: true,\n });\n if (clack.isCancel(result)) {\n clack.cancel(\"Cancelled.\");\n return null;\n }\n if (!Array.isArray(result)) return [];\n return result.filter((value): value is string => typeof value === \"string\");\n}\n\nasync function resolveSkillsClients(\n parsed: ParsedSkillsArgs,\n options: RunSkillsOptions,\n): Promise<ClientId[] | null> {\n if (parsed.clientExplicit || !shouldPrompt(parsed, options)) {\n return resolveClients(parsed.client);\n }\n const initialClients =\n readConnectClientPreferences() ?? resolveClients(\"codex\");\n const prompt = options.promptClients ?? promptForClients;\n const selected = normalizeClientIds(\n await prompt({\n initialClients,\n options: clientPromptOptions(),\n }),\n );\n if (selected.length === 0) return null;\n if (!parsed.dryRun) {\n try {\n writeConnectClientPreferences(selected);\n } catch {}\n }\n return selected;\n}\n\nasync function resolveSkillTargets(\n parsed: ParsedSkillsArgs,\n options: RunSkillsOptions,\n): Promise<string[] | null> {\n if (parsed.target || !shouldPrompt(parsed, options)) {\n return [parsed.target ?? \"assets\"];\n }\n const prompt = options.promptSkills ?? promptForSkills;\n const selected = await prompt({\n initialTargets: [\"assets\"],\n options: skillPromptOptions(),\n });\n if (!selected || selected.length === 0) return null;\n return selected;\n}\n\nexport function parseSkillsArgs(argv: string[]): ParsedSkillsArgs {\n const first = argv[0];\n let command: SkillsCommand = \"list\";\n let args = argv;\n if (first === \"help\" || first === \"--help\" || first === \"-h\") {\n command = \"help\";\n args = argv.slice(1);\n } else if (first === \"list\" || first === \"add\") {\n command = first;\n args = argv.slice(1);\n } else if (first) {\n command = \"add\";\n }\n\n const out: ParsedSkillsArgs = {\n command,\n client: \"codex\",\n clientExplicit: false,\n scope: \"user\",\n yes: false,\n dryRun: false,\n printJson: false,\n instructions: true,\n mcp: true,\n connect: true,\n };\n\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n const eat = (flag: string): string | undefined => {\n if (arg === flag) {\n const next = args[++i];\n if (!next || next.startsWith(\"-\")) {\n throw new Error(`Missing value for ${flag}.`);\n }\n return next;\n }\n if (arg.startsWith(`${flag}=`)) {\n const value = arg.slice(flag.length + 1);\n if (!value) throw new Error(`Missing value for ${flag}.`);\n return value;\n }\n return undefined;\n };\n let value: string | undefined;\n if ((value = eat(\"--client\")) !== undefined) {\n out.client = value;\n out.clientExplicit = true;\n } else if ((value = eat(\"--scope\")) !== undefined) out.scope = value;\n else if ((value = eat(\"--mcp-url\")) !== undefined) out.mcpUrl = value;\n else if (arg === \"--yes\" || arg === \"-y\") out.yes = true;\n else if (arg === \"--dry-run\") out.dryRun = true;\n else if (arg === \"--json\") out.printJson = true;\n else if (arg === \"--mcp-only\") out.instructions = false;\n else if (arg === \"--instructions-only\" || arg === \"--no-mcp\")\n out.mcp = false;\n else if (arg === \"--no-connect\" || arg === \"--skip-connect\")\n out.connect = false;\n else if (arg.startsWith(\"-\")) throw new Error(`Unknown option: ${arg}`);\n else if (!out.target) out.target = arg;\n else throw new Error(`Unexpected argument: ${arg}`);\n }\n\n if (out.scope !== \"user\" && out.scope !== \"project\") {\n throw new Error(\"--scope must be either user or project.\");\n }\n return out;\n}\n\nfunction loadSkillTarget(target: string): SkillInstallTarget {\n const knownTarget = normalizeKnownSkillTarget(target);\n if (knownTarget) {\n const builtIn = BUILT_IN_APP_SKILLS[knownTarget];\n const skillNames = builtInSkillNames(builtIn);\n return {\n id: builtIn.manifest.id,\n displayName: builtIn.manifest.displayName,\n loaded: {\n manifest: builtIn.manifest,\n file: `<built-in:${builtIn.manifest.id}>`,\n dir: process.cwd(),\n },\n skillNames,\n materializeInstructions(outDir) {\n const skills: Record<string, string> = {\n [builtIn.skillName]: builtIn.skillMarkdown,\n ...builtInExtraSkills(builtIn),\n };\n for (const [skillName, skillMarkdown] of Object.entries(skills)) {\n const skillDir = path.join(outDir, \"skills\", skillName);\n fs.mkdirSync(skillDir, { recursive: true });\n fs.writeFileSync(\n path.join(skillDir, \"SKILL.md\"),\n skillMarkdown,\n \"utf-8\",\n );\n }\n return outDir;\n },\n };\n }\n\n const resolved = path.resolve(target);\n const manifestFile = fs.statSync(resolved).isDirectory()\n ? path.join(resolved, \"agent-native.app-skill.json\")\n : resolved;\n const loaded = loadAppSkillManifest(manifestFile);\n return {\n id: loaded.manifest.id,\n displayName: loaded.manifest.displayName,\n loaded,\n skillNames: loaded.manifest.skills\n .filter(\n (skill) =>\n skill.visibility === \"exported\" || skill.visibility === \"both\",\n )\n .map((skill) => skill.exportAs ?? path.basename(skill.path)),\n materializeInstructions(outDir) {\n const packed = buildAppSkillPack(loaded, outDir);\n const vercelAdapter = path.join(\n packed.outDir,\n \"adapters\",\n \"vercel-skills\",\n );\n return fs.existsSync(vercelAdapter) ? vercelAdapter : packed.outDir;\n },\n };\n}\n\nfunction skillsAgentsForClients(clients: ClientId[]): string[] {\n const agents = new Set<string>();\n for (const client of clients) {\n if (client === \"codex\") agents.add(\"codex\");\n if (client === \"claude-code\" || client === \"claude-code-cli\") {\n agents.add(\"claude-code\");\n }\n }\n return [...agents];\n}\n\nfunction shellArg(value: string): string {\n if (/^[A-Za-z0-9_/:=.,@+-]+$/.test(value)) return value;\n return `'${value.replace(/'/g, `'\\\\''`)}'`;\n}\n\nfunction commandString(cmd: string, args: string[]): string {\n return [cmd, ...args].map(shellArg).join(\" \");\n}\n\nfunction clientArgForClients(clients: ClientId[]): string {\n if (clients.length === CLIENTS.length) return \"all\";\n if (clients.length === 1) return clients[0];\n return clients.join(\",\");\n}\n\nfunction preserveMcpUrlAppPathOverride(\n target: SkillInstallTarget,\n input: string | undefined,\n): SkillInstallTarget {\n if (!input) return target;\n let parsed: URL;\n try {\n parsed = new URL(input);\n } catch {\n return target;\n }\n const trimmedPath = parsed.pathname.replace(/\\/+$/, \"\");\n const appPath = trimmedPath.endsWith(\"/_agent-native/mcp\")\n ? trimmedPath.slice(0, -\"/_agent-native/mcp\".length).replace(/\\/+$/, \"\")\n : trimmedPath;\n if (!appPath) return target;\n const url = `${parsed.origin}${appPath}`;\n return {\n ...target,\n loaded: {\n ...target.loaded,\n manifest: {\n ...target.loaded.manifest,\n hosted: { url, mcpUrl: `${url}/_agent-native/mcp` },\n },\n },\n };\n}\n\nfunction dryRunInstallCommand(\n parsed: ParsedSkillsArgs,\n target: string,\n): string {\n const clients = parsed.clients ?? resolveClients(parsed.client);\n const args = [\n \"skills\",\n \"add\",\n target,\n \"--client\",\n clientArgForClients(clients),\n \"--scope\",\n parsed.scope,\n ];\n if (parsed.mcpUrl) args.push(\"--mcp-url\", parsed.mcpUrl);\n if (parsed.instructions && !parsed.mcp) args.push(\"--instructions-only\");\n if (!parsed.instructions && parsed.mcp) args.push(\"--mcp-only\");\n if (!parsed.connect) args.push(\"--no-connect\");\n if (parsed.yes || isKnownSkill(target)) args.push(\"--yes\");\n return commandString(\"agent-native\", args);\n}\n\nasync function runCommand(\n cmd: string,\n args: string[],\n options: RunCommandOptions = {},\n): Promise<number> {\n return new Promise((resolve, reject) => {\n const pipeToStderr = options.stdio === \"stderr\";\n const silent = options.stdio === \"silent\";\n const stdoutChunks: Buffer[] = [];\n const stderrChunks: Buffer[] = [];\n const child = spawn(cmd, args, {\n stdio: pipeToStderr || silent ? [\"inherit\", \"pipe\", \"pipe\"] : \"inherit\",\n shell: process.platform === \"win32\",\n env: process.env,\n });\n if (pipeToStderr) {\n child.stdout?.on(\"data\", (chunk) => process.stderr.write(chunk));\n child.stderr?.on(\"data\", (chunk) => process.stderr.write(chunk));\n } else if (silent) {\n child.stdout?.on(\"data\", (chunk) =>\n stdoutChunks.push(Buffer.from(chunk)),\n );\n child.stderr?.on(\"data\", (chunk) =>\n stderrChunks.push(Buffer.from(chunk)),\n );\n }\n child.on(\"error\", reject);\n child.on(\"exit\", (code, signal) => {\n if (signal) {\n reject(new Error(`${cmd} was interrupted by ${signal}.`));\n return;\n }\n if (silent && code !== 0) {\n for (const chunk of stdoutChunks) process.stderr.write(chunk);\n for (const chunk of stderrChunks) process.stderr.write(chunk);\n }\n resolve(code ?? 0);\n });\n });\n}\n\n/**\n * Resolve a `--mcp-url` override into the `{ url, mcpUrl }` pair the manifest\n * expects. Accepts a bare origin (`https://x.ngrok-free.dev`) — appending the\n * standard `/_agent-native/mcp` path — or a full MCP URL already ending in it.\n */\nfunction resolveMcpUrlOverride(input: string): { url: string; mcpUrl: string } {\n let parsed: URL;\n try {\n parsed = new URL(input);\n } catch {\n throw new Error(`--mcp-url must be a valid URL (got \"${input}\").`);\n }\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") {\n throw new Error(\"--mcp-url must use http:// or https://.\");\n }\n const origin = parsed.origin;\n const trimmedPath = parsed.pathname.replace(/\\/+$/, \"\");\n const mcpUrl = trimmedPath.endsWith(\"/_agent-native/mcp\")\n ? `${origin}${trimmedPath}`\n : `${origin}/_agent-native/mcp`;\n return { url: origin, mcpUrl };\n}\n\n/** Return a copy of the install target with its hosted MCP URL overridden. */\nfunction withMcpUrlOverride(\n target: SkillInstallTarget,\n input: string,\n): SkillInstallTarget {\n const { url, mcpUrl } = resolveMcpUrlOverride(input);\n return {\n ...target,\n loaded: {\n ...target.loaded,\n manifest: { ...target.loaded.manifest, hosted: { url, mcpUrl } },\n },\n };\n}\n\n/**\n * Whether we can run the interactive browser/device auth flow. CI and\n * non-TTY shells must not block on a browser approval, so we skip the inline\n * flow there and surface the exact `agent-native connect` command instead.\n */\nfunction canRunInteractiveConnect(options: RunSkillsOptions): boolean {\n if (options.isInteractive) return options.isInteractive();\n if (process.env.AGENT_NATIVE_NO_PROMPT === \"1\") return false;\n if (process.env.CI === \"true\") return false;\n return !!process.stdin.isTTY && !!process.stdout.isTTY;\n}\n\n/** Build the `agent-native connect <url> --client … --scope …` command. */\nfunction connectCommandFor(\n hostedUrl: string,\n clients: ClientId[],\n scope: string,\n): string {\n const args = [\n \"connect\",\n hostedUrl,\n \"--client\",\n clientArgForClients(clients),\n \"--scope\",\n scope,\n ];\n return commandString(\"agent-native\", args);\n}\n\n/**\n * Authenticate the freshly-registered hosted MCP connector so the user does not\n * hit the OAuth wall on their first tool call. Reuses the existing\n * `agent-native connect` flow (OAuth-capable clients get URL-only config plus a\n * `/mcp` authenticate prompt; Codex / Cowork run the browser device-code flow).\n * In non-interactive shells we skip the inline flow and return the command to\n * run instead. Failures here are non-fatal: the connector is already registered,\n * so the user can authenticate later.\n */\nasync function connectAfterEnsure(\n installTarget: SkillInstallTarget,\n clients: ClientId[],\n parsed: ParsedSkillsArgs,\n options: RunSkillsOptions,\n): Promise<{ connected: boolean; connectCommand: string }> {\n const hostedUrl = installTarget.loaded.manifest.hosted.url;\n const authMode = installTarget.loaded.manifest.auth?.mode ?? \"oauth\";\n const connectCommand = connectCommandFor(hostedUrl, clients, parsed.scope);\n\n // Skills whose connector needs no auth (e.g. open/local-only) never need the\n // connect step.\n if (authMode === \"none\") {\n return { connected: false, connectCommand: \"\" };\n }\n\n if (!canRunInteractiveConnect(options)) {\n options.log?.(\n `Authentication skipped (non-interactive). To finish auth, run: ${connectCommand}`,\n );\n return { connected: false, connectCommand };\n }\n\n options.log?.(`Authenticating ${installTarget.displayName}…`);\n try {\n await (options.runConnect ?? runConnect)([\n hostedUrl,\n \"--client\",\n clientArgForClients(clients),\n \"--scope\",\n parsed.scope,\n ]);\n return { connected: true, connectCommand: \"\" };\n } catch (err: any) {\n // Non-fatal: the MCP connector is registered. Surface the manual command.\n options.log?.(\n `Could not finish authentication automatically (${err?.message ?? err}). ` +\n `Run it later with: ${connectCommand}`,\n );\n return { connected: false, connectCommand };\n }\n}\n\nexport async function addAgentNativeSkill(\n parsed: ParsedSkillsArgs,\n options: RunSkillsOptions = {},\n): Promise<SkillsAddResult> {\n const target = parsed.target ?? \"assets\";\n const knownTarget = normalizeKnownSkillTarget(target);\n if (!knownTarget && !fs.existsSync(path.resolve(target))) {\n throw new Error(\n `Unknown skill or manifest path: ${target}. Run \"agent-native skills list\".`,\n );\n }\n const knownBuiltIn = knownTarget ? BUILT_IN_APP_SKILLS[knownTarget] : null;\n if (isLocalOnlyBuiltInSkill(knownBuiltIn)) {\n if (parsed.mcpUrl) {\n throw new Error(\n \"Context X-Ray is installed locally and does not use --mcp-url yet.\",\n );\n }\n if (!parsed.instructions && parsed.mcp) {\n throw new Error(\n \"Context X-Ray does not need MCP config yet. Run without --mcp-only.\",\n );\n }\n const clients = parsed.clients ?? resolveClients(parsed.client);\n const skillsAgents = skillsAgentsForClients(clients);\n if (parsed.dryRun) {\n return {\n id: knownBuiltIn.manifest.id,\n displayName: knownBuiltIn.manifest.displayName,\n skillNames: [knownBuiltIn.skillName],\n skillsAgents,\n mcpUrl: \"\",\n mcpClients: [],\n dryRun: true,\n local: true,\n commands: [dryRunInstallCommand(parsed, target)],\n };\n }\n const localInstall = installLocalContextXray({\n baseDir: options.baseDir ?? process.cwd(),\n clients,\n scope: parsed.scope,\n });\n return {\n id: knownBuiltIn.manifest.id,\n displayName: knownBuiltIn.manifest.displayName,\n instructionSource: localInstall.scriptPath,\n skillNames: [knownBuiltIn.skillName],\n skillsAgents,\n mcpUrl: \"\",\n mcpClients: [],\n dryRun: false,\n local: true,\n scriptPath: localInstall.scriptPath,\n written: localInstall.written,\n commands: localInstall.commands,\n };\n }\n let installTarget = loadSkillTarget(target);\n if (parsed.mcpUrl) {\n installTarget = withMcpUrlOverride(installTarget, parsed.mcpUrl);\n }\n const clients = parsed.clients ?? resolveClients(parsed.client);\n installTarget = preserveMcpUrlAppPathOverride(installTarget, parsed.mcpUrl);\n const skillsAgents = skillsAgentsForClients(clients);\n if (parsed.dryRun) {\n try {\n return {\n id: installTarget.id,\n displayName: installTarget.displayName,\n skillNames: installTarget.skillNames,\n skillsAgents,\n mcpUrl: installTarget.loaded.manifest.hosted.mcpUrl,\n mcpClients: clients,\n dryRun: true,\n commands: [dryRunInstallCommand(parsed, target)],\n };\n } finally {\n installTarget.cleanup?.();\n }\n }\n const commands: string[] = [];\n const tmpRoot = fs.mkdtempSync(path.join(os.tmpdir(), \"an-skills-add-\"));\n let instructionSource: string | undefined;\n let connected = false;\n let connectCommand: string | undefined;\n\n try {\n if (parsed.instructions) {\n if (skillsAgents.length === 0) {\n if (!parsed.mcp) {\n throw new Error(\n \"Skill instructions can only be installed for Codex or Claude Code clients. Use an MCP-capable client or omit --instructions-only.\",\n );\n }\n } else {\n instructionSource = installTarget.materializeInstructions(tmpRoot);\n const args = [\n \"--yes\",\n \"skills@latest\",\n \"add\",\n instructionSource,\n \"--copy\",\n ...installTarget.skillNames.flatMap((skill) => [\"--skill\", skill]),\n ...skillsAgents.flatMap((agent) => [\"-a\", agent]),\n ...(parsed.scope === \"user\" ? [\"-g\"] : []),\n ...(parsed.yes || knownTarget ? [\"-y\"] : []),\n ];\n commands.push(commandString(\"npx\", args));\n if (!parsed.dryRun) {\n const code = await (options.runCommand ?? runCommand)(\"npx\", args, {\n stdio: \"silent\",\n });\n if (code !== 0)\n throw new Error(`npx skills add exited with ${code}.`);\n }\n }\n }\n\n if (parsed.mcp) {\n commands.push(\n `agent-native app-skill ensure --manifest ${installTarget.loaded.file} --client ${parsed.client} --scope ${parsed.scope} --yes`,\n );\n if (!parsed.dryRun) {\n await ensureAppSkill(installTarget.loaded, {\n clients,\n scope: parsed.scope,\n baseDir: options.baseDir,\n yes: parsed.yes || Boolean(knownTarget),\n confirm: true,\n log: options.log,\n });\n\n // One-step install + authenticate: after registering a hosted MCP\n // connector, kick off the existing connect/device-code flow so the user\n // does not hit an OAuth wall on the first tool call. `--no-connect`\n // opts out; non-interactive shells get the exact command to run.\n if (parsed.connect) {\n const result = await connectAfterEnsure(\n installTarget,\n clients,\n parsed,\n options,\n );\n connected = result.connected;\n connectCommand = result.connectCommand || undefined;\n if (connectCommand) commands.push(connectCommand);\n }\n }\n }\n\n return {\n id: installTarget.id,\n displayName: installTarget.displayName,\n instructionSource,\n skillNames: installTarget.skillNames,\n skillsAgents,\n mcpUrl: installTarget.loaded.manifest.hosted.mcpUrl,\n mcpClients: clients,\n dryRun: parsed.dryRun,\n commands,\n connected,\n connectCommand,\n };\n } finally {\n fs.rmSync(tmpRoot, { recursive: true, force: true });\n installTarget.cleanup?.();\n }\n}\n\nfunction listSkills() {\n return Object.values(BUILT_IN_APP_SKILLS).map((entry) => ({\n id: entry.manifest.id,\n aliases:\n BUILT_IN_APP_SKILL_DISPLAY_ALIASES[\n entry.manifest.id as BuiltInAppSkillId\n ] ?? [],\n name: entry.manifest.displayName,\n description: entry.manifest.description,\n mcpUrl: isLocalOnlyBuiltInSkill(entry) ? \"\" : entry.manifest.hosted.mcpUrl,\n local: isLocalOnlyBuiltInSkill(entry),\n }));\n}\n\nexport async function runSkills(\n argv: string[],\n options: RunSkillsOptions = {},\n): Promise<void> {\n const parsed = parseSkillsArgs(argv);\n const log = parsed.printJson\n ? undefined\n : (message: string) => process.stdout.write(`${message}\\n`);\n\n if (parsed.command === \"help\") {\n process.stdout.write(`${HELP}\\n`);\n return;\n }\n\n if (parsed.command === \"list\") {\n const skills = listSkills();\n if (parsed.printJson) {\n process.stdout.write(`${JSON.stringify(skills, null, 2)}\\n`);\n return;\n }\n for (const skill of skills) {\n const description = skill.description.replace(/[.?!]?$/, \".\");\n const aliases = skill.aliases.length\n ? ` Aliases: ${skill.aliases.join(\", \")}.`\n : \"\";\n const target = skill.local ? \"local command\" : skill.mcpUrl;\n process.stdout.write(\n `${skill.id.padEnd(12)} ${description}${aliases} (${target})\\n`,\n );\n }\n return;\n }\n\n const targets = await resolveSkillTargets(parsed, options);\n if (!targets) return;\n const clients = await resolveSkillsClients(parsed, options);\n if (!clients) return;\n\n const results: SkillsAddResult[] = [];\n for (const target of targets) {\n results.push(\n await addAgentNativeSkill(\n {\n ...parsed,\n target,\n client: clientArgForClients(clients),\n clients,\n },\n {\n ...options,\n log,\n },\n ),\n );\n }\n\n if (parsed.printJson) {\n process.stdout.write(\n `${JSON.stringify(results.length === 1 ? results[0] : results, null, 2)}\\n`,\n );\n return;\n }\n\n if (parsed.dryRun) {\n process.stdout.write(\n `${results.flatMap((result) => result.commands).join(\"\\n\")}\\n`,\n );\n return;\n }\n\n const installedNames = results.map((result) => result.displayName).join(\", \");\n const skillsAgents = [\n ...new Set(results.flatMap((result) => result.skillsAgents)),\n ];\n const mcpClients = [\n ...new Set(results.flatMap((result) => result.mcpClients)),\n ];\n const mcpUrls = [\n ...new Set(results.map((result) => result.mcpUrl).filter(Boolean)),\n ];\n const localCommands = [\n ...new Set(\n results\n .filter((result) => result.local)\n .flatMap((result) => result.commands),\n ),\n ];\n const authConnected = results.some((result) => result.connected);\n const pendingConnectCommands = [\n ...new Set(\n results\n .map((result) => result.connectCommand)\n .filter((command): command is string => Boolean(command)),\n ),\n ];\n const authLine = authConnected\n ? \"Authentication: completed.\"\n : pendingConnectCommands.length\n ? `Authentication: pending — run ${pendingConnectCommands.join(\" && \")}`\n : \"\";\n process.stdout.write(\n [\n `Installed ${installedNames} skill${results.length === 1 ? \"\" : \"s\"}.`,\n skillsAgents.length\n ? `Skill instructions: ${skillsAgents.join(\", \")}.`\n : \"Skill instructions: skipped.\",\n mcpClients.length\n ? `MCP config: ${mcpClients.join(\", \")}.`\n : \"MCP config: not required.\",\n mcpUrls.length\n ? `MCP URL${mcpUrls.length === 1 ? \"\" : \"s\"}: ${mcpUrls.join(\", \")}.`\n : \"\",\n authLine,\n localCommands.length ? `Local command: ${localCommands.join(\", \")}.` : \"\",\n \"Restart or reload selected agent clients if the skill is not visible yet.\",\n parsed.clientExplicit\n ? \"\"\n : `To add another client later, rerun with --client <client> (for example: --client claude-code).`,\n ]\n .filter(Boolean)\n .join(\"\\n\") + \"\\n\",\n );\n}\n"]}