skills/copying-endpoints-across-projects/SKILL.md
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 requires, name-collision checks, and the safe defaults (land unmaterialised in the target, verify with endpoint-run). Does not cover editing endpoint versions (see managing-endpoint-versions) or authoring a brand-new endpoint from scratch (see creating-an-endpoint).
npx skillsauth add posthog/ai-plugin copying-endpoints-across-projectsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
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:
endpoint-get.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.
managing-endpoint-versions.creating-an-endpoint (this skill assumes the source endpoint already exists and is configured correctly).endpoints-get-all → per-endpoint copy if the user really wants all of them, and tell them you're doing so.You need the endpoint's name and the source project.
endpoints-get-all in the source project and match on name/description.project-get with no id to see the active project) before reading.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)tagsPresent a short summary to the user before copying: what the query returns, its variables, its freshness setting, and whether the source is materialised.
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.
weekly_active_users_v2, weekly_active_users_staging). Snake_case, URL-safe, starts with a letter, max 128 chars.Default to is_materialized: false on the copy, even when the source is materialised. Rationale mirrors the safe default in copying-flags-across-projects (land disabled): materialisation costs recompute/storage on a cadence, and a freshly-copied endpoint has no proven traffic in the target yet. Ship it unmaterialised, confirm it's actually called, then enable materialisation later once usage justifies the cost.
Override to is_materialized: true only if the user explicitly wants the copy materialised from day one (e.g. a like-for-like production promotion of a high-traffic endpoint). Note the caveats from creating-an-endpoint: queries with cohort breakdowns or compare mode, and insight kinds other than Trends/Lifecycle/Retention (e.g. Funnels), are not materialisable — endpoint-create will simply create them unmaterialised regardless.
Carry data_freshness_seconds over unchanged unless the user wants different freshness in the target (remember it doubles as the materialisation refresh cadence).
With the target project active, call endpoint-create with:
name — from step 4query — the source query captured in step 2, verbatim (this carries the variables/code_names)description — from source (optionally note it's a copy)data_freshness_seconds — from source unless the user changed itis_materialized — from step 5 (default false)tags — from source if the user wants them; drop tags that are meaningless in the target projectCall endpoint-run on the new endpoint with a representative variables payload and confirm the response shape matches the source. For a cross-project promotion, sanity-check that the underlying events/properties the query references actually exist in the target project — a query that's valid in staging can return empty or error in a project with different taxonomy. If the copy is HogQL and callers rely on offset pagination, note that offset on endpoint-run is only supported for HogQL endpoints (not insight endpoints).
Tell the user: the new endpoint's name and project, its materialisation state, its freshness setting, and the result of the verification run. If you switched the active project to do the copy, say which project is active now so they aren't surprised on their next call.
query. HogQL code_name variable declarations and insight breakdown variables live inside the query definition, so copying query verbatim preserves them. Double-check the copy's variables in the verification run.endpoint-create makes a new endpoint (or fails if the name is taken). Always confirm the target name and project with the user before creating, especially when the target is production.endpoint-create will be rejected.endpoint-get — read the full source endpoint config (query, variables, freshness, materialisation, tags). Supports ?version=N.endpoint-create — create the copy in the active project. Fields: name, query, description, data_freshness_seconds, is_materialized, tags.endpoints-get-all — list endpoints in the active project; use to resolve a fuzzy source name and to check for a name collision in the target.endpoint-run — execute the new endpoint to verify the copy's response shape.project-get — call with no id to confirm which project is currently active before reading the source or creating the copy.data-ai
Signals scout for PostHog Tasks, the agent work items a project runs. Two lenses: delivery health (runs failing, clustered by repository and error class, and retry storms) every run, and on a slower rotation demand (recurring asks across human-authored tasks that point at a product gap). Skips the scout fleet's own run rows.
devops
Signals scout for the PostHog Conversations (support inbox) product. Watches the `$conversation_*` ticket-lifecycle events for support-delivery regressions — SLA breach-rate steps, first-response latency blowouts, backlog inflow-vs-resolution imbalance, and channel / assignment concentration — and files each dated regression as a report. Complements the per-ticket product-feedback signals the emission pipeline already fires; does not re-surface individual ticket content.
development
Populates and maintains a project's data catalog (semantic layer): canonical metrics, trust marks (certifications) on warehouse tables/views, and reviewed table relationships. Use when asked to set up / seed / bootstrap the data catalog or semantic layer, to catalog a project's metrics, to certify or deprecate data sources, to propose or review table joins, or to work through the proposal review queue. To *use* an existing catalog to answer a business-number question, see querying-posthog-data instead. Trigger terms: data catalog, semantic layer, canonical metric, certify table, deprecate source, relationship proposal, metric drift, review queue.
tools
Investigate logs in a PostHog project: verify a service or deployment is healthy, explain an error spike, triage an incident, or understand what a log stream is saying. Use when the user asks to "check the logs", asks whether a service, deploy, release, or change is working or broke anything, asks why errors are up or what changed, or wants the root cause of failures visible in logs. Routes the logs MCP tools (services overview, pattern mining, before/after pattern diffing, bucketed counts, facets, raw rows) so investigations start from summaries instead of raw rows or hand-written SQL over the logs table.