composing-grid-canvases

Compose PostHog grid canvases by placing, configuring, and building reusable component widgets.

713|118|Updated Aug 11, 2020
One-click install
npx skills add https://github.com/PostHog/posthog-foss --skill composing-grid-canvases
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: composing-grid-canvases
Source: https://github.com/PostHog/posthog-foss/tree/main/products/canvas/skills/composing-grid-canvases
Command: npx skills add https://github.com/PostHog/posthog-foss --skill composing-grid-canvases

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Building or editing a PostHog grid canvas (including the user's home canvas) requires coordinating component discovery, placement contracts, layout geometry, and a guarded patch lifecycle — doing this ad hoc produces overlapping placements, unpublished components, and broken widgets.

Core Features & Use Cases

  • Component resolution ladder: Search the component store, fork an existing component, or build a new one — in that order — so existing widgets are reused instead of duplicated.
  • Placement contract authoring: Declare component size ranges and configSchema (an allowlisted JSON-schema vocabulary) so widgets are placeable and configurable on any grid.
  • Guarded layout editing: Read layouts with canvas-layout-get and write them with canvas-layout-patch or canvas-layout-publish, re-reading and retrying on 409 conflicts.
  • Use Case: A user asks for a home canvas summarizing their work in progress. The Skill plans one placement per concern, resolves each via the store search → fork → build ladder, batches the layout into a single publish, and finishes with every placement live.

Quick Start

Ask the agent to add a weather widget for Lisbon to your home canvas, and it will search the component store, configure or build the component, and patch the grid layout.

Quick Start

Tell the agent to compose a home canvas with widgets for your open tasks, recent insights, and error tracking, and it will plan, resolve, and publish the full layout.

Frequently Asked Questions about composing-grid-canvases

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a widget to a PostHog grid canvas?

Adding a widget follows a resolution ladder: first search the component store with canvas-list filtered by kind=component, then configure an existing component if its configSchema fits, fork it if close, or build a new one. The placement is then written via canvas-layout-patch with an add_placement or update_placement operation.

How do I build a reusable component canvas in PostHog?

Create a canvas with kind=component and declare a placement contract in the project's top-level component key, including size bounds and a configSchema. Author the source like a freeform canvas, give the root h-screen so it fills the placement iframe, publish it, and wait for the build before placing it on a grid.

What does the placement lifecycle pending, generating, live, and failed mean?

A placement's status tells the renderer what to show: pending means a box was drawn but not described, generating means an agent task is filling it, live means it renders a published component at a version, and failed means generation failed with the prompt kept for retry.

Why does my canvas layout publish fail with component_not_found or placement_config_invalid?

component_not_found means the component id is wrong, deleted, not a component, or not visible to the acting user. placement_config_invalid means the config does not match the component's configSchema; fix the config values rather than the layout geometry.

Can a component be placed at a size outside its declared contract?

Yes. The size contract is advisory: placement_size_out_of_contract is a warning, not an error, and the publish still succeeds. Components must render responsively at any size the user drags, from a glanceable tile to a full app surface.

What configSchema keywords are allowed in a component placement contract?

The config schema vocabulary is an allowlist: type, title, description, default, properties, required, additionalProperties, items, enum, const, minimum, maximum, minLength, maxLength, minItems, maxItems, and format. Validation rejects $ref and pattern.