flags-sdk

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

Updated Aug 21, 2025
One-click install
npx skills add https://github.com/Adithiya-S/AI-Study-Companion --skill flags-sdk-adithiya-s
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: flags-sdk
Source: https://github.com/Adithiya-S/AI-Study-Companion/tree/main/.agents/skills/flags-sdk/upstream
Command: npx skills add https://github.com/Adithiya-S/AI-Study-Companion --skill flags-sdk-adithiya-s

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 OIDC credentials, declaring flags in code, wiring adapters, and managing rollouts via CLI. This Skill guides the entire workflow end-to-end so flags are created, connected, and evaluated correctly without missed steps. ## Core Features & Use Cases - End-to-end flag setup: Installs the flags package, links the Vercel project, pulls environment variables, configures the Vercel Toolbar, and creates the Flags Explorer discovery endpoint. - Flag creation and adoption: Creates new flags via vercel flags create or adopts existing dashboard flags by mapping vercel flags inspect output to typed flag() declarations. - Provider adapters and patterns: Covers Vercel, Statsig, LaunchDarkly, PostHog, GrowthBook, and custom adapters, plus precompute, identify/dedupe, bulk evaluate(), and encrypted flag values. - Use Case: Ask the agent to add a new-checkout boolean flag to a Next.js app; it installs the SDK, runs vercel flags create, declares the flag with vercelAdapter, and renders conditional UI in a server component. ## Quick Start Set up the Flags SDK in my Next.js project and create a boolean feature flag called show-banner wired to 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 the flags and @flags-sdk/vercel packages, 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 an async server component.

How do I use the vercel flags CLI to manage feature flags?▼

The vercel flags CLI supports create, inspect, list, enable, disable, set, update, split, rollout, rules, segments, evaluations, versions, archive, and rm subcommands. The project must be linked with a .vercel directory, and you can run vercel flags <cmd> --help for current options.

Does the Flags SDK support providers other than Vercel?▼

Yes, the Flags SDK supports Statsig, LaunchDarkly, PostHog, GrowthBook, Flagsmith, Reflag, OpenFeature, Split, Optimizely, and custom adapters. Each provider has a dedicated @flags-sdk/* package that replaces decide and origin on the flag declaration.

Can I use the Flags SDK with SvelteKit instead of Next.js?▼

Yes, the flags/sveltekit module provides flag(), createHandle, precompute, and generatePermutations for SvelteKit. You set up a server hook in hooks.server.ts with createHandle and your FLAGS_SECRET, then call flags in load functions.

Why does local flag evaluation fail with an authentication error?▼

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

How do I keep pages static while using feature flags?▼

Use the precompute pattern: middleware evaluates a flag group with precompute() and rewrites the request to a URL containing the encoded code. Pages read values from the code, and generatePermutations enables build-time prerendering of all variants.