Saved queries only move forwards — every edit cuts a new version and nothing can point back at an old one — so this is what rolling back, previewing and retiring a version really amount to.
WHEN TO USE
SCOPE
USE FOR
Roll back to an older working version of an endpoint after a bad query change breaks it.
Preview what a new query version returns before every caller starts hitting it.
Fix a typo in one version's description without bumping the version number.
Turn off one specific version of an endpoint while leaving the others working.
Find which old versions nobody calls any more and retire them.
NOT FOR
Auditing which endpoint versions across a project are unused; that's auditing-endpoints.
This is a saved copy of the skill's SKILL.md instructions. It may differ from the upstream file or the version you install.
Managing endpoint versions
This skill is the practical guide to endpoint versioning. It covers the today-workflow, which
has some sharp edges worth being explicit about.
When to use this skill
"How do I roll back to v3?"
"I want to test changes before they go live"
"How do I update the description / data_freshness_seconds on a specific version?"
"Can I disable v4 without affecting v5?"
The user is uncertain whether a query change will cut a new version
Versioning model — what to know
Behaviour
Reality
Query change
Auto-cuts a new version. Saving any edit to the query creates a new version and bumps the current version number
Does not cut a new version. Updates the targeted version in place
The "current" version
Always the highest version number — it's not a pointer you can move backwards
Calling without ?version=N
Runs the latest version. So unpinned callers always hit the newest
Disabling the whole endpoint
endpoint-update with is_active: false (no version) takes every version offline at once
Disabling a single version
endpoint-update with version + is_active: false retires one version without affecting the others
The model is forward-only. There is no "make v3 the default again" operation today. Practically
this means "rollback" requires either creating a new top version that re-uses the old query, or
pinning callers to ?version=N.
Available tools
Tool
Purpose
endpoint-versions
List all versions for an endpoint, latest first
endpoint-get
Full config; supports ?version=N to fetch a specific version
endpoint-update
The workhorse — supports version body param to target a specific version
endpoint-run
Execute a version directly via ?version=N (without affecting which version other callers hit)
Workflows
Previewing a draft before publishing
There is no "draft" concept in the model. Editing the query commits it as a new version
immediately. To preview safely:
Test the new query first with the execute-sql tool (or the SQL editor) — not on the live endpoint
When ready, update the endpoint — this creates the new version automatically
Use endpoint-run with ?version=N to confirm the new version returns what you expect
Old callers still hit the latest version (which is now your new version) — there is no
"soft launch"
If the user needs a true staging endpoint, the only workaround today is a sibling endpoint
with a _v2 or _staging suffix. Document this honestly — there is no in-product staging path.
Rolling back to an older version
The forward-only model means "rollback" requires forking:
endpoint-versions to find the version with the good query (say v3)
endpoint-get with ?version=3 to retrieve that version's query JSON
endpoint-update with the v3 query as the new query — this creates a new version (e.g.
v6) with the same query as v3
All callers without ?version=N now hit v6 (== v3's query)
The old version (v5, the broken one) still exists and is still callable via ?version=5 until
explicitly deactivated.
Faster mitigation if you can change every caller: have them pin to ?version=3 until a real
fix is ready. Lower-impact than cutting a new version.
Updating settings on a specific version
endpoint-update accepts a version field in the body. When set, settings updates apply to
that version only — they do not cut a new version. Useful when:
Bumping data_freshness_seconds on an old version that some callers still pin to
Adjusting description on a historical version for clarity
Changing materialisation state per version (the materialisation is per-version anyway)
Important: passing query together with version is rejected — query changes always cut a new
top version, never modify history. The version arg only affects settings.
Deactivating a single version
To take v3 out of service while keeping v4 and v5 callable:
This sets is_active: false on v3 only. Callers pinned to ?version=3 start getting an error;
other callers are unaffected.
To re-enable: same call with is_active: true.
The whole-endpoint is_active field (without version) is a separate switch — it disables
every version at once. Use the version-scoped form for surgical takedowns.
Pruning unused versions
Old versions accumulate over time. To find which are dead, call endpoint-versions and read each
version's last_executed_at: a version that's null or long stale hasn't been called recently.
Materialised dead versions are the costly ones — disable their materialisation with
endpoint-update + version + is_materialized: false, and deactivate with is_active: false
to signal they're retired.
Confirm with the user before retiring a version: last_executed_at counts only personal-API-key
calls and is recorded only for runs since that tracking was added (so a used version can still
read null), and a caller may be pinned to ?version=N. The full audit flow lives in
auditing-endpoints.
Example interaction
User: "I shipped a broken query last night, v5. How do I roll back?"
Agent:
- endpoint-versions <name> → v5 (latest), v4, v3, v2, v1
- endpoint-get <name> ?version=4 → query JSON for v4
- "Rolling back means creating v6 with v4's query. v5 stays as a
historical version but nobody hits it unless they explicitly
pass ?version=5. Sound right?"
- User confirms
- endpoint-update <name> {query: <v4 query>} → creates v6
- endpoint-run <name> ?version=6 to confirm shape
- "Done. v6 is live with v4's query. Want me to also deactivate v5
so it's clear it's defunct?"
- User: "Yes"
- endpoint-update <name> {version: 5, is_active: false}
Important notes
There is no pointer flip. "Rolling back" creates a new version. The version number is
always going up. If the user is uncomfortable with the resulting history noise, that's a
fair concern — surface it honestly.
A query change always creates a new version. Updating settings on the side does not.
If the user wants to fix a typo in v5's description without bumping to v6, use the version
param.
Disabling a single version only blocks that version. It doesn't change which version runs
by default — that's always the highest version number.
Materialisation is per-version. Each version has its own materialised view named
{endpoint_name}_v{version}. Disabling materialisation on one version doesn't affect others.
Pinning is the safety net — push callers to use it. Callers that pin to ?version=N are
insulated from query edits; unpinned callers always hit the latest and can be surprised by a new
version. Encourage consumers to pin, validate a new version, then bump the pin deliberately.
The CLI manages versions too.posthog-cli exp endpoints {pull,push,diff} lets the user
keep endpoint definitions as YAML in version control and review changes before pushing — a
cleaner workflow than editing live when query changes need review.
Activating an older version is not yet a product feature. If the user repeatedly wants this —
flip a pointer rather than fork — surface it as a feature gap (and nudge the team via
agent-feedback). Don't pretend endpoint-update does it.
MCP connection required
1 FOR YOU
01
Connect the PostHog MCP server
Connect your PostHog project through the PostHog MCP server so the skill can list, fetch, and update SQL endpoint versions (endpoint-versions, endpoint-get, endpoint-update, endpoint-run).
🔌 This skill ships inside the PostHog AI Plugin. Listed package contents include 3 slash commands, 1 agent, hooks and an MCP server. Installed components and skill versions may vary by AI tool.
Install just this skill
Run this outside your AI tool, using Node.js 22.20.0 or newer. Skills CLI 1.7.2 skips skill selection; prompts cancel installation without an interactive terminal. If choosing Project when asked about installation scope, open your project's folder before running this.
Install checklist
Check selected tools if a picker appears; Claude Code may be unchecked under Additional agents. ↑/↓ moves, Space toggles selections, Enter confirms.
Without a tool picker, check Installing to: for your intended tool. Stop if it names a different tool.
If asked, choose Symlink (Recommended) for shared files or Copy to all agents for separate copies; review the summary before confirming installation.
Install the find-skills skill? defaults to Yes, adding another skill for all projects. Choose No if you don't want that extra installation.
Skills CLI 1.7.2 sends install data to skills.sh by default, including the source, skill names, target tools and file details; GitHub sources are reported only when GitHub confirms the repository is public, while other remote sources can also be reported. Confirmed-public GitHub sources also trigger a security-audit request. Before installing, set the environment variable DO_NOT_TRACK=1 or DISABLE_TELEMETRY=1 to disable both.
After installing for Claude Code, open it in the installation project if you chose Project; Global makes the skill available across projects on this computer. Once Claude Code loads the skill, its description helps Claude decide when to use it.
If installation created a top-level skills folder that did not exist when your Claude Code session started, run /reload-skills in that session. Run it again after later changes in that folder.
MCP server required
The skill's steps call for tools from the PostHog MCP server. Installing just this skill doesn't add that connection; set it up in your AI tool if it isn't there yet: PostHog MCP setup. Installing the whole plugin instead includes the connection settings.
Requirements for the PostHog MCP server
Connecting is free; sign in with your PostHog account.
Some tools use AI internally and may incur PostHog AI charges. Those tools require AI data processing to be enabled in your organization settings.
Install the whole plugin
This route installs the posthog plugin package selected for your AI tool.
Claude Code
Add PostHog's marketplace, then install the plugin
Run both lines in a terminal. They install PostHog's posthog plugin: this skill, PostHog's other skills, and a connection to PostHog's hosted MCP server.
01
claude plugin marketplace add PostHog/ai-plugin
02
claude plugin install posthog@posthog
Installation and loading
The plugin installs for you in every project and loads the next time you start Claude Code, or after /reload-plugins in an open session.
To connect your PostHog account, start claude, type /mcp, select plugin:posthog:posthog and follow the browser prompts.
Good to know
The plugin includes PostHog's session-capture hook; PostHog's README says it sends sessions to LLM Analytics only when POSTHOG_LLMA_CC_ENABLED=true and POSTHOG_API_KEY are both set.
If you use the separate posthog-telemetry plugin, PostHog says to keep only one of the two, because both register the same hook.
On a self-hosted PostHog, this route's MCP connection won't reach your instance: the plugin's config is fixed to https://mcp.posthog.com/mcp, which routes to PostHog's US or EU region. POSTHOG_MCP_URL works only for the Gemini CLI extension.
Sync columns from a synced data warehouse table onto PostHog person or group properties, so warehouse data becomes usable anywhere person and group properties already work: feature flag targeting, cohorts, insight filters and breakdowns, surveys, session replay filters, workflows, and the person profile. Use when the user wants to "add a person property from my warehouse", "enrich people with Stripe/Postgres/Salesforce data", "put ARR or plan tier on my persons", "target a feature flag by a warehouse column", "sync warehouse columns onto groups or organizations", or wants to inspect, backfill, disable, or debug an existing warehouse-backed person or group property.Read full description
Analyze the most expensive users in AI observability and explain why they cost so much. Use when the user asks about top spenders, expensive users, per-user LLM cost, user-level cost drivers, or patterns behind high AI observability spend.Read full description
Analyze session replay patterns across experiment variants to understand user behavior differences. Use when the user wants to see how users interact with different experiment variants, identify usability issues, compare behavior patterns between control and test groups, or get qualitative insights to complement quantitative experiment results. Also covers pairing the observed behavior with a linked survey when the user wants qualitative feedback beyond what recordings show.Read full description
Assesses what a page's heatmap is telling you and recommends concrete changes. Pulls click / rageclick / scroll-depth data for a URL, names the hot elements by cross-referencing autocapture events on the same page, and can create a saved heatmap the user opens in PostHog, then summarizes the behavior and proposes improvements.
TRIGGER when: user asks what a heatmap shows, why people aren't clicking something, where users rage-click, how far they scroll, what to change on a page based on heatmap/click data, or to 'analyze/assess/review the heatmap' for a URL.
DO NOT TRIGGER when: the user only wants to create a saved heatmap screenshot with no analysis (use heatmaps-saved-create directly), or is asking about session replay in general (use investigating-replay).Read full description
Audit every endpoint in a PostHog project for staleness, failed materialisations, and unused materialised versions. Use when the user asks "what endpoints can I clean up?", "are any of my endpoints broken?", "which materialised versions are still being called?", or wants a one-shot cleanup pass over the Endpoints product. Produces a prioritised report grouped by issue type, with recommended actions but does not modify anything without explicit confirmation.Read full description
Audit PostHog experiments and feature flags for configuration issues, staleness, and best-practice violations. Read when the user asks to audit, health-check, or review experiments or feature flags, check flag hygiene, or verify experiment setup.Read full description