posthog-cli

Installation
SKILL.md

PostHog CLI

Run bunx --bun @posthog/cli@latest from the user's project directory, where helpers discover the nearest .env.local or .env. Never install the CLI globally or through npm, npx, pnpm, or yarn. Helpers live under the skill directory:

POSTHOG_SKILL_DIR="${POSTHOG_SKILL_DIR:-$HOME/.agents/skills/posthog-cli}"

Explicit user instructions override anything below.

Access

Headless use takes POSTHOG_CLI_API_KEY (a scoped personal key, phx_), POSTHOG_CLI_PROJECT_ID, and POSTHOG_CLI_HOST (https://us.posthog.com, https://eu.posthog.com, or the self-hosted origin). Helpers also accept POSTHOG_PERSONAL_API_KEY, POSTHOG_PROJECT_ID, and POSTHOG_HOST, resolving project from an explicit argument, then the environment, then the nearest env file. A phc_ project key is an ingestion credential and cannot operate the management API.

bash "$POSTHOG_SKILL_DIR/scripts/posthog-ensure.sh" checks Bun, the CLI, curl, jq, key shape, host, project, and authentication with one read-only request; run it only when the task needs live access. Keys never appear in arguments, URLs, output, or commits. login, dashboard URLs, api skill install, and api agents-md install need the user's explicit request. Missing dependencies are reported, never installed automatically.

For schema discovery without credentials in the subprocess:

Installs
6
Repository
arthjean/skills
GitHub Stars
3
First Seen
Jul 30, 2026