Opik Analytics Instrumentation
comet-ml/opik
Shows how to add product analytics events to Opik's frontend, Java backend and Python SDK, all reporting through Segment to PostHog with an opik_ name prefix.
Configures the analytics side of a PostHog experiment — exposure criteria (server-resolved default exposure event vs custom exposure events), primary and secondary metrics, the supported metric…
$ npx skills add PostHog/posthog-foss --skill configuring-experiment-analytics -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install PostHog/posthog-foss configuring-experiment-analytics --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/PostHog/posthog-foss.git skills-src && mkdir -p .claude/skills && cp -r skills-src/products/experiments/skills/configuring-experiment-analytics .claude/skills/configuring-experiment-analytics && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "configuring-experiment-analytics" agent skill from https://github.com/PostHog/posthog-foss/tree/master/products/experiments/skills/configuring-experiment-analytics into .claude/skills/configuring-experiment-analytics/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "configuring-experiment-analytics", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/PostHog/posthog-foss/tree/master/products/experiments/skills/configuring-experiment-analyticsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add PostHog/posthog-foss --skill configuring-experiment-analytics -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install PostHog/posthog-foss configuring-experiment-analytics --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/PostHog/posthog-foss.git skills-src && mkdir -p .agents/skills && cp -r skills-src/products/experiments/skills/configuring-experiment-analytics .agents/skills/configuring-experiment-analytics && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "configuring-experiment-analytics" agent skill from https://github.com/PostHog/posthog-foss/tree/master/products/experiments/skills/configuring-experiment-analytics into .agents/skills/configuring-experiment-analytics/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "configuring-experiment-analytics", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add PostHog/posthog-foss --skill configuring-experiment-analytics -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install PostHog/posthog-foss configuring-experiment-analytics --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/PostHog/posthog-foss.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/products/experiments/skills/configuring-experiment-analytics .cursor/skills/configuring-experiment-analytics && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "configuring-experiment-analytics" agent skill from https://github.com/PostHog/posthog-foss/tree/master/products/experiments/skills/configuring-experiment-analytics into .cursor/skills/configuring-experiment-analytics/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "configuring-experiment-analytics", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/PostHog/posthog-foss.git --path products/experiments/skills/configuring-experiment-analytics--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add PostHog/posthog-foss --skill configuring-experiment-analytics -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install PostHog/posthog-foss configuring-experiment-analytics --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/PostHog/posthog-foss.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/products/experiments/skills/configuring-experiment-analytics .gemini/skills/configuring-experiment-analytics && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "configuring-experiment-analytics" agent skill from https://github.com/PostHog/posthog-foss/tree/master/products/experiments/skills/configuring-experiment-analytics into .gemini/skills/configuring-experiment-analytics/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "configuring-experiment-analytics", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install PostHog/posthog-foss configuring-experiment-analyticsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add PostHog/posthog-foss --skill configuring-experiment-analytics -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/PostHog/posthog-foss.git skills-src && mkdir -p .github/skills && cp -r skills-src/products/experiments/skills/configuring-experiment-analytics .github/skills/configuring-experiment-analytics && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "configuring-experiment-analytics" agent skill from https://github.com/PostHog/posthog-foss/tree/master/products/experiments/skills/configuring-experiment-analytics into .github/skills/configuring-experiment-analytics/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "configuring-experiment-analytics", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add PostHog/posthog-foss --skill configuring-experiment-analytics -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install PostHog/posthog-foss configuring-experiment-analytics --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/PostHog/posthog-foss.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/products/experiments/skills/configuring-experiment-analytics .opencode/skills/configuring-experiment-analytics && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "configuring-experiment-analytics" agent skill from https://github.com/PostHog/posthog-foss/tree/master/products/experiments/skills/configuring-experiment-analytics into .opencode/skills/configuring-experiment-analytics/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "configuring-experiment-analytics", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
configuring-experiment-analyticsConfigures the analytics side of a PostHog experiment — exposure criteria (server-resolved default exposure event vs custom exposure events), primary and secondary metrics, the supported metric…
Configuring Experiment Analytics is an agent skill from PostHog/posthog-foss, published by the product's own GitHub organization. Configures the analytics side of a PostHog experiment — exposure criteria (server-resolved default exposure event vs custom exposure events), primary and secondary metrics, the supported metric types (count, sum, ratio with math and mathproperty, retention with retentionwindowstart and starthandling), multivariate user handling ("Exclude from analysis" vs "Use first seen variant"), and how to read results once the experiment is live. Use when the user adds or edits a primary or secondary metric (e.g. "add a…
Its SKILL.md is about 3.7k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/interpreting-results.md` and `references/metric-templates.md`).
It works with PostHog. The repository describes itself as: PostHog FOSS is a read-only mirror of PostHog, with all proprietary code removed. NOTE: This repo is synced automatically from the main PostHog repo. Please raise any issues and… The licence is MIT.
4 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 2c48221. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md.
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Configuring Experiment Analytics loads about 3.7k tokens when it runs, and up to ~8.7k if it reads all its reference files. Until then it costs about 252 tokens; SKILL.md has 1,749 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from PostHog/posthog-foss at commit 2c48221, republished under its MIT licence (© PostHog). 1,749 words, ~3,652 tokens.
.claude/skills/configuring-experiment-analytics/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.This skill answers: Who is included in the analysis? and How to measure impact?
Exposure criteria determine which users are counted in the experiment analysis.
Two options:
$feature_flag_called, or $experiment_exposure for newer experiments. Which one applies is resolved server-side — read resolved_exposure_event from experiment-get rather than assuming either name (both events carry the same properties). This is the standard approach — it means a user is included only when they actually encounter the feature flag in your code.When a user is exposed to multiple variants (e.g., due to flag changes or race conditions):
Bias risk on uneven splits. "Exclude from analysis" combined with an uneven variant split can introduce bias — multi-variant users are dropped asymmetrically and the smaller variant loses a larger fraction of its assignments. If those users behave differently from the rest, the smaller variant's metrics will be skewed.
The right mitigation depends on experiment state:
configuring-experiment-rollout.exposure_criteria.filterTestAccounts (default: true) — excludes internal/test users from the analysis.
Metric changes require an experiment ID. If the user refers to an experiment by name
or description (e.g. "add metrics to the checkout test"), load the finding-experiments
skill to resolve it to a concrete ID before proceeding.
A metric reaches an experiment one of two ways, both via experiment-update:
metrics array, which
replaces the entire inline list, so always get the current experiment first via experiment-get
to preserve existing metrics.saved_metrics_ids (this list also replaces the experiment's existing
saved-metric links, so resend the full set — see Step 1).Prefer reusing a shared metric over duplicating it inline. Build a new inline metric only when no suitable shared metric already exists.
Before building any new inline metric, you MUST check whether the project already has a shared (saved) metric that measures the same thing, and reuse it. Duplicating a metric that already exists as a shared metric fragments measurement and is exactly what we want to avoid.
Reuse is decided by the metric definition — the event or action plus the metric type — not the
name. Saved metrics are named by each team's own conventions, which you cannot guess, so you must
compare on what each metric measures (its query), never on its title.
Workflow:
read-data-schema. You can only recognize a duplicate once you know the concrete event/action,
so this check runs after you've pinned down the event, not before.query. Call experiment-saved-metrics-list
with ?event=<the event you're measuring> to find metrics that reference it — matched directly (an
EventsNode) or via the step events of any action a metric references, so action-based metrics are
found by the event their action fires on. Then for each returned row, inspect its query (not the
name/description): a saved metric is a reuse match when its query measures the same event or
action with the same metric_type (and compatible math) as the metric you'd otherwise build, even
if its name is different.search for this. search matches only the metric's own name / description / tags —
never the underlying event or action — so it cannot find a definition match. Use search only when the
user names a specific saved metric to attach (name resolution, not a definition match).experiment-get to read the experiment's current saved_metrics.experiment-update with saved_metrics_ids set to the full desired set — it replaces
existing links, so include the already-attached ones plus the new entry. Each entry has shape
{ "id": <saved-metric id>, "metadata": { "type": "primary" } } — set type to "primary" or
"secondary". metadata is optional and defaults to primary.saved_metrics you just read has a
top-level id (the link id) AND a saved_metric field (the metric id). saved_metrics_ids
wants the saved_metric value, not the link id — sending the link id attaches the wrong
metric or fails validation.experiment-saved-metrics-create, then attach it as above, so the
next experiment can reuse it.Before suggesting or building any new inline metric, you MUST call read-data-schema to discover
what events actually exist in the project. Do NOT skip this step. Do NOT suggest event names
based on what you think the project might track — only use events you have confirmed exist.
(Attaching an existing shared metric from Step 1 does not need this — it already encodes its events.)
This applies even when:
Workflow:
read-data-schema to get the project's eventsLegitimate exception — allow_unknown_events: true:
Pass this on experiment-create / experiment-update only when the user is intentionally instrumenting an event that hasn't been ingested yet (e.g. setting up the experiment before the code change ships). Confirm this with the user — never use it as a workaround for "the event lookup didn't return what I expected".
Example:
User: "Let's add some metrics for the checkout experiment"
WRONG: "I'd suggest using purchase_completed as the primary metric..."
(hallucinated event name — never seen the project's actual events)
RIGHT: *calls read-data-schema* → "Here are the events in your project
related to checkout: `checkout_step_completed`, `payment_processed`,
`order_confirmed`. Which of these represents a successful checkout?"Start from a template in references/metric-templates.md: it maps common requests ("more revenue", "people come back") to a metric type and the defaults to set with it (window units, winsorization, goal).
There are four metric types. Each has kind: "ExperimentMetric":
| metric_type | When to use | Required fields |
|---|---|---|
"mean" | Average of a numeric property per user (revenue, session duration, pageviews per user) | source |
"funnel" | Conversion rate from exposure through one or more ordered actions | series (1 or more steps) |
"ratio" | Rate of one event relative to another | numerator, denominator — set math: "sum" + math_property on a side to aggregate a property; filters never aggregate |
"retention" | Do users come back after exposure? | start_event, completion_event, retention_window_start, retention_window_end, retention_window_unit, start_handling |
Funnel metrics and the implicit exposure step
Funnel metrics automatically prepend the experiment's exposure event as step_0.
So a funnel with 1 step in series is a valid 2-step funnel: exposure → action.
This is the correct choice for measuring "what percentage of exposed users did X?"
Examples:
$pageview filtered to /login)checkout_completed)Mean vs funnel for the same event
Both can reference the same event — the difference is whether you care about count/magnitude (mean) or yes/no conversion (funnel).
Retention: same vs different start/completion event
The retention window is measured from the start event, so the events you pick decide what's measured: The start occurrence never counts as its own completion (only a distinct later event does), so both shapes are valid:
From 0 counts a repeat from the same period onward (same-day repeats included); From ≥ 1 requires an occurrence later. Use start_handling: "first_seen". When a user says "retention of <event>" they usually mean repeat retention.See references/metric-configuration.md for the full rendered ExperimentMetric schema (all four metric types, with required fields per type) plus WRONG/RIGHT JSON pairs for the failure modes that come up most often (ratio with is_set filter instead of math: "sum" + math_property; retention without retention_window_start / start_handling). Read it before assembling a ratio or retention payload — the required fields are authoritative.
See references/interpreting-results.md for guidance on reading experiment results, statistical significance, and when to ship vs end.
configuring-experiment-rollout — the rollout side: variant splits and traffic percentagediagnosing-experiment-health — when results look biased, empty, or strangeanalyzing-experiment-session-replays — qualitative complement — watch what each variant's users actually did© PostHog, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 3 other files (references) in products/experiments/skills/configuring-experiment-analytics of PostHog/posthog-foss.
Open the folder on GitHubat commit 2c48221
Configuring Experiment Analytics next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Configuring Experiment Analytics this skillPostHog/posthog-foss | 721 | — | ~3.7k | Automated safety check: Pass | MIT | |
| Opik Analytics Instrumentationcomet-ml/opik | 22k | — | ~4.4k | Automated safety check: Pass | Apache-2.0 | |
| C15tc15t/c15t | 1.9k | 1 repos | ~1.6k | Automated safety check: Pass | Apache-2.0 | |
| Define Feature Flagmacro-inc/macro | 4.6k | — | ~780 | Automated safety check: Pass | AGPL-3.0 | |
| Soku CLIAbout-Intelligence/soku-cli | 304 | — | ~2.4k | Automated safety check: Pass | MIT | |
| Compare Array Bundle SizePostHog/posthog-js | 613 | — | ~599 | Automated safety check: Pass | Custom licence |
comet-ml/opik
Shows how to add product analytics events to Opik's frontend, Java backend and Python SDK, all reporting through Segment to PostHog with an opik_ name prefix.
c15t/c15t
Work with c15t consent management docs, APIs, and integrations for Next.js, React, and JavaScript.
macro-inc/macro
Define a frontend feature flag with defineFlag and wire its readers.
About-Intelligence/soku-cli
Guides an agent through the soku command line tool for ads, GA4 and PostHog data reads, ads writes, SEO hosting, automations, files and skill management.
PostHog/posthog-js
Quickly compare the posthog-js array.js bundle size in the current working tree against a git baseline using the repository's esbuild proxy.
OpenHands/OpenHands
This skill should be used when the user asks to "add tracking", "add a PostHog event", "change telemetry consent", "instrument onboarding", "debug analytics", or changes telemetry.ts…
PostHog/posthog-foss
Author useful, low-noise log alerts on services in a PostHog project.
PostHog/posthog-foss
Operating procedure for the conflict-autoresolver agent: sweep open PostHog/posthog PRs that conflict with master, resolve the trivial conflicts (generated artifacts deterministically, source…
PostHog/posthog-foss
Help users debug PostHog Error Tracking stack-trace symbolication for any supported platform — JavaScript/TypeScript web, React Native (Hermes), Android (Proguard / R8), or iOS / macOS (dSYM).
PostHog/posthog-foss
Investigates distributed application performance using PostHog APM (OpenTelemetry span) data via MCP.
PostHog/posthog-foss
Debug and inspect LLM/AI agent traces using PostHog's MCP tools.
PostHog/posthog-foss
Diagnose why a product metric changed (dropped, spiked, or plateaued) by orchestrating breakdowns, actors, paths, lifecycle, retention, and annotations queries.
Works with
Configures the analytics side of a PostHog experiment — exposure criteria (server-resolved default exposure event vs custom exposure events), primary and secondary metrics, the supported metric…. Configuring Experiment Analytics is an agent skill from PostHog/posthog-foss, published by the product's own GitHub organization. Configures the analytics side of a PostHog experiment — exposure criteria (server-resolved default exposure event vs custom exposure events), primary and secondary metrics, the supported metric types (count, sum, ratio with math and mathproperty, retention with retentionwindowstart and starthandling), multivariate user handling ("Exclude from analysis" vs "Use first seen variant"), and how to read results once the experiment is live.
Configuring Experiment Analytics fits situations like: edits a primary; secondary metric (e.g.
Run `npx skills add PostHog/posthog-foss --skill configuring-experiment-analytics -a claude-code`. Or copy the skill folder (products/experiments/skills/configuring-experiment-analytics in PostHog/posthog-foss) into .claude/skills/configuring-experiment-analytics in your project. Claude Code loads it when a task matches its description.
Run `npx skills add PostHog/posthog-foss --skill configuring-experiment-analytics -a codex`. Or copy the skill folder (products/experiments/skills/configuring-experiment-analytics in PostHog/posthog-foss) into .agents/skills/configuring-experiment-analytics in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add PostHog/posthog-foss --skill configuring-experiment-analytics -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/configuring-experiment-analytics, .gemini/skills/configuring-experiment-analytics, .github/skills/configuring-experiment-analytics and .opencode/skills/configuring-experiment-analytics in your project.
SKILL.md names no scripts, command-line tools or credentials: Configuring Experiment Analytics is instructions for the agent only.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Configuring Experiment Analytics is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 3.7k tokens (SKILL.md is roughly 15k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.1k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Configuring Experiment Analytics: Opik Analytics Instrumentation (comet-ml/opik, 22k stars), C15t (c15t/c15t, 1.9k stars), Define Feature Flag (macro-inc/macro, 4.6k stars) and Soku CLI (About-Intelligence/soku-cli, 304 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
PostHog (a GitHub organization, an official publisher) maintains it in PostHog/posthog-foss, which has 721 GitHub stars. The repository holds 213 skills in this directory. The repository was last updated on October 7, 2026.
Source: PostHog/posthog-foss on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.