Posthog
PostHog CLI workflows for Claude Code and Codex — schema-first analytics, HogQL, endpoints, and verified symbolication.
npx -y skills add yigitkonur/plugin-posthog-cli --skill posthogAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 24 days oldThe repository was created 24 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
This skill should be used whenever the user asks to inspect, query, debug, audit, or operate PostHog from the terminal: "check our PostHog data", "what are users doing", "investigate this metric", "run a HogQL query", "list feature flags", "find a session replay", "check errors", "manage an endpoint", "upload source maps/dSYMs/ProGuard mappings", "symbolicate this crash", "audit PostHog setup", "is analytics ingestion working", or mentions `posthog-cli`, a PostHog project URL, event names, funnels, trends, retention, persons, recordings, releases, or symbol sets. Prefer this over guessing about product behavior: PostHog contains the real events, identities, sessions, flags, experiments, errors, and release metadata.
SKILL.md
11.2 KB, ~2.5k tokens by cl100k_base, as published. Nobody here has run it
PostHog CLI
Operate PostHog through the posthog-cli binary. Every command pattern and caveat in this
skill was exercised against a live PostHog Cloud project with CLI 0.8.1. When local --help
disagrees, trust the installed CLI, then update the relevant reference.
Why a ladder, not a data dump
PostHog exposes hundreds of API tools and potentially millions of events. Avoid loading the whole catalog or unbounded query output. Move through this ladder and stop as soon as the question is answered:
Rung 0 target prove host + project + auth (cheap)
Rung 1 discover search tools / read schema / inspect event taxonomy
Rung 2 query typed query tool (trends, funnel, replay, errors) (preferred)
Rung 3 SQL HogQL only when typed tools cannot express the ask
Rung 4 mutate dry-run / diff / confirm / verify (shared state)
Use api for product operations and typed analytics. Use exp query for ad hoc HogQL. Use
artifact commands only for release symbolication. Keep raw output out of context: prefer
--json | jq and select the fields needed to decide.
Start every session by proving the target
Never infer the region from ingestion SDK variables, a repository name, or an old dotenv file. PostHog can accept events at the wrong regional ingestion endpoint with HTTP 200 and still not place them in the intended project. Prove the management host and project independently:
posthog-cli --version
posthog-cli api call --json project-get '{}' | jq '{id,name}'
Expected auth variables:
POSTHOG_CLI_HOST=https://us.posthog.com # or https://eu.posthog.com
POSTHOG_CLI_PROJECT_ID=12345
POSTHOG_CLI_API_KEY=phx_...
Prefer project-local .envrc + direnv over a global token when work spans multiple projects.
Keep .envrc ignored and mode 600. posthog-cli login stores OAuth credentials in
~/.posthog/credentials.json; env vars override the ambiguity and make CI/project scoping
explicit. Read references/auth-project-scoping.md before setup, region debugging, CI auth,
or claiming that ingestion works.
Route by intent
| User intent | First command | Load |
|---|---|---|
| Discover available operations | posthog-cli api search '<regex>' | references/api-tools.md |
| Product metric, funnel, paths, retention | api info query-…, then api call | references/analytics-workflows.md |
| Custom aggregation / entity search | exp query check, then exp query run | references/hogql.md |
| Event/person/property discovery | api call read-data-schema … | references/analytics-workflows.md |
| Session replay / errors / logs / LLM traces | matching query-* or list tool | references/observability.md |
| Feature flags / experiments / surveys | list/read tools, mutate only with approval | references/product-operations.md |
| Endpoint-as-code | exp endpoints … | references/endpoints-schema-tasks.md |
| Typed event schema generation | exp schema … | references/endpoints-schema-tasks.md |
| Web JS sourcemaps | sourcemap process | references/symbolication-releases.md |
| Expo / React Native Hermes maps | hermes upload | references/symbolication-releases.md |
| iOS native symbols | dsym upload | references/symbolication-releases.md |
| Android mappings | proguard upload | references/symbolication-releases.md |
| CLI flag / leaf-command lookup | <command> --help | references/cli-command-catalog.md |
| Something failed or looks empty | run the diagnostic ladder | references/troubleshooting.md |
| End-to-end investigation / audit | choose the outcome playbook | references/investigation-playbooks.md |
| Current docs or version drift | rank sources, re-validate | references/sources-versioning.md |
API tool discovery is mandatory
The CLI bundles a changing catalog of hundreds of MCP-style tools. Do not guess tool names, input keys, or nested query schemas:
posthog-cli api search 'error|recording|funnel'
posthog-cli api info --json query-funnel
posthog-cli api schema query-funnel series
posthog-cli api call --json query-funnel '<validated JSON>' | jq '…'
Treat api info as operational documentation, not merely a JSON schema. Descriptions explain
cost, defaults, tool choice, and query semantics. Drill into any field that says DO NOT GUESS.
Read references/api-tools.md for the exact discovery ladder, output handling, tool safety
annotations, and mutation behavior.
Query schema-first
Before querying analytics:
- Discover events with
read-data-schema. - Discover properties for the selected event/person/session.
- Validate property values when filtering.
- Use the matching typed query tool (
query-trends,query-funnel,query-retention,query-stickiness,query-paths,query-lifecycle, replay/error/log/LLM query tools). - Fall back to HogQL only for joins, CTEs, entity search in
system.*, window functions, or shapes unavailable to typed tools.
Validate HogQL before execution:
posthog-cli exp query check 'SELECT event, count() FROM events GROUP BY event'
posthog-cli exp query run 'SELECT event, count() AS c FROM events GROUP BY event ORDER BY c DESC LIMIT 25'
Always bound time and rows. Avoid emitting distinct IDs, emails, names, URLs with secrets, or full event-property blobs unless the task specifically requires them. Aggregate first.
Treat mutations as shared production state
Read operations may proceed. For creates/updates/deletes:
- Inspect with
api info <tool>. - Use
api call --dry-run …when supported. - For endpoint YAML, use
exp endpoints difforpush --dry-run. - Confirm the exact target IDs and intended outcome.
- Use
--confirmonly after authorization for destructive tools. - Read back the entity or list after mutation.
- Remove temporary smoke-test artifacts.
The CLI itself blocks tools marked destructive without --confirm, but not every write is
classified destructive: create operations may execute without a prompt. Agent judgment remains
required. Never create a probe event, annotation, endpoint, release, flag, survey, or experiment
just to prove auth unless the user authorized that shared-state mutation. See
references/safety-data-handling.md.
Symbolication is a release pipeline
Artifact commands do more than upload files. sourcemap inject can contact PostHog and create a
release when release metadata is supplied. The CLI auto-derives git metadata, which can capture
a credential-bearing checkout remote in CI. Always provide explicit release identity, sanitize
the remote before upload, and verify the symbol set afterwards.
Use top-level dry-run syntax:
posthog-cli --dry-run hermes upload --directory dist
Dry-run short-circuits artifact processing and network access; it does not prove that files are
valid, paired, or accepted by PostHog. For real verification, upload release artifacts in the
actual release job, then list/download the resulting symbol set by ref. Read
references/symbolication-releases.md before editing CI, Expo/EAS, Xcode, Gradle, or native
symbol workflows.
Known 0.8.1 traps
- The npm package declares the binary as
posthog-cli, notposthog. - npm 11 may warn that
@posthog/clipostinstall is not inallowScripts; globalnpm approve-scriptsfails withEGLOBAL. Use npm user config if approval is required. - Put global flags before the command (
posthog-cli --dry-run hermes upload …). - Prefer
--dotenv-file; Node's npm wrapper intercepts the spelling--env-file. api callsyntax isapi call [--json] [--dry-run] [--confirm] <tool> '<json>'; there is noapi runcommand.exp schema pullneeds a TTY for language selection and may only generate definitions for formally defined events, not every ingested custom event.exp endpointsis experimental. On 0.8.1, file-run variables can be rejected server-side; validate the exact server behavior before designing parameterized endpoint automation.hermes clonehas had metadata-transfer gaps; inspect the composed map instead of trusting the success message.--no-failhides command failures from automation. Avoid it in CI and agent workflows.
The full friction-tested list and recovery paths live in references/troubleshooting.md.
Project-local context
If a repo uses PostHog frequently, optionally keep .claude/posthog-cli.local.md (ignored) with
non-secret project facts: host, project ID, app surfaces, canonical north-star events, known test
accounts, and which products actually receive data. Never place tokens there. A template and
live-discovery checklist are in references/project-map.md.
Reference map
Load only what the current job needs:
references/cli-command-catalog.md— complete 0.8.1 command tree and key flags.references/auth-project-scoping.md— install, npm allowScripts, login, direnv, CI scopes, host/project/ingestion-region proof.references/api-tools.md— tools/search/info/schema/call, JSON output, dry-run, confirm, skills and AGENTS installer.references/analytics-workflows.md— schema-first typed trends/funnels/retention/paths, taxonomy, persons, dashboards, recordings.references/hogql.md—exp query, bounded HogQL recipes, system-table/entity search, syntax validation and privacy-safe output.references/observability.md— errors, recordings, logs, releases, LLM traces, health investigations and evidence ladders.references/product-operations.md— flags, experiments, surveys, insights, dashboards, annotations, cohorts, workflows, mutation safeguards.references/endpoints-schema-tasks.md— endpoint YAML lifecycle, typed schema generator, task commands and experimental caveats.references/symbolication-releases.md— web/Hermes/dSYM/ProGuard/native symbols, release identity, CI metadata hygiene and round-trip verification.references/safety-data-handling.md— PII minimization, shared-state authorization, output shaping and cleanup.references/troubleshooting.md— errors observed hands-on and exact recovery paths.references/project-map.md— optional per-repo context template and capability matrix.references/investigation-playbooks.md— end-to-end playbooks for metric drops, ingestion, setup audits, release health, user journeys, endpoints, and flag rollouts.references/sources-versioning.md— source authority, official links, version-sensitive surfaces, and the upgrade re-validation procedure.
Gives 0 of the 12 instructions most analytics metrics skills give in ~2.5k tokens
Counted across 368 of the 369 authors here whose files we hold, read 2026-08-06
- read product marketing context before asking questionsin 18 of 368, across 12 files
- use lowercase with underscores for event namesin 16 of 368, across 6 files
- track events for decisions not vanity metricsin 15 of 368, across 5 files
- use object-action format for event namesin 15 of 368, across 8 files
- produce a tracking plan documentin 14 of 368, across 4 files
- Call RUBE_SEARCH_TOOLS first to get current schemasin 13 of 368, across 2 files
- establish consistent event naming conventions before implementingin 10 of 368, across 4 files
- Verify dimension and metric compatibility before reportingin 9 of 368, across 2 files
- Encrypt data at rest and in transitin 9 of 368, across 3 files
- use snake_case for event namesin 9 of 368, across 5 files
- monitor technical health during the testin 9 of 368, across 5 files
- use consistent property namesin 8 of 368, across 4 files
Said here and by no other author read
- use posthog-cli for all operations
- prove host project and auth first
- prefer typed query tools over ad hoc HogQL
- discover tool names and schemas before calling
- bound query time and rows
- aggregate data before emitting context
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.