mcpbeat Sign in

Building HTML Canvases Agent Skill

> Author a PostHog canvas with semantic HTML, CSS, and direct browser APIs — documents, articles, generative graphics, 2D canvas and WebGL experiences, and focused experiments where React components add no useful structure. Use after building-canvases has routed a canvas request to a plain-HTML/browser-API implementation. Covers the thin component wrapper the current runtime requires, styling and theming without Quill, drawing surfaces, and animation/cleanup patterns.

853 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
690
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/PostHog/posthog --skill building-html-canvases

The instruction itself

4 sections, as written by the author

Building HTML canvases

Some canvases are documents or graphics programs, not applications: a written report, a diagram,

a generative-art piece, a WebGL scene. For these, semantic HTML, CSS, and direct browser APIs are

the right tools — don't force Quill components or React state onto a static page.

The wrapper the current runtime requires

Every canvas keeps src/canvas.tsx as its mounted React entry component (default export, no

props). Keep the React layer as a thin shell and write the

experience in HTML/CSS/browser APIs inside it:

  • A document is JSX that is effectively semantic HTML — <article>, headings, lists, tables,

figures — with a <style> block for typography and layout. Write real, specific copy.

  • A drawing/WebGL program renders a <canvas> element and drives it imperatively from a

useEffect via a ref: get the 2D/WebGL context, run the setup and render loop there.

  • Clean up in the effect's return: cancel requestAnimationFrame loops, remove listeners, and

release contexts, so theme switches and remounts don't leak or double-run.

  • Mixing tiers is fine: a mostly static page can mount one interactive island, and a data board

can hand a chart's <canvas> to imperative code while React owns the chrome.

The import allowlist still applies (react, react-dom, @posthog/quill, recharts, lucide-react,

dayjs) — browser globals (document, CanvasRenderingContext2D, WebGLRenderingContext,

requestAnimationFrame, IntersectionObserver, Web Audio, etc.) need no import. Three.js and

other npm graphics libraries are not yet loadable; write against raw WebGL or 2D canvas until the

build pipeline's dependency admission ships.

Styling and theme without Quill

  • Use Tailwind utilities and/or a <style> block (keyframes and complex selectors are fine).
  • The host toggles a .dark class on the document root when the user's PostHog theme changes.

Define your colors as CSS variables under :root { … } with overrides under html.dark { … },

or use theme token utilities (bg-background, text-foreground, border-border) — never a

light-only hardcoded color.

  • For canvas/WebGL drawing colors, read the resolved token at runtime

(getComputedStyle(document.documentElement).getPropertyValue("--primary")) or your own CSS

variables, and re-read on theme change if the scene is long-lived.

Rules that still apply

  • No fetch()/XMLHttpRequest, no <script> tags, no dynamic import(), no remote assets —

the sandbox blocks them. PostHog data comes only through the ph bridge (see the

querying-canvas-data skill), including ph.capture for interaction analytics.

  • External links go through ph.openExternal(url) (posthog.com origins only), from a user

interaction.

  • Validate and publish through the canvas tools as described in validating-and-publishing-canvases.

Other skills for the same job

different authors, same section of the catalogue
Legacy Circuit Mockups
by github
vendor ×1

Generate breadboard circuit mockups and visual diagrams using HTML5 Canvas drawing techniques. Use when asked to create circuit layouts, visualize electronic component placements, draw breadboard diagrams, mockup 6502 builds, generate retro computer schematics, or design vintage electronics projects. Supports 555 timers, W65C02S microprocessors, 28C256 EEPROMs, W65C22 VIA chips, 7400-series logic gates, LEDs, resistors, capacitors, switches, buttons, crystals, and wires.

37k tokens
Hyperframes Keyframes
by aiskillstore
×1

> Use when a HyperFrames composition needs seek-safe 2D/3D keyframes, GSAP timelines, CSS keyframes, Anime.js, WAAPI, FLIP, paths, masks, SVG morph/draw, text trails, 3D depth, or `hyperframes keyframes` diagnostics. Don't use for broad scene strategy, brand design, media sourcing, captions, or general video planning.

17k tokens
Anydesign
by uxKero
×1

Analyze images, websites, and Figma files to extract their design and generate a `design.md` with token system, component inventory, and reconstruction notes. Use this skill whenever the user wants to understand, document, replicate, or audit the design of something visual: a screenshot, a URL, a Figma link, a Pinterest reference, a mockup, a competitor's site, a component, a dashboard, a landing page. Also when they ask 'extract the design system from X', 'document the style of Y', 'analyze this visually', 'convert this image into tokens', 'help me replicate this design', 'what palette does this site use', 'how is this built'. Also for single elements: 'copy this navbar', 'recreate this illustration', 'give me a prompt to regenerate this graphic' — element mode outputs a focused element.md, with token-grounded image-model prompts when the element is visual art. If the user brings any visual source and wants to understand it at a design level — this skill should activate.

728k tokens scripts
Brandkit
by lornshrimp
×1

Premium brand-kit image generation skill for creating high-end brand-guidelines boards, logo systems, identity decks, and visual-world presentations. Trained for minimalist, cinematic, editorial, dark-tech, luxury, cultural, security, gaming, developer-tool, and consumer-app brand systems. Optimized for intentional logo concepting, refined composition, sparse typography, strong symbolic meaning, premium mockups, art-directed imagery, and flexible grid layouts.

4k tokens
Imagegen Frontend Mobile
by lornshrimp
×1

Elite mobile app image-generation skill for creating premium, app-native screen concepts and flows. Designed for iOS, Android, and cross-platform mobile products. Prioritizes clean hierarchy, comfortably readable text, strong multi-screen consistency, controlled color palettes, non-generic creative direction, textured surfaces, image-led composition, tasteful custom iconography, and clean phone mockup framing. By default, screens should be shown inside a subtle premium iPhone or similar phone mockup with a visible frame, while the main focus stays on the app content itself. This skill generates images only. It does not write code.

10k tokens
Perf Web Optimization
by christophacham
×1

Optimize web performance: bundle size, images, caching, lazy loading, and overall page speed. Use when site is slow, reducing bundle size, fixing layout shifts, improving Time to Interactive, or optimizing for Lighthouse scores. Triggers on: web performance, bundle size, page speed, slow site, lazy loading. Do NOT use for Core Web Vitals-specific fixes (use core-web-vitals), running Lighthouse audits (use perf-lighthouse), or Astro-specific optimization (use perf-astro).

4k tokens
Brandkit
by nexu-io

| Premium brand-kit image generation skill for creating high-end brand-guidelines boards, logo systems, identity decks, and visual-world presentations. Trained for minimalist, cinematic, editorial, dark-tech, luxury, cultural, security, gaming, developer-tool, and consumer-app brand systems. Optimized for intentional logo concepting, refined composition, sparse typography, strong symbolic meaning, premium mockups, art-directed imagery, and flexible grid layouts.

4k tokens
Gsap Performance
by nexu-io

| Official GSAP skill for performance — prefer transforms, avoid layout thrashing, will-change, batching. Use when optimizing GSAP animations, reducing jank, or when the user asks about animation performance, FPS, or smooth 60fps.

1k tokens

How to use it

Copy the folder

Take posthog/building-html-canvases from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.