From core-skills
Automates PostHog dashboard creation, sync, update, and export via API. Manage analytics dashboards programmatically with JSON config files.
How this skill is triggered — by the user, by Claude, or both
Slash command
/core-skills:posthog-analyticsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Automate PostHog dashboard creation, sync, update, and export via API.
Automate PostHog dashboard creation, sync, update, and export via API.
curl - HTTP client (pre-installed on macOS/Linux)jq - JSON processor: brew install jq or apt install jqbash - Shell (the script is bash)export POSTHOG_PERSONAL_API_KEY=phx_xxx
Note: The API key determines your organization and project. The script uses @current project context (your default project).
# Test your API key - should return your project info
curl -s -H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
"https://us.i.posthog.com/api/projects/@current/" | jq '{id, name}'
Expected output:
{
"id": 209268,
"name": "Default project"
}
If you get an error, check your API key is correct and has proper permissions.
Create blog_dashboard.json:
{
"name": "Blog Analytics",
"description": "Track blog performance and reader engagement",
"filter": {"key": "source", "value": "blog"},
"dashboard_id": null,
"insights": [
{"name": "Blog Pageviews (Total)", "type": "pageviews_total"},
{"name": "Unique Blog Readers", "type": "unique_users"},
{"name": "Blog Traffic Trend", "type": "traffic_trend"},
{"name": "Top Blog Posts", "type": "top_pages"}
]
}
Note: Set dashboard_id: null for new dashboards.
./scripts/posthog_sync.sh create blog_dashboard.json
Output:
Creating dashboard: Blog Analytics
Dashboard created: ID 1166599
Creating insight: Blog Pageviews (Total)
{id: 6520531, name: "Blog Pageviews (Total)"}
...
Dashboard URL: https://us.posthog.com/project/209268/dashboard/1166599
The script:
1166599) and project_id (e.g., 209268) in the URLdashboard_idEdit config to add new insights, then:
./scripts/posthog_sync.sh sync blog_dashboard.json
Only creates NEW insights. Existing ones (matched by name) are skipped.
Changed your filter? Edit config, then:
./scripts/posthog_sync.sh update blog_dashboard.json
Updates ALL insights with current config settings. Use when changing filters.
./scripts/posthog_sync.sh export 1166599 > exported_dashboard.json
| Field | Required | Description |
|---|---|---|
name | Yes | Dashboard name |
description | No | Dashboard description |
filter | No* | Event property filter: {"key": "source", "value": "blog"} |
domain_filter | No* | URL filter fallback: "blog.sylph.ai" |
dashboard_id | No | Set to null for create, or existing ID for sync/update |
insights | Yes | Array of insight objects |
*At least one filter recommended. filter takes precedence over domain_filter.
| Type | Display | Description |
|---|---|---|
pageviews_total | BoldNumber | Total pageview count |
unique_users | BoldNumber | Unique visitors (DAU) |
traffic_trend | LineGraph | Traffic over time |
top_pages | Table | Top pages breakdown |
| Field | Default | Options |
|---|---|---|
math | total | total, dau, weekly_active, monthly_active |
display | Auto | BoldNumber, ActionsLineGraph, ActionsTable |
date_range | -30d | -7d, -30d, -90d, etc. |
| Variable | Required | Default | Description |
|---|---|---|---|
POSTHOG_PERSONAL_API_KEY | Yes | - | Your API key (determines org/project) |
POSTHOG_HOST | No | us.i.posthog.com | API host (EU: eu.i.posthog.com) |
POSTHOG_UI_HOST | No | us.posthog.com | UI host for dashboard URLs |
scripts/posthog_sync.sh - CLI script (create/sync/update/export)examples/blog_dashboard.json - Example confignpx claudepluginhub sylphai-inc/skills --plugin core-skillsImplements PostHog product analytics including event tracking, user identification, feature flags, and pageview tracking for Next.js and React apps.
Guides querying PostHog data via HogQL/SQL: finding entities (insights, dashboards, cohorts, etc.) and running analytics queries (trends, funnels, retention, sessions, LLM traces). Covers schema, HogQL syntax, and examples.
Installs PostHog SDKs for browser JS, Node.js server, Python; configures project/personal API keys and env vars for new integrations.