posthog-performance-tuning
Optimize PostHog performance: local flag evaluation, client batching config, event sampling, efficient HogQL queries, and serverless flush patterns. "posthog caching", "posthog slow", "posthog batch", "posthog fast". '
npx skills add jeremylongshore/claude-code-plugins-plus-skills --skill posthog-performance-tuning --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# PostHog Performance Tuning ## Overview Optimize PostHog for production workloads. The biggest performance wins are: local feature flag evaluation (eliminates network calls), proper batching configuration, event sampling for high-volume apps, and efficient HogQL queries with date filters. ## Prerequisites - `posthog-node` and/or `posthog-js` installed - Personal API key (`phx_...`) for local flag evaluation - Feature flags configured (if applicable) ## Instructions ### Step 1: Enable Local Feature Flag Evaluation The single biggest performance improvement. Without local evaluation, every `getFeatureFlag()` call makes a network request (~50-200ms). With local evaluation, flag definitions are cached and evaluation is instant (~0.1ms). ```typescript import { PostHog } from 'posthog-node'; const posthog = new PostHog(process.env.NEXT_PUBLIC_POSTHOG_KEY!, { host: 'https://us.i.posthog.com', // This is the key: personal API key enables local flag evaluation personalApiKey: process.env.POSTHOG_PERSONAL_API_KEY, // Flag definitions are polled every 30 seconds by default // Adjust if you need faster flag updates: // featureFlagsPollingInterval: 10000, // 10 seconds }); // With personalApiK
- Overview
- Prerequisites
- Instructions
- Step 1: Enable Local Feature Flag Evaluation
- Step 2: Optimize Client Batching
- Step 3: Event Sampling (Browser)
- Step 4: Efficient HogQL Queries
- Step 5: Session Recording Performance
- Performance Benchmarks
- Error Handling
- Output
- Resources
What does the posthog-performance-tuning skill do?
Optimize PostHog performance: local flag evaluation, client batching config, event sampling, efficient HogQL queries, and serverless flush patterns. "posthog caching", "posthog slow", "posthog batch", "posthog fast". '
How do I install it?
Run `npx skills add jeremylongshore/claude-code-plugins-plus-skills --skill posthog-performance-tuning --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From jeremylongshore/claude-code-plugins-plus-skills, a repository with 2,630 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.