ai-infrastructure-hugg…
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming, embeddings, image generation,…
PostHog analytics and feature flags setup
$ npx -y skills add agents-inc/skills --skill api-analytics-setup-posthog --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/api-analytics-setup-posthogContext preview
The summary Claude sees to decide when to auto-load this skill.
PostHog analytics and feature flags setup
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>
> **All code must follow project conventions in CLAUDE.md** (kebab-case, named exports, import ordering, `import type`, named constants)
**(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>
The official skills marketplace for Agents Inc. 150+ 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?
Repo: agents-inc/skills
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming, embeddings, image generation,…
LiteLLM proxy server setup, TypeScript client patterns via OpenAI SDK, model routing, fallbacks, load balancing, spend tracking, virtual keys, and production…
Serverless GPU compute platform for AI model deployment — web endpoints, GPU functions, model serving, and TypeScript client patterns
Local LLM inference with the Ollama JavaScript client -- chat, streaming, tool calling, vision, embeddings, structured output, model management, and…
Replicate SDK patterns for TypeScript/Node.js -- client setup, predictions, streaming, webhooks, file handling, model versioning, deployments, and training
Together AI SDK patterns for TypeScript — client setup, chat completions, streaming, structured output, function calling, embeddings, image generation,…