flags-sdk

Implement feature flags and A/B tests in Next.js and SvelteKit using the Flags SDK.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Rolling out features safely and running A/B tests requires wiring flag providers, server-side evaluation, and static page delivery, which is error-prone to set up manually. This Skill guides the full workflow of declaring flags as code, connecting providers, and keeping pages static. ## Core Features & Use Cases - End-to-end flag creation: Installs the flags package, registers flags via the vercel flags CLI, pulls environment variables, and declares flags with vercelAdapter in one guided workflow. - Multi-provider adapters: Connects flags to Vercel Flags, Statsig, LaunchDarkly, PostHog, GrowthBook, Hypertune, Flagsmith, Reflag, OpenFeature, and more, or supports writing custom adapters. - Precompute pattern for static pages: Evaluates flags in middleware and encodes results into URLs so marketing pages stay static and CDN-served. - Use Case: A developer wants to gate a new dashboard behind a feature flag. The Skill installs the SDK, runs vercel flags add, declares the flag with identify for user targeting, and sets up Flags Explorer in the Vercel Toolbar. ## Quick Start Create a new boolean feature flag called 'new-dashboard' using the Flags SDK and wire it into my Next.js app.

Frequently Asked Questions about flags-sdk

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

FAQPage Schema
How do I create a feature flag with the Flags SDK?

Install the flags and @flags-sdk/vercel packages, run vercel flags add with a key and kind, then run vercel env pull to write FLAGS and FLAGS_SECRET. Declare the flag in a flags.ts file using flag() with vercelAdapter and call it from your page or component.

How do I use feature flags in Next.js without breaking static pages?

Use the precompute pattern: evaluate flags in middleware with precompute(), rewrite the request to a URL containing the encoded code, and read values in the page by calling the flag with that code. Combined with generatePermutations, all variants can be prerendered and served from CDN.

Does the Flags SDK support providers other than Vercel?

Yes, adapters exist for Statsig, LaunchDarkly, PostHog, GrowthBook, Hypertune, Flagsmith, Reflag, OpenFeature, Split, and Optimizely. Each adapter replaces decide and origin on the flag declaration, and you can also write custom adapters.

Can I use the Flags SDK with SvelteKit?

Yes, the flags/sveltekit module provides flag(), createHandle for hooks.server.ts, precompute, and generatePermutations. Precompute uses a reroute hook plus middleware, and prerendering works through the entries function.

Why is my Vercel flag not evaluating locally?

The vercelAdapter requires the FLAGS and FLAGS_SECRET environment variables, which are written to .env.local by running vercel env pull. Also verify the project is linked by checking for a .vercel directory, and run vercel link if it is missing.

What is the difference between evaluate() and Promise.all for multiple flags?

evaluate() pre-reads headers, cookies, and overrides once for the whole batch and lets adapters resolve a group through a single bulkDecide call. Promise.all runs flags in parallel but evaluates each in isolation, making evaluate() faster for batches.