/jongio-skills:create-canvas-appfrom jongio-skills
Scaffolds GitHub Copilot App canvas extensions with Preact + htm, SSE state sync, per-user storage, Primer theming, and Lucide icons. Use for interactive side-panel UIs like dashboards, editors, trackers, and boards.
Ships in jongio-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
A canvas is an interactive surface the agent opens in a side panel via
open_canvas. Both the agent and the user act on the same state
through the same action handlers. Reach for a canvas when chat text or a diff
isn't enough: live dashboards, editors, spreadsheets, trackers, kanban/board
views, document previews, tool-specific workflows.
If the user just needs a non-visual agent tool, build a normal extension tool instead - not a canvas.
| Tier | Use when | How |
|---|---|---|
| Static HTML string | Read-only or near-static content; no inputs to protect | The runtime's vanilla scaffold (extensions_manage scaffold kind:canvas). |
| Preact + htm + this kit | Anything interactive: inputs, live updates, lists, forms, shared state | This kit. Default choice for real canvases. |
For the static tier, use the vanilla scaffold as generated and keep the HTML in
its single extension module. Do not copy canvas-kit/ into that extension. Move
to a generated Preact template as soon as the canvas needs inputs, shared state,
agent actions, or live updates. A one-file interactive counter is not the upgrade
path because it duplicates action logic and keeps state per panel.
The single most important reason to use the kit: Preact diffs the DOM, so a
live state push from the agent does not clobber focus, caret position, or
half-typed text in an input. The innerHTML = ... pattern most early canvases
use repaints the whole tree and loses keystrokes on every push. Don't do that.
extension.json ── lazy activation manifest (dormant until opened; omit for session scope or --eager)
extension.mjs ── the ONLY file that imports @microsoft/copilot-sdk/extension (thin adapter + host AI)
canvas.mjs ── your canvas: state load/save, action handlers (SDK-free)
canvas-kit/ ── the template's feature-scoped kit (do not edit)
web/index.html ── shell: loads /kit/theme.css and ./app.mjs
web/app.mjs ── your Preact view
extension.json). Project and user canvases ship an
extension.json ({ "version": 1, "initialization": "module", "canvases": [...] })
so the runtime lists the canvas without starting a Node process until first
open or action. canvas.mjs imports extension.json as the single source of
truth so live declarations cannot drift. Omit extension.json (pass --eager)
for session-scoped extensions (session-state/<id>/extensions/) or canvases
that need eager startup (hooks, session.on, systemMessage).resolveDomainId), not by instanceId - open the same domain
in two panels and they show the same data, and recovery under a fresh
instanceId keeps the data intact. Persistence goes through
userStore(extName, file) ($COPILOT_HOME/extensions/<name>/artifacts/<domain>.json),
sessionStore(sessionId, extName, file) (per-session scratch), or
workspaceStore(workspacePath, file). Note: in SDK callbacks,
ctx.session?.workingDirectory is the repo checkout while
session.workspacePath is $COPILOT_HOME/session-state/<sessionId>. All
three write atomically and serialize concurrent saves. For multi-user shared
boards, see githubStore in references/advanced-patterns.md.canvas.mjs.GET /state, GET /events
(SSE), and POST /action. mountCanvas wires them up; every state change fans
out to all open panels.Host, Origin, Sec-Fetch-Site (allowing initial GET HTML
iframe/document navigation while rejecting cross-site data, action, and
subresource requests), a strict default Content-Security-Policy
(configurable via config.csp), X-Content-Type-Options: nosniff, and
Content-Type: application/json on POST /action. Set
requireCapability: true for private plans or reports so /state, /events,
and /action also require a per-panel capability token; preserve that URL's
query string in memory only and never log, persist, or publish it.server.mjs is SDK-free so the whole runtime is testable with plain Node
HTTP (see test/http.test.mjs). Keep @microsoft/copilot-sdk/extension
imports in extension.mjs only (using joinSession({ canvases: { definitions: [canvas] } })
with ready barrier, session check, and SIGTERM/SIGINT shutdown).invoke(action, input).useState and must never be pushed to the server until the user commits it.Both callers (agent and UI) hit the same handler, and the runtime wraps every invocation in the same envelope, so model failures deliberately:
{ id, status }, { count }).
POST /action answers { ok: true, result }.{ ok: false, code, message } - HTTP 400 for a known kit error (e.g. an
unknown action) and 500 for a handler throw - and mountCanvas's
invoke rejects with a CanvasActionError carrying that code/message,
so a button handler can try/catch it. On the agent side, extension.mjs maps
the same error to a CanvasError. A throw is surfaced, never a crash.state.error and return so the error
card shows while the poll stays quiet (see the data template's refresh).An action's inputSchema is enforced by the runtime, not just declared: a
payload that violates it (wrong type, missing required field, out-of-enum value,
or an unexpected property under additionalProperties: false) is rejected with
an invalid_input error (HTTP 400) before your handler runs - from the
agent side too. So inputSchema is your typed contract; write it precisely and
your handler only sees well-shaped input. Business rules still live in the
handler (a schema-valid but empty " " title reaches the handler, which
throws → 500). Open input is validated against config.inputSchema the same way.
Optionally set config.stateSchema (same JSON-Schema subset, kit/validate.mjs)
to guard the durable shape: if a handler produces state that violates it, the
mutation is rolled back and the action fails loud (500) instead of persisting
corrupt state. It's opt-in - omit it and any state shape is allowed.
The kit vendors the exact Lucide set the Copilot App ships ([email protected],
byte-identical). Use it for every icon; do not hand-write SVGs or pull a CDN.
import { Icon } from "/kit/icons.mjs";
html`<${Icon} name="circle-check" size=${16} />`
Contract: names are kebab-case (circle-check, trash-2, list-todo).
viewBox is fixed 0 0 24 24, stroke-width is 2 - never pass
strokeWidth. Use sizes 12 · 14 · 16 · 20 · 24 · 32. Match the Copilot App's
glyph choices when there's an obvious mapping (e.g. open=circle-dot,
done=circle-check, bookmark=bookmark). iconNames() / hasIcon(name) are
available if you need to validate.
Link /kit/theme.css and build on its ck-* classes (ck-card, ck-btn,
ck-btn-primary, ck-input, ck-badge, ck-tabs, ck-status, ck-empty, ...).
They map to the Primer tokens the runtime injects onto the canvas document, each
with light/dark fallbacks, and set --status-bar-color: var(--ck-bg) so the
host panel header blends seamlessly with the canvas background. Add
canvas-specific CSS on top; don't restyle the primitives.
Badges are generic. Use the semantic variants ck-badge-success,
ck-badge-accent, ck-badge-muted, ck-badge-danger, ck-badge-attention and
map your statuses to them in the view (the reference does
open -> success, decided -> accent, parked -> muted). Don't add app-specific
status class names to the shared theme.
Loading & error primitives (don't hand-roll these):
ck-spinner - spin animation; pair with a Lucide loader, e.g.
html\<${Icon} name="loader-circle" class="ck-spinner" />``.ck-skeleton - shimmering placeholder block for content that's still loading.ck-callout / ck-callout ck-error - an inline notice / error surface for a
failed fetch, e.g. html\Motion safety is global. theme.css already ships a
@media (prefers-reduced-motion: reduce) guard that neutralizes all animations
and transitions (kit spinners/skeletons and any you add). You do not repeat
it per canvas - but do keep motion decorative, never the only signal.
/kit/core-client.mjs (and the backward-compatible full barrel /kit/client.mjs)
re-exports the full vendored Preact hook set, not just useState: useEffect,
useRef, useMemo, useCallback, useReducer, useContext,
useLayoutEffect, useImperativeHandle. Call hooks unconditionally at the top
of a component - before any early return (e.g. the if (!state) return ...
loading branch comes after your hooks).
It also exports formatting + id helpers so you stop reinventing them:
import { nid, relativeTime, compactNumber, percent } from "/kit/core-client.mjs";
nid(); // "lq3k9f2a" - short unique id
relativeTime(iso); // "5m ago" / "3h ago" / "2d ago" / a date
compactNumber(2_300_000); // "2.3M"
percent(1.25); // "+1.25%"
nid is also importable server-side in canvas.mjs via
import { nid } from "./canvas-kit/format.mjs" (the generator does this).
Import optional modules directly from /kit/icons.mjs and /kit/deeplinks.mjs
so scoped templates stay small.
The formatters are locale-aware - relativeTime ends in a
toLocaleDateString(), and compactNumber/percent go through
Number.prototype.toLocaleString, so their output depends on the host locale.
Keep the raw values in durable state (an ISO string, a Number) and format
in the view. Never store a formatted string and never parse one back.
Fragment is NOT exported. To return sibling nodes without a wrapper, use
htm's built-in empty-tag syntax - html`<><${A} /><${B} /></>` - or just
return an array of vnodes. Don't import { Fragment }; it isn't there.
Most real canvases aren't user-entered CRUD lists; they pull from the network and refresh. The shape:
fetch() lives in the action handler (or a helper it calls), never in the
view. Use the kit's safeFetch - it SSRF-guards the URL and applies a
hard timeout, so a caller-influenced source can't reach the internal network
and a slow upstream can't hang the panel:
import { safeFetch } from "./canvas-kit/net.mjs";
async function fetchItems(url) {
const res = await safeFetch(url, { headers: { Accept: "application/json" } });
if (!res.ok) throw new Error(`HTTP ${res.status}`);
return mapItems(await res.json());
}
safeFetch runs server-side on the loopback runtime, so it enforces an SSRF
guard (kit/net.mjs): it allows only http/https to a public host and
rejects loopback, link-local (incl. cloud metadata), and private ranges -
including every address the hostname resolves to - then fetches with an
AbortSignal.timeout. assertPublicUrl(url) / isBlockedAddress(ip) are also
exported if you need the check without the fetch. Anything you feed back to the
agent (e.g. via list_items) is still attacker-influenced text, so keep the
source one you choose and treat fetched content as untrusted (render it as
text, never innerHTML).
Expose a refresh action that fetches and writes the result into shared
state. Capture failures into state.error and return (don't throw) so a
background poll tick stays quiet while the error card shows. Capture the input
before the await, and write back with a functional set so a
concurrent action (another poll, a set_source) isn't clobbered:
refresh: {
inputSchema: { type: "object", properties: {}, additionalProperties: false },
handler: async ({ state, set }) => {
const sourceUrl = state.sourceUrl; // capture before await
try {
const items = await fetchItems(sourceUrl);
set((cur) => cur.sourceUrl !== sourceUrl // drop a stale response
? cur
: { ...cur, items, error: null, lastRefresh: new Date().toISOString() });
return { count: items.length };
} catch (err) {
set((cur) => ({ ...cur, error: `Couldn't load: ${err.message}`, lastRefresh: new Date().toISOString() }));
return { ok: false, error: String(err.message) };
}
},
},
Poll with the kit, not a raw setInterval. pollWhileVisible(tick, seconds) runs tick on an interval only while the panel is visible (so a
backgrounded canvas stops hitting the network) and returns a cleanup function -
a drop-in useEffect return:
import { pollWhileVisible } from "/kit/core-client.mjs";
// interval bound to durable state; rebuilds when it changes:
useEffect(() => pollWhileVisible(() => invoke("refresh"), state.autoRefreshSec || 0),
[state.autoRefreshSec]);
For a fixed interval you can skip the effect entirely:
mountCanvas({ view, poll: { action: "refresh", seconds: 60, immediate: true } }).
Stamp this whole shape with node scripts/new-canvas.mjs <name> --template data.
extension.json and a smoke test included):
node scripts/new-canvas.mjs <name> --dir <target> --title "Display Name"
Target .github/extensions/<name> for an in-repo extension (committed, shared
with the team), $COPILOT_HOME/extensions/<name> for a personal one (local to
you), or $COPILOT_HOME/session-state/<sessionId>/extensions/<name> for a
throwaway canvas scoped to just the current session (automatically omits
extension.json, or pass --eager explicitly). Add --template data for an
external-data canvas, or --template ai for a host-AI canvas (ctx.ai +
ctx.askAgent).extensions_reload, verify with extensions_manage
(Status: dormant before first open when extension.json is present), then
call open_canvas with canvasId: "<name>".extension.json (or
inline in canvas.mjs if eager) and edit createInitialState, action
handlers, and statusLine in canvas.mjs. Keep handlers pure and
idempotent: read state, call set(next), return a small result.web/app.mjs, render the shared state and call
invoke("<action>", input) from controls. Keep drafts in useState.add_item) and
wire the same verb to a button - one handler, two callers.A generated extension vendors only the canonical files and icons required by its
built-in template. canvas-kit/.kit-features.json records that exact selection.
Older extensions without the manifest remain full-kit consumers. The kit version
is exported by kit/version.mjs, /kit/core-client.mjs, and /kit/client.mjs.
KIT_VERSION when changing any kit file,
then run node scripts/sync-kit.mjs <extension-dir>.node scripts/check-kit-freshness.mjs <extensions-dir>
(exit 0 = fresh, exit 1 = drift).node scripts/vendor-lucide.mjs <version>,
then bump KIT_VERSION and re-sync vendored copies.reference/kit-demo/ - all-features interactive demo and live self-verification canvas (also exposed in this repo as a dormant project extension at .github/extensions/kit-demo/).reference/decision-log/ - focused working canvas (extension.json, scoped canvas-kit/, host AI, and ghapp:// deep-link builders).references/advanced-patterns.md - host AI, deep links, shared githubStore, env var requests, Canvas Dev Mode, standalone limits, and failure isolation.references/deeplinks.md - deep-link routes, parameter validation, and webview link handling.kit/ - canonical source of truth synced into extensions via scripts/sync-kit.mjs.@microsoft/copilot-sdk/extension (or legacy @github/copilot-sdk/extension) imports in extension.mjs only; canvas.mjs and web/app.mjs must stay SDK-free.canvas.mjs action handlers using safeFetch (SSRF guard + timeout), never from web/app.mjs, and render fetched text via Preact rather than innerHTML.requireCapability: true is set, preserve the panel URL query string in memory only; never log, persist, or publish capability tokens.open_canvas an instanceId matching ^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$ (<=128 chars, alphanumeric start). Malformed handles fail with Invalid canvas instance ID.client.createSession() from an extension; use ctx.ai(...) for silent generation and ctx.askAgent(...) from interactive UI actions only (askAgent is rejected on agent-side invokeFromAgent calls).ghapp:// URLs or omit target="_blank"; always use the kit deep-link builders (buildSessionDeepLink, etc.) with target="_blank".console.log in extension code (stdout is reserved for JSON-RPC).npm test in the skill repo (and node test/smoke.test.mjs inside the stamped canvas folder) to verify HTTP routes, SSE pushes, action schemas, CSP/SSRF/origin guards, and kit freshness.LICENSE (opens in a new tab)README.md (opens in a new tab)docs/invoke.png (opens in a new tab)docs/stock-ticker.png (opens in a new tab)evals/README.md (opens in a new tab)evals/create-canvas-app/eval.yaml (opens in a new tab)kit/client.mjs (opens in a new tab)kit/core-client.mjs (opens in a new tab)kit/deeplinks.mjs (opens in a new tab)kit/format.mjs (opens in a new tab)kit/github-store.mjs (opens in a new tab)kit/icons.mjs (opens in a new tab)kit/net.mjs (opens in a new tab)kit/server.mjs (opens in a new tab)kit/storage.mjs (opens in a new tab)kit/theme.css (opens in a new tab)kit/validate.mjs (opens in a new tab)kit/vendor/lucide.mjs (opens in a new tab)kit/vendor/preact-htm-standalone.mjs (opens in a new tab)kit/version.mjs (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
copilot-extension, canvas-extension, preact, htm, scaffolding
npx claudepluginhub jongio/skills --plugin jongio-skills28 skills in this plugin
/backlog-groom**WORKFLOW SKILL** - Groom GitHub backlogs across issue and source repositories, with or without Projects, using scoped evidence and approved changes. USE FOR: backlog-groom, groom backlog, triage GitHub issues, reconcile backlog, organize GitHub Project, audit delivery readiness. DO NOT USE FOR: implementing issues (use go), PR delivery (use pr), creating skills (use create-skill), dependency maintenance (use deps-doctor), Git cleanup (use git-tidy)./ci-doctor**WORKFLOW SKILL** - Diagnose, check, and optimize GitHub Actions workflows with stateless ETag-cached checkups, main failure root-cause repair in isolated worktrees, and workflow cost/security hardening. USE FOR: ci-doctor, ci health check, diagnose main CI failures, repair broken GitHub Actions builds, profile slow CI steps, harvest workflow flakes, harden and optimize GitHub Actions workflows. DO NOT USE FOR: single pull request delivery without workflow diagnosis (use pr), implementing a feature issue end to end (use go), standalone test suite audits without GitHub Actions checks (use test-doctor)./create-gh-pages-siteScaffold a working GitHub Pages website from a vetted template and wire it to deploy automatically. Use when the user wants to create, scaffold, or publish a site on GitHub Pages: a reviewable VitePress specification, a static page, an Astro or Eleventy site, a React (Vite) SPA, or a Jekyll site. Picks the right template, injects the correct base path for the target repo (the #1 thing people get wrong), adds the official GitHub Actions Pages deploy workflow, and sets it up in the user's current repo by default or a new one if asked. Does not stop at demo content: it digests the target repo (README, manifests, entry points, docs) and authors a site about that repo (CLI reference, API/usage page, feature tour, or catalog) with labeled image placeholders the user swaps in. Do NOT use for non-Pages hosting (Vercel/Netlify/Azure), deploying an existing app without a Pages target, or plain web pages unrelated to GitHub Pages./create-session-board-canvasOpen and maintain a live canvas for the current session's plan, kanban tasks, primary/subagent team, progress, blockers, owned PRs/issues, head-pinned CI, and delivery status, with opt-in cross-session project rollups and an operator attention inbox. USE FOR: create a canvas that shows session progress, session board canvas, session kanban, show session tasks and agents, show session PRs and CI in a canvas, go progress board, project status board, all sessions board, session attention inbox. DO NOT USE FOR: generic canvas apps (use create-canvas-app), footer pill management (use session-statusline), implementation workflow (use go)./create-skill**WORKFLOW SKILL** - Create and register a complete portable agent skill in a managed skills-repo.config.json repository or an existing skills repository. Produces focused instructions, documentation, deterministic tests, Vally evals, locked tooling, registration, and optional validated thumbnail art. USE FOR: create-skill, create a skill, add an agent skill, scaffold a portable skill, register a skill, add skill to managed repo, create skill in existing repo, generate an example skill from a fixture, add skill thumbnail art. DO NOT USE FOR: scaffolding a new marketplace collection from scratch (use create-skills-repo), editing one existing skill instruction without registration work (use skill-authoring), creating an agent persona./create-skills-repo**WORKFLOW SKILL** - Create or safely maintain a portable skills marketplace repository for multiple AI coding agents. INVOKES: bundled Node.js generator, standalone create-skill, standalone create-gh-pages-site, Vally, git, and gh. USE FOR: create a skills repo, scaffold an agent skills marketplace, upgrade a skills repository, sync skill manifests, check managed skills repo files, dry run a skills repository update. DO NOT USE FOR: authoring one skill (use create-skill), creating an unrelated GitHub Pages site (use create-gh-pages-site), or general repository health files (use repo-ready).Other plugins' skills for the same job