Agent skill
posthog-analytics
Product analytics expert using PostHog MCP. Triggers on requests to understand user behavior, surface insights, create dashboards, analyze funnels, track metrics, set up experiments, or answer questions about product performance. Use when working with PostHog data, discussing analytics strategy, investigating user journeys, retention, conversion, feature adoption, or when asked to help understand what's happening in the product.
Install this agent skill to your Project
npx add-skill https://github.com/petekp/agent-skills/tree/main/skills/posthog-analytics
SKILL.md
PostHog Analytics Expert
Transform PostHog data into actionable product insights. This skill combines product analytics expertise with the PostHog MCP server to help discover patterns, surface opportunities, and build a data-informed product strategy.
Product Context Management
Before diving into analysis, establish product context. Store discovered knowledge in .claude/product-context.md for persistence across sessions.
First Session: Discovery
- Check for existing context: Read
.claude/product-context.mdif it exists - Interview the user (if context is missing or incomplete):
- What does the product do? Who are the users?
- What are the key user actions/conversions?
- What business metrics matter most?
- Explore PostHog data:
event-definitions-list- Discover tracked eventsproperties-list- Understand available propertiesinsights-get-all- See existing insightsdashboards-get-all- Review current dashboards
- Save context: Write discovered knowledge to
.claude/product-context.md
Context File Structure
# Product Context
## Product Overview
[What the product does, target users]
## Key Events
| Event | Meaning | Importance |
|-------|---------|------------|
| $pageview | Page visit | Navigation tracking |
| signup_completed | User registered | Core conversion |
| [custom events discovered] | | |
## Important Properties
- user_tier: free/pro/enterprise
- [other key properties]
## Key Metrics
- Primary: [e.g., Weekly Active Users, Conversion Rate]
- Secondary: [e.g., Feature Adoption, Retention]
## Funnels
- Activation: signup → onboarding_complete → first_value_action
- [other key funnels]
## Last Updated: [date]
Core Capabilities
1. Proactive Insight Discovery
When asked to "find insights" or "what's interesting", run this discovery workflow:
1. Trends Analysis
- query-run: Total events over 30 days (spot volume changes)
- query-run: DAU/WAU/MAU trends (engagement health)
- query-run: Key conversion events over time
2. Funnel Health
- query-run: Core activation funnel
- query-run: Conversion funnel (trial → paid if SaaS)
- Look for: Drop-off points, conversion changes
3. Retention Check
- query-run: Cohort retention (week-over-week)
- Look for: Retention curve shape, changes over time
4. Feature Adoption
- query-run: Feature usage by user segment
- Look for: Underused features, power user patterns
5. Error Impact
- list-errors: Top errors by occurrence
- error-details: Impact on user journeys
Insight Presentation Format:
## [Insight Title]
**Finding**: [One sentence summary]
**Evidence**: [Specific numbers/data]
**Impact**: [Why this matters]
**Recommended Action**: [What to do about it]
2. Answering Analytics Questions
Map common questions to PostHog queries:
| Question Pattern | Approach |
|---|---|
| "How many users..." | query-run with TrendsQuery, math: "dau" or "total" |
| "What % convert..." | query-run with FunnelsQuery |
| "Where do users drop off..." | FunnelsQuery → analyze step-by-step conversion |
| "Which feature is most used..." | TrendsQuery with breakdown by feature/event |
| "How is X changing over time..." | TrendsQuery with interval: "day" or "week" |
| "Who are our power users..." | TrendsQuery with breakdown by user property |
| "What's causing errors..." | list-errors → error-details for top issues |
3. Dashboard Creation
When building dashboards, follow this structure:
Executive Dashboard (high-level health):
- Active users (DAU/WAU/MAU)
- Core conversion rate
- Retention (week 1, week 4)
- Revenue metrics (if applicable)
Product Dashboard (feature-level):
- Feature adoption rates
- Feature engagement depth
- User journey completion
- Error rates by feature
Growth Dashboard (acquisition/activation):
- Signup funnel
- Activation funnel
- Traffic sources (if tracked)
- Onboarding completion
Workflow:
dashboard-createwith descriptive name- Build insights with
query-run→insight-create-from-query - Add to dashboard with
add-insight-to-dashboard - Organize with
dashboard-reorder-tiles
4. Experiment Design
When setting up A/B tests:
- Clarify hypothesis: What change, expected impact, and why
- Find existing flags:
feature-flag-get-all(reuse if appropriate) - Choose metrics: Use
event-definitions-listto find trackable events - Set up experiment:
experiment-createwith:- Clear name and description
- Primary metric (what you're optimizing)
- Secondary metrics (guardrails)
- Appropriate sample size (MDE guidance)
See references/experiments.md for detailed experiment patterns.
5. Cohort & Segment Analysis
For understanding user segments:
1. Define cohort criteria (user properties, behaviors)
2. Compare cohorts on key metrics:
- query-run with breakdownFilter by cohort property
- Conversion rates per segment
- Retention per segment
3. Identify highest-value segments
4. Recommend targeting strategies
Query Patterns
TrendsQuery (counts over time)
{
"kind": "InsightVizNode",
"source": {
"kind": "TrendsQuery",
"dateRange": {"date_from": "-30d"},
"interval": "day",
"series": [{
"kind": "EventsNode",
"event": "event_name",
"custom_name": "Display Name",
"math": "total"
}]
}
}
Math options: total, dau, weekly_active, monthly_active, unique_session, avg, sum, min, max
FunnelsQuery (conversion analysis)
{
"kind": "InsightVizNode",
"source": {
"kind": "FunnelsQuery",
"dateRange": {"date_from": "-30d"},
"series": [
{"kind": "EventsNode", "event": "step_1", "custom_name": "Step 1"},
{"kind": "EventsNode", "event": "step_2", "custom_name": "Step 2"},
{"kind": "EventsNode", "event": "step_3", "custom_name": "Step 3"}
],
"funnelsFilter": {
"funnelWindowInterval": 7,
"funnelWindowIntervalUnit": "day"
}
}
}
Breakdown Analysis
Add to any query:
"breakdownFilter": {
"breakdown": "property_name",
"breakdown_type": "event" // or "person"
}
SaaS Metrics Framework
For SaaS products, prioritize these metrics:
| Metric | Query Approach | Why It Matters |
|---|---|---|
| Activation Rate | Funnel: signup → key_action | Validates onboarding |
| DAU/MAU Ratio | Trends: DAU ÷ MAU | Engagement stickiness |
| Feature Adoption | Trends: feature_used by user | Product-market fit signals |
| Retention (D7, D30) | Cohort retention query | Long-term value predictor |
| Conversion (Trial→Paid) | Funnel: trial_start → subscription | Revenue health |
| Expansion Revenue | Trends: upgrade events | Growth efficiency |
| Churn Indicators | Declining usage patterns | Early warning system |
Resources
- references/experiments.md - Detailed experiment design patterns
- references/saas-playbook.md - SaaS-specific analytics strategies
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
multi-model-meta-analysis
Synthesize outputs from multiple AI models into a comprehensive, verified assessment. Use when: (1) User pastes feedback/analysis from multiple LLMs (Claude, GPT, Gemini, etc.) about code or a project, (2) User wants to consolidate model outputs into a single reliable document, (3) User needs conflicting model claims resolved against actual source code. This skill verifies model claims against the codebase, resolves contradictions with evidence, and produces a more reliable assessment than any single model.
capture-learning
Analyze recent conversation context and capture learnings to project knowledge files (for project-specific insights) or skills/commands/subagents (for cross-project patterns). Use when the user asks to "capture this learning", "update the docs with this", "remember this for next time", "document this issue", "add this to CLAUDE.md", "save this knowledge", or "update project knowledge". Also triggers after resolving build/setup issues, discovering non-obvious patterns, or completing debugging sessions with valuable insights.
optimize-agent-docs
Build a retrieval-optimized knowledge layer over agent documentation in dotfiles (.claude, .codex, .cursor, .aider). Use when asked to "optimize docs", "improve agent knowledge", "make docs more efficient", or when documentation has accumulated and retrieval feels inefficient. Generates a manifest mapping task-contexts to knowledge chunks, optimizes information density, and creates compiled artifacts for efficient agent consumption.
agent-changelog
Compile an agent-optimized changelog by cross-referencing git history with plans and documentation. Use when asked to "update changelog", "compile history", "document project evolution", or proactively after major milestones, architectural changes, or when stale/deprecated information is detected that could confuse coding agents.
literate-guide
Create a narrative guide to a codebase or feature in the style of Knuth's Literate Programming — code and prose interwoven as a single essay, ordered for human understanding rather than compiler needs. Use when the user asks to 'explain this codebase as a story', 'write a literate guide', 'create a narrative walkthrough', 'tell the story of this code', 'Knuth-style documentation', 'weave a guide for this feature', or when they want deep, readable documentation that treats the program as literature. Also trigger when someone wants a document that a thoughtful reader could follow from start to finish and come away understanding both WHAT the code does and WHY every design choice was made.
autonomous-agent-readiness
Assess a codebase's readiness for autonomous agent development and provide tailored recommendations. Use when asked to evaluate how well a project supports unattended agent execution, assess development practices for agent autonomy, audit infrastructure for agent reliability, or improve a codebase for autonomous agent workflows. Triggers on requests like "assess this project for agent readiness", "how autonomous-ready is this codebase", "evaluate agent infrastructure", or "improve development practices for agents".
Didn't find tool you were looking for?