Flags Sdk
The Flags SDK ( flags npm package) is a feature flags toolkit for Next.js and SvelteKit. It turns each feature flag into a callable function, works with any flag provider via adapters, and keeps pa...
The Flags SDK ( flags npm package) is a feature flags toolkit for Next.js and SvelteKit. It turns each feature flag into a callable function, works with any flag provider via adapters, and keeps pages static using the precompute pattern. Vercel Flags is the first-party provider, letting you manage flags from the Vercel dashboard or the vercel flags CLI.
Install
Quick install
npx skills add https://github.com/vercel/flags/tree/HEAD/skills/flags-sdknpx skills add vercel/flags --skill flags-sdk --agent claude-codenpx skills add vercel/flags --skill flags-sdk --agent cursornpx skills add vercel/flags --skill flags-sdk --agent codexnpx skills add vercel/flags --skill flags-sdk --agent opencodenpx skills add vercel/flags --skill flags-sdk --agent github-copilotnpx skills add vercel/flags --skill flags-sdk --agent windsurfMore install options
Shorthand — useful for multi-skill repos:
npx skills add vercel/flags --skill flags-sdkManual — clone the repo and drop the folder into your agent's skills directory:
git clone https://github.com/vercel/flags.gitcp -r flags/skills/flags-sdk ~/.claude/skills/flags-sdk
The Flags SDK ( flags npm package) is a feature flags toolkit for Next.js and SvelteKit. It turns each feature flag into a callable function, works with any flag provider via adapters, and keeps pages static using the precompute pattern. Vercel Flags is the first-party provider, letting you manage flags from the Vercel dashboard or the vercel flags CLI.
flags-sdkby vercel
The Flags SDK ( flags npm package) is a feature flags toolkit for Next.js and SvelteKit. It turns each feature flag into a callable function, works with any flag provider via adapters, and keeps pages static using the precompute pattern. Vercel Flags is the first-party provider, letting you manage flags from the Vercel dashboard or the vercel flags CLI.npx skills add https://github.com/vercel/flags --skill flags-sdkDownload ZIPGitHub
Flags SDK
The Flags SDK (flags npm package) is a feature flags toolkit for Next.js and SvelteKit. It turns each feature flag into a callable function, works with any flag provider via adapters, and keeps pages static using the precompute pattern. Vercel Flags is the first-party provider, letting you manage flags from the Vercel dashboard or the vercel flags CLI.
- Docs: https://flags-sdk.dev
- Repo: https://github.com/vercel/flags
Core concepts
Flags as code
Each flag is declared as a function. No string keys at call sites:
`import { flag } from 'flags/next';
export const exampleFlag = flag({
key: 'example-flag',
decide() { return false; },
});
const value = await exampleFlag();
`
Server-side evaluation
Flags evaluate server-side to avoid layout shift, keep pages static, and maintain confidentiality. Combine routing middleware with the precompute pattern to serve static variants from CDN.
Adapter pattern
Adapters replace decide and origin on a flag declaration, connecting your flags to a provider. Vercel Flags (@flags-sdk/vercel) is the first-party adapter. Third-party adapters are available for Statsig, LaunchDarkly, PostHog, and others.
`import { flag } from 'flags/next';
import { vercelAdapter } from '@flags-sdk/vercel';
export const exampleFlag = flag({
key: 'example-flag',
adapter: vercelAdapter(),
});
`
Agent workflow: Creating a new flag
When a user asks you to create or add a feature flag, follow these steps in order. Do not leave CLI steps as "next steps" for the user — execute them yourself.
Before you start
Check the project state to adapt commands and decide which steps you can skip:
- Which lockfile is present (
pnpm-lock.yaml,package-lock.json,yarn.lock,bun.lockb)? → Adapt all package manager commands accordingly (pnpm add,npm install,yarn add,bun add).
- Is
flagsinpackage.json? → Skip install (step 1)
- Does
.vercel/directory exist? → Project is linked, skipvercel linkin step 2
- Does
.env.localcontainFLAGS=? → Env vars already pulled, skip step 3
- Does
flags.ts(orlib/flags.ts,src/flags.ts) exist? → Add to it rather than creating from scratch (step 4)
- Is
@vercel/toolbarinpackage.json? → Skip toolbar setup (step 6)
- Does
app/.well-known/vercel/flags/route.tsexist? → Flags Explorer already set up, skip step 7
Steps
*
Install packages (if not already in package.json):
`pnpm i flags @flags-sdk/vercel
`
*
Register the flag with Vercel: Run vercel flags add <flag-key> --kind boolean --description "<description>".
Prerequisite: The vercel flags commands require the Vercel CLI to be installed and authenticated. If the Vercel CLI is not installed, run pnpm i -g vercel. For authentication or linking issues, read and follow the vercel-cli skill. If it's not installed, run npx skills add https://github.com/vercel/vercel --skill vercel-cli.
Before running vercel flags add, verify the project is linked to Vercel. Check for a .vercel directory in the project root. If it doesn't exist, run vercel link first.
*
Pull environment variables: Run vercel env pull to write FLAGS and FLAGS_SECRET to .env.local. Without these environment variables, vercelAdapter() will not be able to evaluate flags. This step is mandatory after creating a flag.
*
Declare the flag in code: Add it to flags.ts (or create the file if it doesn't exist) using vercelAdapter():
`import { flag } from 'flags/next';
import { vercelAdapter } from '@flags-sdk/vercel';
export const myFlag = flag({
key: 'my-flag',
adapter: vercelAdapter(),
});
`
*
Use the flag: Call it in your page or component and conditionally render based on the result:
`import { myFlag } from '../flags';
export default async function Page() {
const enabled = await myFlag();
return <div>{enabled ? 'Feature on' : 'Feature off'}</div>;
}
`
*
Set up the Vercel Toolbar (if not already present):
- Run
pnpm i @vercel/toolbar
- Wrap
next.config.tswith the toolbar plugin
- Render
<VercelToolbar />in the root layout
*
Set up Flags Explorer (if not already present): Create app/.well-known/vercel/flags/route.ts — see the Flags Explorer setup section below.
Vercel Flags
Vercel Flags is Vercel's feature flags platform. You create and manage flags from the Vercel dashboard or the vercel flags CLI, then connect them to your code with the @flags-sdk/vercel adapter. When you create a flag in Vercel, the FLAGS and FLAGS_SECRET environment variables are configured automatically.
To create a flag end-to-end, follow the Agent workflow above.
For the full Vercel provider reference — user targeting, vercel flags CLI subcommands, custom adapter configuration, and Flags Explorer setup — see references/providers.md.
Declaring flags
When using Vercel Flags, declare flags with vercelAdapter() as shown in the Agent workflow. For other providers, see references/providers.md. Below are the general flag() patterns.
Basic flag
`import { flag } from 'flags/next'; // or 'flags/sveltekit'
export const showBanner = flag<boolean>({
key: 'show-banner',
description: 'Show promotional banner',
defaultValue: false,
options: [
{ value: false, label: 'Hide' },
{ value: true, label: 'Show' },
],
decide() { return false; },
});
`
Flag with evaluation context
Use identify to establish who the request is for. The returned entities are passed to decide:
`import { dedupe, flag } from 'flags/next';
import type { ReadonlyRequestCookies } from 'flags';
interface Entities {
user?: { id: string };
}
const identify = dedupe(
({ cookies }: { cookies: ReadonlyRequestCookies }): Entities => {
const userId = cookies.get('user-id')?.value;
return { user: userId ? { id: userId } : undefined };
},
);
export const dashboardFlag = flag<boolean, Entities>({
key: 'new-dashboard',
identify,
decide({ entities }) {
if (!entities?.user) return false;
return ['user1', 'user2'].includes(entities.user.id);
},
});
`
Flag with another adapter
Adapters connect flags to third-party providers. Each adapter replaces decide and origin:
`import { flag } from 'flags/next';
import { statsigAdapter } from '@flags-sdk/statsig';
export const myGate = flag({
key: 'my_gate',
adapter: statsigAdapter.featureGate((gate) => gate.value),
identify,
});
`
See references/providers.md for all supported adapters.
Key parameters
ParameterTypeDescriptionkeystringUnique flag identifierdecidefunctionResolves the flag valuedefaultValueanyFallback if decide returns undefined or throwsdescriptionstringShown in Flags ExploreroriginstringURL to manage the flag in provider dashboardoptions{ label?: string, value: any }[]Possible values, used for precompute + Flags ExploreradapterAdapterProvider adapter implementing decide and originidentifyfunctionReturns evaluation context (entities) for decide
Dedupe
Wrap shared functions (especially identify) in dedupe to run them once per request:
`import { dedupe } from 'flags/next';
const identify = dedupe(({ cookies }) => {
return { user: { id: cookies.get('uid')?.value } };
});
`
Note: dedupe is not available in Pages Router.
Flags Explorer setup
Next.js (App Router)
`// app/.well-known/vercel/flags/route.ts
import { createFlagsDiscoveryEndpoint } from 'flags/next';
import { getProviderData } from '@flags-sdk/vercel';
import * as flags from '../../../../flags';
export const GET = createFlagsDiscoveryEndpoint(async () => {
return getProviderData(flags);
});
`
With external provider data
When using a third-party provider alongside Vercel Flags, combine their data with mergeProviderData. Each provider adapter exports its own getProviderData — see the provider-specific examples in references/providers.md.
SvelteKit
`// src/hooks.server.ts
import { createHandle } from 'flags/sveltekit';
import { FLAGS_SECRET } from '$env/static/private';
import * as flags from '$lib/flags';
export const handle = createHandle({ secret: FLAGS_SECRET, flags });
`
FLAGS_SECRET
Required for precompute and Flags Explorer. Must be 32 random bytes, base64-encoded:
`node -e "console.log(crypto.randomBytes(32).toString('base64url'))"
`
Use a separate FLAGS_SECRET value for each environment (Development, Preview, Production), and mark the Preview and Production values as Sensitive. Run the generator once per environment to produce distinct values, then store each on Vercel:
`vercel env add FLAGS_SECRET production --sensitive --value <production-secret>
vercel env add FLAGS_SECRET preview --sensitive --value <preview-secret>
vercel env add FLAGS_SECRET development --value <development-secret>
`
Then run vc env pull to sync to local.
Precompute pattern
Use precompute to keep pages static while using feature flags. Middleware evaluates flags and encodes results into the URL via rewrite. The page reads precomputed values instead of re-evaluating.
High-level flow:
- Declare flags and group them in an array
- Call
precompute(flagGroup)in middleware, get acodestring
- Rewrite request to
/${code}/original-path
- Page reads flag values from
code:await myFlag(code, flagGroup)
For full implementation details, see framework-specific references:
- Next.js: See references/nextjs.md — covers proxy middleware, precompute setup, ISR, generatePermutations, multiple groups
- SvelteKit: See references/sveltekit.md — covers reroute hook, middleware, precompute setup, ISR, prerendering
Custom adapters
Create an adapter factory that returns an object with origin and decide. For the full pattern (including default adapter and singleton client examples), see references/providers.md.
Encryption functions
For keeping flag data confidential in the browser (used by Flags Explorer):
FunctionPurposeencryptFlagValuesEncrypt resolved flag valuesdecryptFlagValuesDecrypt flag valuesencryptFlagDefinitionsEncrypt flag definitions/metadatadecryptFlagDefinitionsDecrypt flag definitionsencryptOverridesEncrypt toolbar overridesdecryptOverridesDecrypt toolbar overrides
All use FLAGS_SECRET by default. Example:
`import { encryptFlagValues } from 'flags';
import { FlagValues } from 'flags/react';
async function ConfidentialFlags({ values }) {
const encrypted = await encryptFlagValues(values);
return <FlagValues values={encrypted} />;
}
`
React components
`import { FlagValues, FlagDefinitions } from 'flags/react';
// Renders script tag with flag values for Flags Explorer
<FlagValues values={{ myFlag: true }} />
// Renders script tag with flag definitions for Flags Explorer
<FlagDefinitions definitions={{ myFlag: { options: [...], description: '...' } }} />
`
References
Detailed framework and provider guides are in separate files to keep context lean:
- references/nextjs.md: Next.js quickstart, toolbar, App Router, Pages Router, middleware/proxy, precompute, dedupe, dashboard pages, marketing pages, suspense fallbacks
- references/sveltekit.md: SvelteKit quickstart, toolbar, hooks setup, precompute with reroute + middleware, dashboard pages, marketing pages
- references/providers.md: All provider adapters — Vercel, Edge Config, Statsig, LaunchDarkly, PostHog, GrowthBook, Hypertune, Flagsmith, Reflag, Split, Optimizely, OpenFeature, and custom adapters
- references/api.md: Full API reference for
flags,flags/react,flags/next, andflags/sveltekit
More skills from vercel
agent-friendly-apisby vercelCompanion skill for the Agent-Friendly APIs course on Vercel Academy. Build a feedback API, make it agent-friendly with structured documentation, then create a Claude Code skill that generates the docs automatically.filesystem-agentsby vercelYou are a knowledgeable teaching assistant for the Building Filesystem Agents course on Vercel Academy. You help students build agents that navigate filesystems with bash to answer questions about structured data.add-provider-packageby vercelGuide for adding new AI provider packages to the AI SDK. Use when creating a new @ai-sdk/<provider> package to integrate an AI service into the SDK.csvby vercelAnalyze and transform CSV data using bash toolsaiby vercelPythonai module — models, agents, hooks, middleware, MCP, structured outputcron-jobsby vercelVercel Cron Jobs configuration and best practices. Use when adding, editing, or debugging scheduled tasks in vercel.json.frontend-designby vercelCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts,…vercel-react-best-practicesby vercelReact and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js…
---
Source: https://github.com/vercel/flags/tree/HEAD/skills/flags-sdk
Author: vercel
Discovered via: mcpservers.org
SKILL.md source
---
name: flags-sdk
description: The Flags SDK ( flags npm package) is a feature flags toolkit for Next.js and SvelteKit. It turns each feature flag into a callable function, works with any flag provider via adapters, and keeps pa...
---
# flags-sdk
The Flags SDK ( flags npm package) is a feature flags toolkit for Next.js and SvelteKit. It turns each feature flag into a callable function, works with any flag provider via adapters, and keeps pages static using the precompute pattern. Vercel Flags is the first-party provider, letting you manage flags from the Vercel dashboard or the vercel flags CLI.
# flags-sdkby vercel
The Flags SDK ( flags npm package) is a feature flags toolkit for Next.js and SvelteKit. It turns each feature flag into a callable function, works with any flag provider via adapters, and keeps pages static using the precompute pattern. Vercel Flags is the first-party provider, letting you manage flags from the Vercel dashboard or the vercel flags CLI.
`npx skills add https://github.com/vercel/flags --skill flags-sdk`Download ZIPGitHub
## Flags SDK
The Flags SDK (`flags` npm package) is a feature flags toolkit for Next.js and SvelteKit. It turns each feature flag into a callable function, works with any flag provider via adapters, and keeps pages static using the precompute pattern. Vercel Flags is the first-party provider, letting you manage flags from the Vercel dashboard or the `vercel flags` CLI.
* Docs: https://flags-sdk.dev
* Repo: https://github.com/vercel/flags
## Core concepts
### Flags as code
Each flag is declared as a function. No string keys at call sites:
```
`import { flag } from 'flags/next';
export const exampleFlag = flag({
key: 'example-flag',
decide() { return false; },
});
const value = await exampleFlag();
`
```
### Server-side evaluation
Flags evaluate server-side to avoid layout shift, keep pages static, and maintain confidentiality. Combine routing middleware with the precompute pattern to serve static variants from CDN.
### Adapter pattern
Adapters replace `decide` and `origin` on a flag declaration, connecting your flags to a provider. Vercel Flags (`@flags-sdk/vercel`) is the first-party adapter. Third-party adapters are available for Statsig, LaunchDarkly, PostHog, and others.
```
`import { flag } from 'flags/next';
import { vercelAdapter } from '@flags-sdk/vercel';
export const exampleFlag = flag({
key: 'example-flag',
adapter: vercelAdapter(),
});
`
```
## Agent workflow: Creating a new flag
When a user asks you to create or add a feature flag, follow these steps in order. Do not leave CLI steps as "next steps" for the user — execute them yourself.
### Before you start
Check the project state to adapt commands and decide which steps you can skip:
* Which lockfile is present (`pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`, `bun.lockb`)? → Adapt all package manager commands accordingly (`pnpm add`, `npm install`, `yarn add`, `bun add`).
* Is `flags` in `package.json`? → Skip install (step 1)
* Does `.vercel/` directory exist? → Project is linked, skip `vercel link` in step 2
* Does `.env.local` contain `FLAGS=`? → Env vars already pulled, skip step 3
* Does `flags.ts` (or `lib/flags.ts`, `src/flags.ts`) exist? → Add to it rather than creating from scratch (step 4)
* Is `@vercel/toolbar` in `package.json`? → Skip toolbar setup (step 6)
* Does `app/.well-known/vercel/flags/route.ts` exist? → Flags Explorer already set up, skip step 7
### Steps
*
Install packages (if not already in `package.json`):
```
`pnpm i flags @flags-sdk/vercel
`
```
*
Register the flag with Vercel: Run `vercel flags add <flag-key> --kind boolean --description "<description>"`.
Prerequisite: The `vercel flags` commands require the Vercel CLI to be installed and authenticated. If the Vercel CLI is not installed, run `pnpm i -g vercel`. For authentication or linking issues, read and follow the `vercel-cli` skill. If it's not installed, run `npx skills add https://github.com/vercel/vercel --skill vercel-cli`.
Before running `vercel flags add`, verify the project is linked to Vercel. Check for a `.vercel` directory in the project root. If it doesn't exist, run `vercel link` first.
*
Pull environment variables: Run `vercel env pull` to write `FLAGS` and `FLAGS_SECRET` to `.env.local`. Without these environment variables, `vercelAdapter()` will not be able to evaluate flags. This step is mandatory after creating a flag.
*
Declare the flag in code: Add it to `flags.ts` (or create the file if it doesn't exist) using `vercelAdapter()`:
```
`import { flag } from 'flags/next';
import { vercelAdapter } from '@flags-sdk/vercel';
export const myFlag = flag({
key: 'my-flag',
adapter: vercelAdapter(),
});
`
```
*
Use the flag: Call it in your page or component and conditionally render based on the result:
```
`import { myFlag } from '../flags';
export default async function Page() {
const enabled = await myFlag();
return <div>{enabled ? 'Feature on' : 'Feature off'}</div>;
}
`
```
*
Set up the Vercel Toolbar (if not already present):
* Run `pnpm i @vercel/toolbar`
* Wrap `next.config.ts` with the toolbar plugin
* Render `<VercelToolbar />` in the root layout
See references/nextjs.md — Toolbar Setup for the full code.
*
Set up Flags Explorer (if not already present): Create `app/.well-known/vercel/flags/route.ts` — see the Flags Explorer setup section below.
## Vercel Flags
Vercel Flags is Vercel's feature flags platform. You create and manage flags from the Vercel dashboard or the `vercel flags` CLI, then connect them to your code with the `@flags-sdk/vercel` adapter. When you create a flag in Vercel, the `FLAGS` and `FLAGS_SECRET` environment variables are configured automatically.
To create a flag end-to-end, follow the Agent workflow above.
For the full Vercel provider reference — user targeting, `vercel flags` CLI subcommands, custom adapter configuration, and Flags Explorer setup — see references/providers.md.
## Declaring flags
When using Vercel Flags, declare flags with `vercelAdapter()` as shown in the Agent workflow. For other providers, see references/providers.md. Below are the general `flag()` patterns.
### Basic flag
```
`import { flag } from 'flags/next'; // or 'flags/sveltekit'
export const showBanner = flag<boolean>({
key: 'show-banner',
description: 'Show promotional banner',
defaultValue: false,
options: [
{ value: false, label: 'Hide' },
{ value: true, label: 'Show' },
],
decide() { return false; },
});
`
```
### Flag with evaluation context
Use `identify` to establish who the request is for. The returned entities are passed to `decide`:
```
`import { dedupe, flag } from 'flags/next';
import type { ReadonlyRequestCookies } from 'flags';
interface Entities {
user?: { id: string };
}
const identify = dedupe(
({ cookies }: { cookies: ReadonlyRequestCookies }): Entities => {
const userId = cookies.get('user-id')?.value;
return { user: userId ? { id: userId } : undefined };
},
);
export const dashboardFlag = flag<boolean, Entities>({
key: 'new-dashboard',
identify,
decide({ entities }) {
if (!entities?.user) return false;
return ['user1', 'user2'].includes(entities.user.id);
},
});
`
```
### Flag with another adapter
Adapters connect flags to third-party providers. Each adapter replaces `decide` and `origin`:
```
`import { flag } from 'flags/next';
import { statsigAdapter } from '@flags-sdk/statsig';
export const myGate = flag({
key: 'my_gate',
adapter: statsigAdapter.featureGate((gate) => gate.value),
identify,
});
`
```
See references/providers.md for all supported adapters.
### Key parameters
ParameterTypeDescription`key``string`Unique flag identifier`decide``function`Resolves the flag value`defaultValue``any`Fallback if `decide` returns undefined or throws`description``string`Shown in Flags Explorer`origin``string`URL to manage the flag in provider dashboard`options``{ label?: string, value: any }[]`Possible values, used for precompute + Flags Explorer`adapter``Adapter`Provider adapter implementing `decide` and `origin``identify``function`Returns evaluation context (entities) for `decide`
## Dedupe
Wrap shared functions (especially `identify`) in `dedupe` to run them once per request:
```
`import { dedupe } from 'flags/next';
const identify = dedupe(({ cookies }) => {
return { user: { id: cookies.get('uid')?.value } };
});
`
```
Note: `dedupe` is not available in Pages Router.
## Flags Explorer setup
### Next.js (App Router)
```
`// app/.well-known/vercel/flags/route.ts
import { createFlagsDiscoveryEndpoint } from 'flags/next';
import { getProviderData } from '@flags-sdk/vercel';
import * as flags from '../../../../flags';
export const GET = createFlagsDiscoveryEndpoint(async () => {
return getProviderData(flags);
});
`
```
### With external provider data
When using a third-party provider alongside Vercel Flags, combine their data with `mergeProviderData`. Each provider adapter exports its own `getProviderData` — see the provider-specific examples in references/providers.md.
### SvelteKit
```
`// src/hooks.server.ts
import { createHandle } from 'flags/sveltekit';
import { FLAGS_SECRET } from '$env/static/private';
import * as flags from '$lib/flags';
export const handle = createHandle({ secret: FLAGS_SECRET, flags });
`
```
## FLAGS_SECRET
Required for precompute and Flags Explorer. Must be 32 random bytes, base64-encoded:
```
`node -e "console.log(crypto.randomBytes(32).toString('base64url'))"
`
```
Use a separate `FLAGS_SECRET` value for each environment (Development, Preview, Production), and mark the Preview and Production values as Sensitive. Run the generator once per environment to produce distinct values, then store each on Vercel:
```
`vercel env add FLAGS_SECRET production --sensitive --value <production-secret>
vercel env add FLAGS_SECRET preview --sensitive --value <preview-secret>
vercel env add FLAGS_SECRET development --value <development-secret>
`
```
Then run `vc env pull` to sync to local.
## Precompute pattern
Use precompute to keep pages static while using feature flags. Middleware evaluates flags and encodes results into the URL via rewrite. The page reads precomputed values instead of re-evaluating.
High-level flow:
* Declare flags and group them in an array
* Call `precompute(flagGroup)` in middleware, get a `code` string
* Rewrite request to `/${code}/original-path`
* Page reads flag values from `code`: `await myFlag(code, flagGroup)`
For full implementation details, see framework-specific references:
* Next.js: See references/nextjs.md — covers proxy middleware, precompute setup, ISR, generatePermutations, multiple groups
* SvelteKit: See references/sveltekit.md — covers reroute hook, middleware, precompute setup, ISR, prerendering
## Custom adapters
Create an adapter factory that returns an object with `origin` and `decide`. For the full pattern (including default adapter and singleton client examples), see references/providers.md.
## Encryption functions
For keeping flag data confidential in the browser (used by Flags Explorer):
FunctionPurpose`encryptFlagValues`Encrypt resolved flag values`decryptFlagValues`Decrypt flag values`encryptFlagDefinitions`Encrypt flag definitions/metadata`decryptFlagDefinitions`Decrypt flag definitions`encryptOverrides`Encrypt toolbar overrides`decryptOverrides`Decrypt toolbar overrides
All use `FLAGS_SECRET` by default. Example:
```
`import { encryptFlagValues } from 'flags';
import { FlagValues } from 'flags/react';
async function ConfidentialFlags({ values }) {
const encrypted = await encryptFlagValues(values);
return <FlagValues values={encrypted} />;
}
`
```
## React components
```
`import { FlagValues, FlagDefinitions } from 'flags/react';
// Renders script tag with flag values for Flags Explorer
<FlagValues values={{ myFlag: true }} />
// Renders script tag with flag definitions for Flags Explorer
<FlagDefinitions definitions={{ myFlag: { options: [...], description: '...' } }} />
`
```
## References
Detailed framework and provider guides are in separate files to keep context lean:
* references/nextjs.md: Next.js quickstart, toolbar, App Router, Pages Router, middleware/proxy, precompute, dedupe, dashboard pages, marketing pages, suspense fallbacks
* references/sveltekit.md: SvelteKit quickstart, toolbar, hooks setup, precompute with reroute + middleware, dashboard pages, marketing pages
* references/providers.md: All provider adapters — Vercel, Edge Config, Statsig, LaunchDarkly, PostHog, GrowthBook, Hypertune, Flagsmith, Reflag, Split, Optimizely, OpenFeature, and custom adapters
* references/api.md: Full API reference for `flags`, `flags/react`, `flags/next`, and `flags/sveltekit`
## More skills from vercel
agent-friendly-apisby vercelCompanion skill for the Agent-Friendly APIs course on Vercel Academy. Build a feedback API, make it agent-friendly with structured documentation, then create a Claude Code skill that generates the docs automatically.filesystem-agentsby vercelYou are a knowledgeable teaching assistant for the Building Filesystem Agents course on Vercel Academy. You help students build agents that navigate filesystems with bash to answer questions about structured data.add-provider-packageby vercelGuide for adding new AI provider packages to the AI SDK. Use when creating a new @ai-sdk/<provider> package to integrate an AI service into the SDK.csvby vercelAnalyze and transform CSV data using bash toolsaiby vercelPython `ai` module — models, agents, hooks, middleware, MCP, structured outputcron-jobsby vercelVercel Cron Jobs configuration and best practices. Use when adding, editing, or debugging scheduled tasks in vercel.json.frontend-designby vercelCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts,…vercel-react-best-practicesby vercelReact and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js…
---
**Source**: https://github.com/vercel/flags/tree/HEAD/skills/flags-sdk
**Author**: vercel
**Discovered via**: mcpservers.org
Related skills 6
find-skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
appinsights-instrumentation
Guidance for instrumenting webapps with Azure Application Insights. Provides telemetry patterns, SDK setup, and configuration references. WHEN: how to instrument app, App Insights SDK, telemetry patterns, what is App Insights, Application Insights guidance, instrumentation examples, APM best practices.
azure-messaging
Troubleshoot and resolve issues with Azure Messaging SDKs for Event Hubs and Service Bus. Covers connection failures, authentication errors, message processing issues, and SDK configuration problems. WHEN: event hub SDK error, service bus SDK issue, messaging connection failure, AMQP error, event processor host issue, message lock lost, message lock expired, lock renewal, lock renewal batch, send timeout, receiver disconnected, SDK troubleshooting, azure messaging SDK, event hub consumer, ser...
azure-hosted-copilot-sdk
Build, deploy, and modify GitHub Copilot SDK apps on Azure. MANDATORY when codebase contains @github/copilot-sdk or CopilotClient in package.json. PREFER OVER azure-prepare when copilot-sdk markers detected. WHEN: copilot SDK, @github/copilot-sdk, copilot-powered app, build copilot app, prepare copilot app, add feature to copilot app, modify copilot app, BYOM, bring your own model, CopilotClient, createSession, sendAndWait, azd init copilot. DO NOT USE FOR: deploying already-prepared copilot-...
lark-event
Lark/Feishu real-time event listening / subscribing / consuming: stream events as NDJSON via `lark-cli event consume <EventKey>` (covers IM message receive, reactions, chat member changes, etc.). Use for Lark bots, real-time message processing, long-running subscribers, streaming webhook/push handlers. Supports `--max-events` / `--timeout` bounded runs and a stderr ready-marker contract — designed for AI agents running as subprocesses.
xget
Use when tasks involve Xget URL rewriting, registry/package/container/API acceleration, integrating Xget into Git, download tools, package managers, container builds, AI SDKs, CI/CD, deployment, self-hosting, or adapting commands and config from the live README `Use Cases` section into files, environments, shells, or base URLs.