agentleFS
MicrosoftKnown publishermicrosoft/vscode/extensions/copilot/assets/prompts/skills/create-canvas/SKILL.md

create-canvas

Skill196k starsChanged 18 days agoMITView on GitHub

Create a Copilot extension canvas at user, workspace, or plugin scope.

  • Reads credentials

1 other project uses a version of this.

Trending

More talk lately.about the whole repository

Dec 2025: 2 mentionsJan 2026: 1 mentionFeb 2026: 1 mentionMar 2026: 1 mentionApr 2026: 2 mentionsMay 2026: 4 mentionsJun 2026: 2 mentionsJul 2026: 2 mentionsAug 2026: 0 mentionsSep 2026: 3 mentionsOct 2026: 1 mentionNov 2026: 2 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/vscode repository that our weekly crawl found. There is no adoption data for this file yet.

Most recently taken up by

Who's talking about microsoft/vscode

The biggest 5 of 96 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 96

Talked about on Bluesky, Hacker News and GitHub (96 times).

On Bluesky · 48

43 more on Bluesky

On Hacker News · 39

34 more on Hacker News

On GitHub · 9

4 more on GitHub

The file

Show its rules and text

We split this skill into the rules it gives an agent

26 rules. About 0 are common, 7 are distinctive, and 19 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 19

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create a working canvas extension at the user's chosen scope.

    line 8
  2. Very specific:

    Before writing any files, use ask_user to offer all three scopes unless the user already specified a scope.

    line 14
  3. Very specific:

    Use the selected extension directory as <extension-dir> throughout implementation and validation.

    line 26
  4. Distinctive:

    If the requested canvas purpose is unclear, ask what it should display or let the user do.

    line 30
  5. Distinctive:

    Check the selected location for existing extension conventions and reusable UI/server helpers, including the manifest for plugin scope.

    line 36
  6. Very specific:

    Create <extension-dir>/extension.mjs.

    line 42
  7. Very specific:

    Use ES modules and import createCanvas, CanvasError, and joinSession from @github/copilot-sdk/extension.

    line 44
  8. Very specific:

    Do not create a package.json or install @github/copilot-sdk.

    line 45
  9. Very specific:

    Never write to stdout with console.log.

    line 46
  10. Very specific:

    Treat open() as idempotent.

    line 49
  11. Distinctive:

    write each file atomically: write a uniquely named temporary file in the same directory, then rename it over the target.

    line 55
  12. Distinctive:

    Use semantic HTML, keyboard-accessible controls, visible focus, labels, and ARIA status text.

    line 58
  13. Very specific:

    If the canvas takes no input, omit inputSchema.

    line 71
  14. Distinctive:

    Every action must have a handler and its own JSON Schema when it accepts input.

    line 73
  15. Very specific:

    Do not rely on onClose when the user closes a canvas view.

    line 75
  16. Very specific:

    Keep extension.mjs focused on wiring.

    line 77
  17. Very specific:

    Keep the extension eager, without extension.json, when it registers hooks, observes session events in the background, contributes commands, …

    line 83
  18. Very specific:

    Import the same declarations in extension.mjs and add only handlers, so the two cannot drift.

    line 104
  19. Very specific:

    Call await joinSession(...) and set up its listeners at the module's top level, so they finish before the module finishes loading.

    line 105
  20. Very specific:

    Run node --check "<extension-dir>/extension.mjs" and the smallest relevant extension tests.

    line 125
  21. Very specific:

    Call extensions_reload after creating or modifying the extension.

    line 127
  22. Distinctive:

    After reload, do not claim success until the runtime confirms the canvas:

    line 128
  23. Very specific:

    call list_canvas_capabilities for the canvas ID.

    line 129
  24. Very specific:

    call open_canvas with a stable instanceId and schema-valid input.

    line 130
  25. Very specific:

    call at least one invoke_canvas_action when actions exist.

    line 131
  26. Very specific:

    Call open_canvas again with the same instanceId and confirm the canvas shows the preserved state instead of starting over.

    line 132

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Create a working canvas extension at the user's chosen scope. Do the implementation rather than only returning a sample.

Any Copilot host may load the extension. Build only on the Copilot SDK contract described here; do not depend on environment variables, paths, APIs, or UI behavior specific to one host.

Choose the scope

Before writing any files, use ask_user to offer all three scopes unless the user already specified a scope. Do not infer workspace scope merely because a workspace is open.

ScopeEntry pointAvailability
User<copilot-home>/extensions/<name>/extension.mjsPersonal canvas available across the user's workspaces.
Workspace<workspace-root>/.github/extensions/<name>/extension.mjsRepository-owned canvas shared with users of that workspace when checked in.
Plugin<plugin-root>/extensions/<name>/extension.mjsCanvas bundled in an installable plugin that can be shared with teammates across workspaces.

Resolve <copilot-home> using process.env.COPILOT_HOME exactly as given whenever it is non-empty, otherwise path.join(os.homedir(), '.copilot').

For plugin scope, ask whether to use an existing plugin or create a new one, and where its source lives, unless already specified. Work in the plugin source, not an installed cache. For a new plugin, create .plugin/plugin.json with name, version, description, and "extensions": "extensions/". For an existing plugin, preserve its metadata and components, honor its configured extension directory, or add the extensions field if missing.

Use the selected extension directory as <extension-dir> throughout implementation and validation. Do not create copies at other scopes.

Clarify only when needed

If the requested canvas purpose is unclear, ask what it should display or let the user do. If durable state is required but its identity or lifetime is ambiguous, ask whether the state belongs in a workspace artifact or private extension storage.

Inspect first

Before writing:

  1. Check the selected location for existing extension conventions and reusable UI/server helpers, including the manifest for plugin scope. Do not copy host-specific dependencies from them.
  2. Choose a short kebab-case extension folder name and a stable kebab-case canvas ID. The canvas ID also names the extension's private data folder, which every repository on the machine shares, so make it distinctive: qualify generic names with the project or domain, for example contoso-release-board rather than board.
  3. Identify the domain identity for durable state, such as a file path, document ID, or record ID. instanceId identifies a panel, not its data.

Implement

Create <extension-dir>/extension.mjs. When the extension only contributes canvases (and native tools), also create <extension-dir>/extension.json so the runtime can list the canvas without starting the extension; see Start on first use.

  • Use ES modules and import createCanvas, CanvasError, and joinSession from @github/copilot-sdk/extension.
  • Do not create a package.json or install @github/copilot-sdk; the runtime resolves it automatically.
  • Never write to stdout with console.log. Use session.log() for diagnostics.
  • Bind embedded HTTP servers to 127.0.0.1 on an ephemeral port.
  • Return an HTTP URL from open(). Do not place credentials or private state in the URL.
  • Treat open() as idempotent. Reopening the same instanceId must reuse or safely replace its live server and reload state from the stable domain identity.
  • For user and plugin scopes, do not hard-code the current workspace's path. Accept workspace-specific resources through canvas inputs or actions.
  • Store repo-owned artifacts at a sensible workspace path when the user expects them to be versioned or directly editable.
  • Store private durable data outside the repository, in extension-data/<canvas-id>/ under the resolved Copilot home that every Copilot host shares, regardless of extension scope. Create directories on first use.
  • Several sessions, workspaces, and hosts may run the extension at the same time, so:
    • key records by their domain identity so workspaces do not overwrite each other's state;
    • write each file atomically: write a uniquely named temporary file in the same directory, then rename it over the target;
    • store a format marker and version with the data, validate them and the data's shape on every read, and report unrecognized or corrupt data instead of overwriting it;
    • report storage failures from open() or actions with CanvasError instead of failing to load.
  • Use semantic HTML, keyboard-accessible controls, visible focus, labels, and ARIA status text. The page is ordinary web content with no privileged host bridge; use same-origin HTTP endpoints or server-sent events.
  • Escape untrusted values before inserting them into HTML and validate every HTTP and action input.

Declare the canvas with:

  • a short single-sentence description;
  • an optional inputSchema;
  • agent-facing actions[];
  • an open handler;
  • an onClose handler that stops instance-owned servers.

Rules:

  • If the canvas takes no input, omit inputSchema. If it declares an object schema, callers must open it with an object such as {}, not null.
  • Action names must not start with canvas..
  • Every action must have a handler and its own JSON Schema when it accepts input.
  • Return raw action results. Throw new CanvasError(code, message) for expected failures.
  • Do not rely on onClose when the user closes a canvas view; hosts may hide a presentation without closing its instance. Preserve the live instance so a later agent reopen can show the same state.

Keep extension.mjs focused on wiring. Put substantial HTML, CSS, client JavaScript, schemas, storage, and domain logic in sibling modules or asset files.

Start on first use

An extension with a valid extension.json stays dormant until its canvas is first opened or one of its actions or native tools is called. Without the file, or when the runtime rejects it, the extension starts eagerly with every session.

Keep the extension eager, without extension.json, when it registers hooks, observes session events in the background, contributes commands, or must run before anyone opens its canvas: none of these start a dormant extension.

Otherwise write the canvas declarations to extension.json:

{
	"version": 1,
	"initialization": "module",
	"canvases": [{
		"id": "contoso-release-board",
		"displayName": "Release Board",
		"description": "Tracks the release checklist for the current milestone.",
		"icon": "./icon.png",
		"actions": [{ "name": "add_item", "description": "Adds a checklist item.", "inputSchema": { "type": "object", "properties": { "title": { "type": "string" } }, "required": ["title"] } }]
	}]
}
  • Each canvas entry takes the same fields as createCanvas() without its handlers: id, displayName, description, and optionally icon, inputSchema, and actions (name, and optionally description and inputSchema). Native tools go in a tools array, declared as for joinSession({ tools }).
  • Omit optional fields that have no value; never write null. Unknown fields, another version, or a file larger than 256 KiB make the runtime ignore extension.json and start the extension eagerly, reporting only a diagnostic.
  • icon is an optional PNG path relative to the entry point, inside the extension directory, such as ./icon.png. Use a small square image. Hosts show their default icon when it is missing or unsuitable.
  • Import the same declarations in extension.mjs and add only handlers, so the two cannot drift. When the registered canvas differs from extension.json, the runtime rejects its first open and withdraws the canvas until the extensions reload.
  • Call await joinSession(...) and set up its listeners at the module's top level, so they finish before the module finishes loading. The runtime waits for that point before it delivers the first open, and fails the activation when joinSession() was not called by then.
import { CanvasError, createCanvas, joinSession } from '@github/copilot-sdk/extension';
import declaration from './extension.json' with { type: 'json' };

const actionHandlers = { add_item: async ({ instanceId, input }) => { /* ... */ } };

const session = await joinSession({
	canvases: declaration.canvases.map(canvas => createCanvas({
		...canvas,
		...(canvas.actions ? { actions: canvas.actions.map(action => ({ ...action, handler: actionHandlers[action.name] })) } : {}),
		open: async ({ instanceId, input }) => { /* ... */ },
		onClose: async ({ instanceId }) => { /* ... */ },
	})),
});

Validate

  1. Run node --check "<extension-dir>/extension.mjs" and the smallest relevant extension tests. When extension.json exists, confirm it parses as JSON and declares exactly the canvases, actions, and tools that extension.mjs registers. For plugin scope, also validate the manifest and its extension directory.
  2. For plugin scope, ensure the plugin is installed or loaded from its source using the host's supported plugin workflow, with the user's approval as needed. Creating plugin files alone does not make the canvas discoverable.
  3. Call extensions_reload after creating or modifying the extension. This restarts the extension providers that are running and leaves dormant ones stopped; canvases that were visible are reopened after their providers start again, including those of extensions that start on first use.
  4. After reload, do not claim success until the runtime confirms the canvas:
    • call list_canvas_capabilities for the canvas ID;
    • call open_canvas with a stable instanceId and schema-valid input; for an extension with extension.json, this first open starts it, and an error that its contribution does not have matching metadata means extension.json and extension.mjs disagree;
    • call at least one invoke_canvas_action when actions exist.
  5. Call open_canvas again with the same instanceId and confirm the canvas shows the preserved state instead of starting over.

Summarize the selected scope and location, files created, whether the extension starts on first use, the canvas and action IDs, where state is stored, any plugin installation or loading steps, and the reload and runtime verification results.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.