byaan-ai/byaan/posthog
Claude Code and agent skill by byaan-ai/byaan
- community
Checking that the SKILL.md file is still in the repository.
Query events, run HogQL analytics, and access product data
Install
npx vskill@latest install byaan-ai/byaan/posthogSKILL.md
PostHog
Use the PostHog API to query events, run HogQL analytics, and access product data like persons, insights, and feature flags.
Setup Guide
Before using this skill, you need to create a Personal API Key and find your Project ID.
1. Create a Personal API Key
- Open PostHog and click your avatar in the bottom-left corner
- Click "Settings"
- Navigate to the "Personal API Keys" tab
- Click "Create personal API key"
- Give it a label (e.g., "Byaan")
- Configure scopes as described below
- Click "Create key"
- Copy the key (starts with
phx_) - Paste this key in Settings > Skills > PostHog in the app
2. Find Your Project ID
- In PostHog, go to Project Settings (gear icon in sidebar)
- Look at the URL — it contains the numeric project ID:
https://us.posthog.com/project/12345/settings - The number after
/project/is your Project ID (e.g.,12345) - Enter this ID in Settings > Skills > PostHog in the app
3. Required Scopes
When creating the Personal API Key, enable Read access for the following scopes:
| Scope | Access | Purpose | |
|---|---|---|---|
| Query | Read | Execute HogQL queries | |
| Event | Read | Access event data | |
| Person | Read | Access person/user data | |
| Insight | Read | Access saved insights | |
| Dashboard | Read | Access dashboards | |
| Feature flag | Read | Access feature flag configurations | |
| Cohort | Read | Access cohort definitions |
All other scopes can be set to "No access" for maximum security.
4. Base URL (Region)
The default base URL is https://us.posthog.com (US Cloud). If you use a different region:
| Region | Base URL | |
|---|---|---|
| US Cloud | https://us.posthog.com | |
| EU Cloud | https://eu.posthog.com | |
| Self-hosted | Your custom domain |
How Authentication Works
You do not need to handle authentication manually. When you call execute_skill_api(), the system automatically:
- Retrieves the API key from the configured credentials
- Adds the
Authorization: Bearer <api_key>header - Sends the request with proper content-type headers
Just call the API with skill name, endpoint path, method, and body — authentication is handled for you.
How to Call the API
PostHog uses REST with HogQL queries for analytics. The main query endpoint is:
Call execute_skill_api() with these parameters:
Note: Replace {project_id} with the actual project ID from the credentials.
HogQL Syntax
HogQL is PostHog's SQL dialect for querying analytics data. It supports standard SQL with some extensions.
Available Tables
| Table | Description | |
|---|---|---|
events | All tracked events with properties | |
persons | User/person data and properties | |
sessions | Session aggregations | |
groups | Group analytics data |
Events Table Columns
| Column | Type | Description | |
|---|---|---|---|
event | String | Event name (e.g., $pageview, $autocapture) | |
timestamp | DateTime | When the event occurred | |
distinct_id | String | User identifier | |
properties | Object | Event properties (access with properties.$key) | |
person_id | UUID | Internal person identifier | |
person | Object | Person properties |
Accessing Properties
Use dot notation for nested properties:
Common Functions
| Function | Description | |
|---|---|---|
count() | Count rows | |
countDistinct(column) | Count unique values | |
sum(column) | Sum values | |
avg(column) | Average | |
min(column) / max(column) | Min/max | |
toDate(timestamp) | Convert to date | |
dateDiff('day', start, end) | Date difference | |
now() | Current timestamp | |
today() | Current date |
Common Queries
Recent Events
Event Counts by Type
Pageviews by URL
Unique Users
User Activity Summary
Daily Active Users
Events by Browser
Funnel Analysis (Manual)
Session Duration
Top Referrers
Other API Endpoints
Get Persons
Get Insights
Get Dashboards
Get Feature Flags
Get Cohorts
Get Events (Non-HogQL) — deprecated
PostHog has deprecated this endpoint (kept for backwards compatibility, offset capped at 50,000). Prefer the Query endpoint with HogQL for any ad-hoc listing or aggregation of events.
Pagination
List endpoints paginate in one of two ways:
- Cursor-style `next` URLs (persons, insights, dashboards): the response contains
{"next": "<url>", "previous": ..., "results": [...]}— request thenextURL (path + query only, same host) for the following page - `limit` / `offset` (events): skip-based paging
For HogQL queries, use LIMIT and OFFSET clauses:
Rate Limits
| Endpoint | Limit | |
|---|---|---|
| Query endpoint | 2400/hour (per organization) | |
| Analytics endpoints (insights, persons, recordings) | 240/minute, 1200/hour | |
| CRUD/list endpoints | 480/minute, 4800/hour |
PostHog reserves the right to throttle or reject queries that look like bulk exports — keep queries analytical, not extractive.
Common Pitfalls
- Project ID is required: All API calls require the project ID in the URL path. Get it from Project Settings.
- HogQL requires proper query structure: The query body must have
"kind": "HogQLQuery"and the SQL in"query".
- Property access syntax: Use
properties.$keyfor event properties. The$prefix is part of PostHog's naming convention for built-in properties.
- Date filtering: Use
timestamp > now() - INTERVAL N DAYfor recent data. Without date filters, queries may be slow.
- Result caps: Without an explicit
LIMIT, HogQL results are capped at 100 rows. With an explicitLIMIT, up to 50,000 rows per query.
- Region-specific URLs: US Cloud uses
us.posthog.com, EU Cloud useseu.posthog.com. Using the wrong region will fail.
- Personal vs Project API Keys: Use Personal API Keys (start with
phx_), not Project API Keys (which are for client-side tracking).
- Case sensitivity: Event names and property keys are case-sensitive.
$pageviewis different from$Pageview.
- Empty results: If queries return no data, check the date range and ensure events exist for that period.
Notes
- HogQL supports most standard SQL features including JOINs, subqueries, and window functions
- Built-in events start with
$(e.g.,$pageview,$autocapture,$pageleave) - Custom events use your own naming convention
- Person properties are updated asynchronously, so recent changes may not appear immediately
- For complex analytics, consider using PostHog's built-in Insights rather than raw HogQL
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingserver/skills/posthog/SKILL.md
Popularity
- Repository stars
- 96
- Repository forks
- 1
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 5 Jul 2026, 4 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/byaan-ai/byaan/posthog)