validating-and-publishing-canvases
できること
このスキルは、キャンバスのソースを検証し、宣言された権限を確認して、PostHogに安全に公開します。変更を壊したり、他の人の作業を失ったりせずに公開したいビルダー向けです。
使う場面
- ✓キャンバスの編集を終え、公開したいとき。
- ✓検証エラーや、バージョンの競合で公開が失敗したとき。
- ✓新しいバージョンを公開前にテストしたいとき。
スキルのリンク
https://github.com/PostHog/posthog/blob/master/products/canvas/skills/validating-and-publishing-canvases/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“キャンバスに問題がないか確認して公開してください。ただし、他の人の変更を上書きしないようにしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
AIは現在のバージョンを読み、受け取った検証メッセージを修正し、そのまま正確なバージョンに対して公開します。そのため、より新しい作業は上書きされません。その後、新しいビルドがキューに入り、完了するまではキャンバスは最後に成功したビルドを表示します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Validating and publishing canvases
A canvas's source lives in PostHog, versioned per publish. Publishing is guarded: every edit is based on a specific version, and the server refuses to overwrite newer work. Every publish queues a server-side build, and the canvas renders the last successful build.
The source project
canvas-source-retrieve returns:
project—schemaVersion(1),files(path → content),entryHtml("index.html"),dependencies(exact platform-pinned versions),canvasSdkVersion,capabilities.current_version_id— the version your edits are based on. Keep it; the publish needs it. It isnullfor a canvas that has never been published — pass thatnullon the first publish.
Keep index.html and dependencies exactly as returned. You may add relative source files and
admitted assets to the project. Use ?worker for a self-contained module worker and represent
binary assets as base64 entries in assets; new npm dependencies or dependency-version drift fail
validation.
Declare capabilities
The host enforces project.capabilities at runtime, so an undeclared ph call builds fine and
then dies in the rendered canvas. Declare:
capabilities.posthog.insights— every insight short id the canvas passes toph.loadInsight.capabilities.posthog.captureEvents— every event name it passes toph.capture.capabilities.posthog.inlineQueries: true— when it callsph.queryat all.capabilities.posthog.agentRequests: true— when it callsph.agent.request.capabilities.connectors— one{ "provider", "tools" }entry per third-party provider the canvas reads throughph.connectors.call, listing every tool it calls on that provider. A provider is a native id (github) ormcp:<server host>(mcp:mcp.calendly.com). Unknown providers, unregistered native tools, and private MCP hosts fail validation; every declared tool must haveis_read_only: truein the catalog. An upstream hint alone does not grant access. A canvas with connectors cannot declare shared state.capabilities.network.origins— each exact HTTPS origin used byfetch,XMLHttpRequest, or an external stylesheet, image, font, media file, or frame. Remote scripts remain blocked. Do not include paths, credentials, queries, fragments, or wildcards. The host must be public: loopback and private IPs, single-label names likeintranet, and the.local,.localhost,.internal, and.home.arpasuffixes are all rejected, so a local dev host such ashttps://localhost:8010fails validation with aninvalid_network_originerror. Data sent to a declared origin leaves PostHog and appears in the capability review before promotion.
Before validation, inventory every literal external URL in every source file. Classify navigation
links and ph.openExternal() URLs as navigation; they do not need a network origin. For every
request or resource URL, declare its scheme + host + optional port only. Include every origin a
request redirects to and every secondary origin a stylesheet references for fonts or images.
Never infer that one CDN hostname covers another.
Validation rejects undeclared literal calls and resource URLs (capability_missing_* diagnostics)
so you can fix them before publishing. Dynamic URLs and redirect destinations cannot be inferred,
so the inventory is still required even when validation is clean.
Validate until clean
canvas-validate-create is side-effect free; call it as often as needed.
Diagnostics carry severity, a stable code, a message, and (for file-specific problems)
path and line:
errordiagnostics block publishing — fix all of them. Common ones:import_not_allowed(bare imports are limited to the dependencies returned in the source project),forbidden_dynamic_import/forbidden_require/forbidden_inline_script,invalid_path,capability_missing_insight/capability_missing_capture_event/capability_missing_inline_queries/capability_missing_agent_requests/capability_missing_network_origin,dependency_not_admitted/dependency_version_mismatch,platform_token_redeclared(a CSS variable named like a Quill token that the platform stylesheet sets on every element, so the value never applies; prefix your own variables), and path/size violations.warningdiagnostics don't block, but heed them:network_fetch/network_xhrmean the code reaches for the network directly.
よくある質問
公開時に競合が起きたらどうなりますか?
読み込んだ後にキャンバスが変更されたことを意味します。AIは最新版を読み、自分の変更をマージして再度公開を試みます。
公開後も古いバージョンが見えるのはなぜですか?
PostHogは最後に成功したビルドを表示し、新しいビルドは、キューに入ったビルドが完了してから表示されます。
公開後にデータ呼び出しが失敗するのはなぜですか?
データソースは、キャンバスの設定で宣言されていないと使えません。
詳細
作者による元の説明
Validate and publish a canvas source project safely: the source-project shape, declared capabilities, reading the current version pointer, iterating on validation diagnostics, guarded publishing with expected_current_version_id, staging a draft build and promoting it, waiting out the queued build, and recovering from a 409 version_conflict or a 429 capacity limit without overwriting concurrent work. Use whenever a canvas edit is ready to save, a draft build is wanted, a canvas publish or build returns diagnostics or a conflict, or a task needs to understand canvas version history.
repo: PostHog/posthog
人気
- GitHubのスター
- 41k
- ランキング
- #6843
- ライセンス
- —
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
depot-ci
41kエージェントが、GitHub Actionsの代替であるDepot CIのワークフローを設定し実行できるよう支援します。既存のワークフローの移行や、実行ログの確認も含みます。
depot-container-builds
41kエージェントが、Depotのリモート・ビルダーでDockerイメージを作れるよう支援します。マルチプラットフォームのイメージ、レジストリへのプッシュ、ビルド失敗の修正を含みます。
depot-github-runners
41kエージェントが、GitHub Actionsのジョブを Depot が管理するランナーに移し、ランナーのサイズとラベルを選び、ランナー設定の問題を解決できるよう支援します。
editing-agents-md
41kエージェントが、AGENTS.mdとCLAUDE.mdのどちらにルールを書くべきかを判断し、ファイルを膨らませずに守られやすい形で書けるよう支援します。
似ているスキル
angular-developer
280kエージェントがAngularのコードを作成し、プロジェクト構成についてアドバイスできるようにします。新しいプロジェクトの開始、コード部品の作成、パフォーマンスやアクセシビリティの改善に役立ちます。
frontend-a11y
280kエージェントが Web インターフェースを誰にとっても使いやすくするよう支援します。スクリーンリーダーやキーボード操作に対応し、サイトやアプリが適切に動作するようにします。
frontend-patterns
280kエージェントがフロントエンド開発の最新パターンを適用できるようにします。React と Next.js において、パフォーマンスの最適化、状態管理、ベストプラクティスの遵守を行います。