ai-infrastructure-hugg…
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming,…
PostHog analytics and feature flags setup
Claude Code
$ npx -y skills add agents-inc/skills --skill api-analytics-setup-posthog --agent claude-code
Codex
$ npx skills add agents-inc/skills --skill api-analytics-setup-posthog -a codex -y
Cursor
$ npx skills add agents-inc/skills --skill api-analytics-setup-posthog -a cursor -y
Gemini CLI
$ npx skills add agents-inc/skills --skill api-analytics-setup-posthog -a gemini-cli -y
GitHub Copilot
$ npx skills add agents-inc/skills --skill api-analytics-setup-posthog -a github-copilot -y
OpenCode
$ npx skills add agents-inc/skills --skill api-analytics-setup-posthog -a opencode -y
Windsurf
$ npx skills add agents-inc/skills --skill api-analytics-setup-posthog -a windsurf -y
name: api-analytics-setup-posthog description: PostHog analytics and feature flags setup
> **Quick Guide:** One-time setup for PostHog analytics and feature flags. Covers `posthog-js` client provider, `posthog-node` server client, and environment variables. PostHog handles both analytics AND feature flags with a generous free tier (1M events + 1M flag requests/month).
---
<critical_requirements>
**(You MUST initialize posthog-js only in a client/browser context - it requires browser APIs like window and localStorage)**
**(You MUST call `posthog.shutdown()`, `posthog.flush()`, or use `captureImmediate()` after server-side event capture to prevent lost events)**
**(You MUST use `defaults: '2026-01-30'` for automatic SPA page tracking and latest recommended behaviors)**
</critical_requirements>
---
**Auto-detection:** PostHog setup, posthog-js, posthog-node, PostHogProvider, analytics setup, feature flags setup, event tracking setup, posthog.init
**When to use:**
**When NOT to use:**
**Key patterns covered:**
**Detailed Resources:**
---
<philosophy>
PostHog is a **product analytics + feature flags platform** that consolidates multiple tools into one. It's open-source, can be self-hosted, and has a generous free tier. For solo developers and small teams, PostHog eliminates the need for separate analytics and feature flag services.
**Core principles:**
1. **One platform for analytics + feature flags** - Reduces tool sprawl and cost 2. **Usage-based pricing** - Pay for what you use, not per-project 3. **Autocapture by default** - Automatic event tracking reduces manual instrumentation 4. **Server and client SDKs** - Full coverage for SSR and client-side apps
**When to use PostHog:**
**When NOT to use PostHog:**
</philosophy>
---
<patterns>
Use a single PostHog organization for your apps. One org pools billing. Use separate projects per app, or one project with custom properties to filter.
PostHog Organization: "Your Company" ├── Project: "Main App" (or separate per app) │ ├── API Key: phc_xxx │ └── Host: https://us.i.posthog.com (or eu.i.posthog.com)
**Why good:** Single org pools billing across all projects, usage-based pricing, 6 projects included on paid tier
---
Install `posthog-js` and configure a provider or use your framework's client-side initialization hook.
Key config options: `defaults: "2026-01-30"` enables recommended behaviors, `person_profiles: "identified_only"` reduces costs.
See [examples/core.md](examples/core.md) for full implementation of both approaches.
**Why good:** `defaults` date enables automatic SPA page/leave tracking, `person_profiles: "identified_only"` reduces event costs, debug mode in development aids troubleshooting
---
Install `posthog-node` and create a singleton for server-side event capture.
**Serverless flush options:**
See [examples/server.md](examples/server.md) for singleton setup, API route usage, and the flush anti-pattern.
**Why good:** Singleton prevents multiple client instances, flushInterval/flushAt configure batching, captureImmediate simplifies serverless usage
</patterns>
---
<red_flags>
**Gotchas & Edge Cases:**
The official skills marketplace for Agents Inc. 230+ skills covering everything from React and Prisma to Redis, ElevenLabs, and infrastructure tooling. Pick the skills that match your stack and install them via Claude Code. Need more control?
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming,…
LiteLLM proxy server setup, TypeScript client patterns via OpenAI SDK, model routing, fallbacks, load balancing, spend tracking,…
Serverless GPU compute platform for AI model deployment — web endpoints, GPU functions, model serving, and TypeScript client…
Local LLM inference with the Ollama JavaScript client -- chat, streaming, tool calling, vision, embeddings, structured output,…
Replicate SDK patterns for TypeScript/Node.js -- client setup, predictions, streaming, webhooks, file handling, model versioning,…
Together AI SDK patterns for TypeScript — client setup, chat completions, streaming, structured output, function calling,…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.