copying-endpoints-across-projects
できること
このスキルは、エンドポイントのクエリ、変数、設定を別のプロジェクトや、同じプロジェクト内の新しいコピーにコピーします。エンドポイントを本番に昇格させたり、既存のものに触れずに変更を試したりしたい人向けです。
使う場面
- ✓ステージングプロジェクトから本番プロジェクトにエンドポイントを移したいとき。
- ✓ライブのものに触れずに変更できるよう、エンドポイントのコピーがほしいとき。
- ✓同じ組織の別のプロジェクトで、エンドポイントの設定を再現したいとき。
スキルのリンク
https://github.com/PostHog/posthog/blob/master/products/endpoints/skills/copying-endpoints-across-projects/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“ステージングプロジェクトの売上エンドポイントを、本番プロジェクトにコピーしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
PostHogにはエンドポイントを直接コピーする機能がないため、エージェントは元の設定をすべて読み取り、ターゲットのプロジェクトで作り直します。その2つの手順の間に、プロジェクトを切り替える必要があります。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Copying endpoints across projects
This skill duplicates a PostHog endpoint — a saved HogQL or insight query exposed as a callable API route — either into another project in the same organization, or under a new name in the same project.
The one thing to know first
There is no server-side endpoint copy operation. Feature flags have feature-flags-copy-flags-create and experiments have experiment-copy-to-project; endpoints have neither. Copying an endpoint means:
- Read the full source config with
endpoint-get. - Recreate it with
endpoint-create(in the target project, or under a new name in the same project).
Both endpoint-get and endpoint-create operate only on the active MCP project — neither takes a project id. So a cross-project copy requires the active project to be switched between the read (source) and the write (target). Read the source first, capture the config, then switch to the target and create. If you cannot switch projects in this session, tell the user rather than creating the copy in the wrong project.
When to use this skill
- "Copy this endpoint to another project", "duplicate this endpoint", "clone the endpoint"
- "Promote the endpoint from staging to production" (projects-as-environments)
- "Make a copy so I can iterate without touching the live one" (same-project duplicate under a new name)
- Replicating an endpoint's query, variables, and freshness config in a different workspace
What this skill does not cover
- Cross-organization copy. Endpoints (and their queries) can only be recreated in projects you have editor access to; there is no org-to-org path.
- Editing versions of an existing endpoint — see
managing-endpoint-versions. - Designing a new endpoint from scratch — see
creating-an-endpoint(this skill assumes the source endpoint already exists and is configured correctly). - Bulk-copying every endpoint in a project. Copy one at a time; loop
endpoints-get-all→ per-endpoint copy if the user really wants all of them, and tell them you're doing so.
Workflow
1. Resolve the source endpoint
You need the endpoint's name and the source project.
- If the user gave a name, use it. If they gave a fuzzy description, call
endpoints-get-allin the source project and match on name/description. - If the user didn't say which project the endpoint lives in, ask — don't assume the active MCP project is the source. Copying out of the wrong source is the most common foot-gun.
- Confirm the active project is the source (call
project-getwith no id to see the active project) before reading.
2. Read the full source config
Call endpoint-get with the source name. Capture everything you'll need to recreate it:
namequery(the whole HogQL/insight query definition — including any declared variables /code_names)descriptiondata_freshness_secondsis_materialized(source state — see step 5 for why you usually don't copy this as-is)tags
Present a short summary to the user before copying: what the query returns, its variables, its freshness setting, and whether the source is materialised.
3. Resolve the target and check for a name collision
Cross-project: confirm the target project belongs to the same org and the user has editor access there. The copy will be created in whatever project is active at endpoint-create time, so plan to switch the active project to the target between step 2 and step 6.
Same-project duplicate: the new endpoint needs a different name — names are unique within a project and the URL path (/api/projects/{team_id}/endpoints/{name}/run) depends on it. Agree a new name with the user.
Either way, run endpoints-get-all in the target project and check whether the intended name already exists. If it does, stop and ask: creating over an existing name is not a safe silent action. Get the name right up front — it's baked into the caller URL and not trivially renameable later.
4. Decide the name in the target
- Cross-project, same purpose: keep the same name so caller code ports unchanged.
- Same-project or "copy to iterate": pick a clearly-derived new name (e.g.
weekly_active_users_v2,weekly_active_users_staging). Snake_case, URL-safe, starts with a letter, max 128 chars.
5. Choose materialisation for the copy (default: OFF)
Default to is_materialized: false on the copy, even when the source is materialised. Rationale mirrors t
よくある質問
なぜ直接コピーできないのですか?
PostHogにはエンドポイントをサーバー側でコピーする仕組みがないため、設定を読み取ってから作り直します。
エージェントがプロジェクトを切り替えられない場合はどうなりますか?
間違ったプロジェクトにコピーを作るのではなく、その旨を伝えるようスキルは定めています。
別の組織にエンドポイントをコピーできますか?
いいえ。同じ組織内のプロジェクト間のみを扱います。
詳細
作者による元の説明
Copy a PostHog endpoint (a saved HogQL/insight query exposed as an API route) to another project in the same organization, or duplicate it under a new name in the same project. Use when the user wants to duplicate an endpoint, promote an endpoint from staging to production, replicate an endpoint's query/variables/freshness config in another workspace, or clone an endpoint to iterate on it. Unlike feature flags and experiments, endpoints have NO native cross-project copy tool — this skill covers the read-then-recreate flow (endpoint-get then endpoint-create), the active-project switching it req
repo: PostHog/posthog
人気
- GitHubのスター
- 41k
- ランキング
- #6859
- ライセンス
- —
- 更新日
- 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のどちらにルールを書くべきかを判断し、ファイルを膨らませずに守られやすい形で書けるよう支援します。
似ているスキル
discrawl
394k保存済みのローカルなDiscordメッセージのアーカイブを検索して要約し、その新しさを確認し、ダイレクトメッセージを読めるようエージェントを支援します。
clickhouse-io
280kエージェントがClickHouseデータベースのクエリとスキーマを最適化できるようにします。高性能な分析処理向けのベストプラクティスを適用します。分析クエリが遅すぎるときに使います。
scientific-db-pubmed-database
280kエージェントが生物医学分野の科学論文を検索するのに役立ちます。特定の医療情報が必要な研究に便利です。