# Canvas Anywhere

> canvas-anywhere

- Skill: `awesome-skills/canvas-anywhere` (Agent Skill, multi-file: 21 files)
- Install (CLI): `npx get-skill add awesome-skills/canvas-anywhere`
- Raw SKILL.md: https://api.skillmd.com/api/skills/awesome-skills/canvas-anywhere/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: awesome-skills (https://skillmd.com/u/awesome-skills)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/awesome-skills/canvas-anywhere

---


# canvas-anywhere

Render `.canvas.tsx` files in any browser, pixel-identical to Cursor's canvas panel.

**Why this exists**: Cursor Canvas quality comes from its runtime (React components + design tokens), which only lives inside Cursor. This skill serves that same runtime from the local Cursor install to any browser, so the same `.canvas.tsx` file renders identically everywhere. Write once with the `cursor/canvas` API, view anywhere.

## Quick start

```bash
node <skill-dir>/scripts/canvas-serve.js path/to/file.canvas.tsx --watch --open
# → http://127.0.0.1:4173/  (opens in default browser)
```

Requirements:
- Node ≥ 18, esbuild (`npm install` in the skill dir, or any reachable esbuild)
- A local Cursor install (the runtime file `canvas-runtime.esm.js` is read from
  `/Applications/Cursor.app/...`; override with `CURSOR_CANVAS_RUNTIME=/path/to/file`)

No network access at runtime. The server binds 127.0.0.1 only.

## When to use a canvas (portable judgment from Cursor's own canvas skill)

The trigger is **user intent**, not response shape. Use when the agent produces a
**standalone analytical artifact**: quantitative analyses, billing/security/architecture
reviews with structured findings, data-heavy tables, timelines, anything where the
data IS the deliverable.

Do NOT use for: work requested in a specific tool, specific deliverables (draft reply,
code fix, PR), targeted debugging, short answers. If you would write a large markdown
table, that is a signal to consider a canvas.

## Authoring rules (same as Cursor canvas skill)

- One `.canvas.tsx` file, default-export the top component.
- Import only from `cursor/canvas`. No npm packages, no fetch, no Node built-ins.
- Embed all data inline.
- Read `<skill-dir>/sdk/*.d.ts` for the exact component surface (Card, Table, Stat,
  Pill, UsageBar, DiffView, charts, hooks). Referencing a non-existent export is the
  most common runtime error.
- Never render empty states; label every plot (metric title, axis units, legend,
  source caption).
- Anti-slop: no gradients, no emoji icons, no box-shadows, no rainbow coloring, no
  wall of identical cards. Color from `useHostTheme()` tokens only.

## Workflow

1. Decide (judgment above).
2. Write the `.canvas.tsx` next to the relevant work (any directory).
3. Preview: run canvas-serve (below). Check the browser console — the page shows a
   bootstrap error card if the module failed; `_status` endpoint reports build state.
4. Iterate with `--watch` (rebuild on save; refresh browser).
5. Deliver the file path + the one-liner command so the user can re-open it anytime.

## canvas-serve reference

```
node scripts/canvas-serve.js <file.canvas.tsx> [--watch] [--open]
env: PORT (default 4173), CURSOR_CANVAS_RUNTIME (runtime override)
```

| endpoint | serves |
|---|---|
| `/` | HTML shell (same one Cursor serves: focus rings, scrollbar, padding) |
| `/_runtime` | canvas-runtime.esm.js (React + all components, self-contained) |
| `/_app` | the esbuild-transformed canvas module |
| `/_status` | `{ok, error}` build state |

The transform matches Cursor's internal one exactly (`jsx: transform`,
`jsxFactory: React.createElement`, imports stripped — the runtime injects
React/components as globals). `useHostTheme()` falls back to
`prefers-color-scheme` outside Cursor, so dark/light still works.
`dispatchCanvasAction` (canvas → IDE actions) is inert outside Cursor.

## Hard-won authoring lessons (from real breakage)

- **The #1 white-screen cause**: inventing API that does not exist. `Table` is
  data-driven (`headers` + `rows` props) — there is no `TableHead`/`TableRow`/
  `TableHeaderCell`. `CardHeader` takes plain-text children + a `trailing`
  slot, not `title`/`subtitle` props. `theme.tokens` has six semantic groups
  (`text/bg/fill/stroke/accent/diff`) — no `spacing`/`surface`. Always check
  `sdk/*.d.ts` before writing.
- **What makes a canvas look "Cursor-native"** is not the CSS — it is using
  the full component vocabulary: charts (Line/Bar/Pie) carry the page, Callout
  gives tonal sections, striped Tables with category Swatches, Stat rows,
  Pill clusters, TodoList for state. A canvas with only text + cards reads
  flat no matter how correct the tokens are.
- **Debug loop**: serve with `--watch`, poll `/_status` for build errors, use a
  headless browser (or the browser console) for runtime errors. The runtime
  renders a bootstrap error card on module failure — a blank page usually
  means a component threw (bad props / missing export).

## Limitations

- Needs a local Cursor install for the runtime file (it is Cursor proprietary;
  this skill never bundles or downloads it — it only reads the user's own copy).
- IDE integrations (open file, insert text) do not work outside Cursor; pure
  display canvases are unaffected.

