flags-sdk

Configure feature flags and A/B tests with the Flags SDK and Vercel Flags.

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/ridhijain709/AIPORSCHE --skill flags-sdk-ridhijain709
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flags-sdk
Source: https://github.com/ridhijain709/AIPORSCHE/tree/main/.agents/skills/flags-sdk/upstream
Command: npx skills add https://github.com/ridhijain709/AIPORSCHE --skill flags-sdk-ridhijain709

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires flags, @flags-sdk/vercel, @vercel/toolbar, and includes references (resource) components.

What problem does it solve? Setting up feature flags and A/B tests in Next.js or SvelteKit involves many moving parts: installing the SDK, linking a Vercel project, pulling environment variables, declaring flags in code, wiring adapters, and managing rollouts via CLI. This Skill guides the AI through each step end-to-end so nothing is missed or left as a manual follow-up. ## Core Features & Use Cases - SDK Setup & Flag Creation: Installs flags and @flags-sdk/vercel, links the project, pulls OIDC credentials, and declares flags with flag() and vercelAdapter. - Provider Adapters: Connects flags to Vercel Flags, Statsig, LaunchDarkly, PostHog, GrowthBook, Flagsmith, OpenFeature, and custom adapters. - Precompute & Static Pages: Implements the precompute pattern with middleware so flagged pages stay static and CDN-served. - Use Case: Ask the AI to add a summer-sale boolean flag to your Next.js app — it runs vercel flags create, pulls env vars, declares the flag in flags.ts, and wires it into your page. ## Quick Start Set up the Flags SDK in my Next.js project and create a boolean feature flag called show-banner using Vercel Flags.

Frequently Asked Questions about flags-sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a feature flag to a Next.js app with Vercel Flags?

Install flags and @flags-sdk/vercel, link the project with vercel link, then run vercel flags create <key> --kind boolean. Declare the flag in flags.ts using flag() with vercelAdapter, and call it from any async server component.

How to use feature flags in SvelteKit?

Install the flags package and declare flags with flag() from flags/sveltekit. Set up createHandle in hooks.server.ts with your FLAGS_SECRET and flags module, then call the flag inside a load function to resolve its value server-side.

Does the Flags SDK support providers other than Vercel?

Yes, the Flags SDK supports Statsig, LaunchDarkly, PostHog, GrowthBook, Flagsmith, Reflag, OpenFeature, Split, and Optimizely through dedicated @flags-sdk/* adapter packages. You can also write a custom adapter implementing origin and decide functions.

What is the precompute pattern in the Flags SDK?

Precompute evaluates flags in middleware and encodes results into a URL code via rewrite, so pages read precomputed values instead of re-evaluating. This keeps flagged pages static and CDN-served, with generatePermutations enabling build-time prerendering of all variants.

Why does local flag evaluation fail with an authentication error?

Local evaluation fails when .env.local is missing the VERCEL_OIDC_TOKEN that vercelAdapter uses for authentication. Run vercel env pull to write the Development credentials, and re-pull after creating your first flag to obtain FLAGS_SECRET.

When should I use evaluate() instead of awaiting flags individually?

Use evaluate() when resolving multiple flags at once, since it reads headers, cookies, and overrides once for the batch and lets adapters resolve groups via bulkDecide. Awaiting flags sequentially sums latencies, while Promise.all evaluates each flag in isolation.