composing-grid-canvases
它能做什么
本技能在网格画布(包括你的主页画布)上放置、移动、调整大小和配置小组件。适合希望用现成小组件来安排 PostHog 总览页面的人。
适用场景
- ✓当你想把天气或任务等小组件添加到主页画布时。
- ✓当你想在网格上重新排列或调整小组件大小的时候。
- ✓当你希望用一个请求就设置好整套小组件的时候。
技能链接
https://github.com/PostHog/posthog/blob/master/products/canvas/skills/composing-grid-canvases/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请把任务列表小组件添加到我的主页画布,并放在注册图表旁边。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 会先搜索合适的现有组件,如果可能就进行配置。如果没有合适的组件,它会调整一个相近的组件,或新建一个组件,然后更新网格布局。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Composing grid canvases
A grid canvas is a composition, not an app: a grid of placements, each rendering a component canvas (a reusable widget with its own source, build, and placement contract). The user's home canvas is an ordinary grid canvas in their personal channel. Layout is data — publishing or patching one is live immediately, with no build.
Three canvas kinds share one lifecycle:
freeform— a standalone app (thebuilding-canvasesskill owns these).component— a reusable widget. Same source/build pipeline as freeform, plus a placement contract. Visibility rides its channel: personal channel = private, team channel = shared.grid— a layout of placements referencing components. No file source; layout only.
The resolution ladder: configure, fork, build
When a grid placement needs content ("a weather widget here", "a kanban of my tasks"), resolve in this order — placing an existing component beats authoring a duplicate:
- Search the store:
canvas-listwithkind=componentandsearch=<what the widget shows>. A component is placeable when bothcomponent_metaandpublished_build_idare set. If itsconfigSchemacan express the request ("weather for Lisbon" → existing weather component withconfig: {"location": "Lisbon"}), place and configure it — write no code. - Fork when a component is close but its config cannot express the ask: read its source
(
canvas-source-retrieve), create a new component (canvas-createwithkind=component), adapt, publish. Name the difference in the new component's description. - Build new when nothing fits — see "Building a component" below.
New components land in the channel you create them in. Create them in the same channel as the grid they serve unless the user asks to share them more widely.
Building a component
A component is authored exactly like a freeform canvas — load building-react-quill-canvases (or
building-html-canvases) plus querying-canvas-data and validating-and-publishing-canvases —
with three additions. A component that shows PostHog data follows the same verifiability rule as
any canvas: an insight-backed figure links its saved insight, an ad-hoc query exposes the exact
query that ran (see "Verifiability" in querying-canvas-data).
Start from the complete, buildable project in references/component-example.md; its envelope, placement contract, capability declarations, and defensive ph.state access are the parts that break when improvised.
Create with
kind=componentand adescriptionwritten for store search: say what the widget shows and what its config controls. Future placements are found by this text.Declare the placement contract in the project's top-level
componentkey:{ "component": { "size": { "defaultW": 2, "defaultH": 1, "minW": 1, "minH": 1, "maxW": 4 }, "configSchema": { "type": "object", "properties": { "location": { "type": "string", "description": "City to show weather for" } } } } }Size is in grid units (widths 1–12, heights 1–40);
minW <= defaultW <= maxW. The range is advisory: users may resize a placement to any size, so it informs defaults and warnings, never rejections. The config schema vocabulary is an allowlist —type,title,description,default,properties,required,additionalProperties,items,enum,const,minimum,maximum,minLength,maxLength,minItems,maxItems,format. No$ref, nopattern— validation rejects them.Design responsively. Give the component's root
min-h-screenso it fills the placement iframe's viewport and grows past it as content demands. Adapt the layout to any size the user drags: a 2×1 placement is a glanceable tile; a 6×4 is a full app surface. Do not useh-screenon the root: a fixed viewport height caps a flex column, so tall children shrink and clip instead of scrolling. Do not useh-fullon the root either: a published component's artifact shell gives itshtml,body, and#rootelements no explicit height, soheight: 100%collapses to the content height. Render usefully atminW×minH, and treatconfigas the only per-placement input.
Publish and wait for the build like any canvas — a component with no ready build cannot go live on a grid.
Composing a whole canvas
A whole-canvas ask ("a home canvas that summariz
常见问题
为什么要复用现有组件?
放置现成的组件更快,也能避免重复,因此本技能会先检查组件库。
修改布局需要重新构建吗?
不需要。布局是已保存的数据,修改会立即显示。
谁能看到我添加的组件?
可见范围取决于所在频道。个人频道中的组件保持私密,团队频道中的组件则会共享。
详情
作者的原始描述
Compose PostHog grid canvases — widget grids (including the user's home canvas) built from reusable component canvases. Use when a task asks to add, fill, move, resize, or remove a widget on a grid or home canvas, to compose a whole canvas of widgets from one ask, to build a reusable widget/component, or when a placement id or grid canvas id is the target. Covers the component store search → configure → fork → build ladder, the component placement contract (size, configSchema), the placement lifecycle (pending/generating/live/failed), the guarded layout patch loop, and reading the canvas's com
repo: PostHog/posthog
热度
- GitHub 星标
- 41k
- 排名
- #6841
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
depot-ci
41k帮你的智能体设置并运行 Depot CI 工作流(GitHub Actions 的替代方案),包括迁移现有工作流和读取运行日志。
depot-container-builds
41k帮你的智能体在 Depot 的远程构建器上构建 Docker 镜像,包括多平台镜像、推送到镜像仓库,以及修复构建失败。
depot-github-runners
41k帮你的智能体把 GitHub Actions 任务迁移到 Depot 托管的运行器上,选择运行器规格和标签,并排查运行器设置问题。
editing-agents-md
41k帮你的智能体判断某条规则应写入 AGENTS.md 还是 CLAUDE.md,并以不会让文件臃肿的方式写下,确保规则真正生效。