ai-infrastructure-hugg…
Hugging Face Inference SDK patterns for TypeScript/Node.js — InferenceClient setup, chat completion, text generation, streaming, embeddings, image generation,…
PostHog feature flags, rollouts, A/B testing. Use when implementing gradual rollouts, A/B tests, kill switches, remote configuration, beta features, or user targeting with PostHog.
$ npx -y skills add agents-inc/skills --skill api-flags-posthog-flags --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/api-flags-posthog-flagsContext preview
The summary Claude sees to decide when to auto-load this skill.
PostHog feature flags, rollouts, A/B testing. Use when implementing gradual rollouts, A/B tests, kill switches, remote configuration, beta features, or user targeting with PostHog.
name: api-flags-posthog-flags description: PostHog feature flags, rollouts, A/B testing. Use when implementing gradual rollouts, A/B tests, kill switches, remote configuration, beta features, or user targeting with PostHog.
> **Quick Guide:** Use PostHog feature flags for gradual rollouts, A/B testing, and remote configuration. Client-side: `useFeatureFlagEnabled` hook. Server-side: `posthog-node` with local evaluation. Always pair `useFeatureFlagPayload` with `useFeatureFlagEnabled` for experiments. Handle the `undefined` loading state on every flag check.
---
<critical_requirements>
> **All code must follow project conventions in CLAUDE.md** (kebab-case, named exports, import ordering, `import type`, named constants)
**(You MUST always pair `useFeatureFlagPayload` with `useFeatureFlagEnabled` or `useFeatureFlagVariantKey` for experiments - payload hooks don't send exposure events)**
**(You MUST use the feature flags secure API key (phs\_\*) for server-side local evaluation - personal API keys are deprecated for this use)**
**(You MUST handle the `undefined` state when flags are loading - never assume a flag is immediately available)**
**(You MUST include flag owner and expiry date in flag metadata - flags without owners become orphaned debt)**
**(You MUST wrap flag usage in a single function when used in multiple places - prevents orphaned flag code on cleanup)**
</critical_requirements>
---
**Auto-detection:** PostHog feature flags, useFeatureFlagEnabled, useFeatureFlagPayload, useFeatureFlagVariantKey, PostHogFeature, isFeatureEnabled, getFeatureFlag, gradual rollout, A/B test, experiment, multivariate flag
**When to use:**
**When NOT to use:**
**Key patterns covered:**
---
**Detailed Resources:**
---
<philosophy>
Feature flags decouple deployment from release. You can ship code to production but control who sees it and when. This enables:
1. **Safe releases** - Roll out to 1% first, monitor, then expand 2. **Fast rollback** - Toggle off instantly without deploying 3. **Data-driven decisions** - A/B test to measure impact 4. **Progressive delivery** - Beta users first, then everyone
**Core principles:**
**When to use feature flags:**
**When NOT to use feature flags:**
</philosophy>
---
<patterns>
Use `useFeatureFlagEnabled` for simple on/off features. Always handle the `undefined` loading state -- treating it as `false` causes a flash of wrong UI.
const isNewCheckout = useFeatureFlagEnabled(FLAG_NEW_CHECKOUT); if (isNewCheckout === undefined) return <Skeleton />; // Loading if (isNewCheckout) return <NewCheckout />; // Enabled return <LegacyCheckout />; // Disabled
Store flag keys as named constants in `lib/feature-flags.ts` to prevent typos and enable cleanup-by-grep.
See [examples/core.md](examples/core.md#pattern-1-client-side-boolean-flags) for full good/bad examples.
---
Use `useFeatureFlagVariantKey` for A/B tests with multiple variants. Define variant constants alongside the flag key. Switch on variants with a default fallback to `control`.
const variant = useFeatureFlagVariantKey(FLAG_PRICING_PAGE);
if (variant === undefined) return <Skeleton />;
switch (variant) {
case VARIANT_SIMPLE: return <SimplePricing />;
case VARIANT_DETAILED: return <DetailedPricing />;
default: return <ControlPricing />;
}See [examples/core.md](examples/core.md#pattern-2-multivariate-flags-and-variants) for full example.
---
The `PostHogFeature` component provides automatic exposure tracking and built-in fallback handling with less boilerplate. Use `match={true}` for boolean flags or `match={VARIANT_KEY}` for specific variants.
<PostHogFeature flag={FLAG_BETA} match={true} fallback={<Legacy />}>
<NewFeature />
</PostHogFeature>See [examples/core.md](examp
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,…