flags-sdk — for Claude Code flags-sdk, community, for Claude Code, ide skills, vercel flags, decide, origin, pnpm-lock.yaml, package-lock.json, yarn.lock

v1.0.0

このスキルについて

適した場面: Ideal for AI agents that need docs: https://flags-sdk.dev. ローカライズされた概要: # Flags SDK The Flags SDK (flags npm package) is a feature flags toolkit for Next.js and SvelteKit. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

機能

Docs: https://flags-sdk.dev
Repo: https://github.com/vercel/flags
Each flag is declared as a function. No string keys at call sites:
import { flag } from 'flags/next';
export const exampleFlag = flag({

# Core Topics

raiden076 raiden076
[2]
[2]
Updated: 4/9/2026

Killer-Skills Review

Decision support comes first. Repository text comes second.

Reference-Only Page Review Score: 8/11

This page remains useful for operators, but Killer-Skills treats it as reference material instead of a primary organic landing page.

Original recommendation layer Concrete use-case guidance Explicit limitations and caution
Review Score
8/11
Quality Score
49
Canonical Locale
en
Detected Body Locale
en

適した場面: Ideal for AI agents that need docs: https://flags-sdk.dev. ローカライズされた概要: # Flags SDK The Flags SDK (flags npm package) is a feature flags toolkit for Next.js and SvelteKit. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

このスキルを使用する理由

推奨ポイント: flags-sdk helps agents docs: https://flags-sdk.dev. Flags SDK The Flags SDK (flags npm package) is a feature flags toolkit for Next.js and SvelteKit. This AI agent skill supports Claude Code, Cursor, and

おすすめ

適した場面: Ideal for AI agents that need docs: https://flags-sdk.dev.

実現可能なユースケース for flags-sdk

ユースケース: Applying Docs: https://flags-sdk.dev
ユースケース: Applying Repo: https://github.com/vercel/flags
ユースケース: Applying Each flag is declared as a function. No string keys at call sites:

! セキュリティと制限

  • 制約事項: Do not leave CLI steps as "next steps" for the user — execute them yourself
  • 制約事項: Prerequisite : The vercel flags commands require the Vercel CLI to be installed and authenticated
  • 制約事項: Requires repository-specific context from the skill documentation

Why this page is reference-only

  • - Current locale does not satisfy the locale-governance contract.
  • - The underlying skill quality score is below the review floor.

Source Boundary

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

After The Review

Decide The Next Action Before You Keep Reading Repository Material

Killer-Skills should not stop at opening repository instructions. It should help you decide whether to install this skill, when to cross-check against trusted collections, and when to move into workflow rollout.

Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is flags-sdk?

適した場面: Ideal for AI agents that need docs: https://flags-sdk.dev. ローカライズされた概要: # Flags SDK The Flags SDK (flags npm package) is a feature flags toolkit for Next.js and SvelteKit. This AI agent skill supports Claude Code, Cursor, and Windsurf workflows.

How do I install flags-sdk?

Run the command: npx killer-skills add raiden076/Prism/flags-sdk. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

What are the use cases for flags-sdk?

Key use cases include: ユースケース: Applying Docs: https://flags-sdk.dev, ユースケース: Applying Repo: https://github.com/vercel/flags, ユースケース: Applying Each flag is declared as a function. No string keys at call sites:.

Which IDEs are compatible with flags-sdk?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

Are there any limitations for flags-sdk?

制約事項: Do not leave CLI steps as "next steps" for the user — execute them yourself. 制約事項: Prerequisite : The vercel flags commands require the Vercel CLI to be installed and authenticated. 制約事項: Requires repository-specific context from the skill documentation.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add raiden076/Prism/flags-sdk. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use flags-sdk immediately in the current project.

! Reference-Only Mode

This page remains useful for installation and reference, but Killer-Skills no longer treats it as a primary indexable landing page. Read the review above before relying on the upstream repository instructions.

Upstream Repository Material

The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.

Upstream Source

flags-sdk

# Flags SDK The Flags SDK (flags npm package) is a feature flags toolkit for Next.js and SvelteKit. This AI agent skill supports Claude Code, Cursor, and

SKILL.md
Readonly
Upstream Repository Material
The section below is imported from the upstream repository and should be treated as secondary evidence. Use the Killer-Skills review above as the primary layer for fit, risk, and installation decisions.
Supporting Evidence

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.

Core concepts

Flags as code

Each flag is declared as a function. No string keys at call sites:

ts
1import { flag } from 'flags/next'; 2 3export const exampleFlag = flag({ 4 key: 'example-flag', 5 decide() { return false; }, 6}); 7 8const 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.

ts
1import { flag } from 'flags/next'; 2import { vercelAdapter } from '@flags-sdk/vercel'; 3 4export const exampleFlag = flag({ 5 key: 'example-flag', 6 adapter: vercelAdapter(), 7});

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

  1. Install packages (if not already in package.json):

    bash
    1pnpm i flags @flags-sdk/vercel
  2. 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.

  3. 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.

  4. Declare the flag in code: Add it to flags.ts (or create the file if it doesn't exist) using vercelAdapter():

    ts
    1import { flag } from 'flags/next'; 2import { vercelAdapter } from '@flags-sdk/vercel'; 3 4export const myFlag = flag({ 5 key: 'my-flag', 6 adapter: vercelAdapter(), 7});
  5. Use the flag: Call it in your page or component and conditionally render based on the result:

    tsx
    1import { myFlag } from '../flags'; 2 3export default async function Page() { 4 const enabled = await myFlag(); 5 return <div>{enabled ? 'Feature on' : 'Feature off'}</div>; 6}
  6. Set up the Vercel Toolbar (if not already present):

  7. 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

ts
1import { flag } from 'flags/next'; // or 'flags/sveltekit' 2 3export const showBanner = flag<boolean>({ 4 key: 'show-banner', 5 description: 'Show promotional banner', 6 defaultValue: false, 7 options: [ 8 { value: false, label: 'Hide' }, 9 { value: true, label: 'Show' }, 10 ], 11 decide() { return false; }, 12});

Flag with evaluation context

Use identify to establish who the request is for. The returned entities are passed to decide:

ts
1import { dedupe, flag } from 'flags/next'; 2import type { ReadonlyRequestCookies } from 'flags'; 3 4interface Entities { 5 user?: { id: string }; 6} 7 8const identify = dedupe( 9 ({ cookies }: { cookies: ReadonlyRequestCookies }): Entities => { 10 const userId = cookies.get('user-id')?.value; 11 return { user: userId ? { id: userId } : undefined }; 12 }, 13); 14 15export const dashboardFlag = flag<boolean, Entities>({ 16 key: 'new-dashboard', 17 identify, 18 decide({ entities }) { 19 if (!entities?.user) return false; 20 return ['user1', 'user2'].includes(entities.user.id); 21 }, 22});

Flag with another adapter

Adapters connect flags to third-party providers. Each adapter replaces decide and origin:

ts
1import { flag } from 'flags/next'; 2import { statsigAdapter } from '@flags-sdk/statsig'; 3 4export const myGate = flag({ 5 key: 'my_gate', 6 adapter: statsigAdapter.featureGate((gate) => gate.value), 7 identify, 8});

See references/providers.md for all supported adapters.

Key parameters

ParameterTypeDescription
keystringUnique flag identifier
decidefunctionResolves the flag value
defaultValueanyFallback if decide returns undefined or throws
descriptionstringShown in Flags Explorer
originstringURL to manage the flag in provider dashboard
options{ label?: string, value: any }[]Possible values, used for precompute + Flags Explorer
adapterAdapterProvider adapter implementing decide and origin
identifyfunctionReturns evaluation context (entities) for decide

Dedupe

Wrap shared functions (especially identify) in dedupe to run them once per request:

ts
1import { dedupe } from 'flags/next'; 2 3const identify = dedupe(({ cookies }) => { 4 return { user: { id: cookies.get('uid')?.value } }; 5});

Note: dedupe is not available in Pages Router.

Flags Explorer setup

Next.js (App Router)

ts
1// app/.well-known/vercel/flags/route.ts 2import { getProviderData, createFlagsDiscoveryEndpoint } from 'flags/next'; 3import * as flags from '../../../../flags'; 4 5export const GET = createFlagsDiscoveryEndpoint(async () => { 6 return getProviderData(flags); 7});

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

ts
1// src/hooks.server.ts 2import { createHandle } from 'flags/sveltekit'; 3import { FLAGS_SECRET } from '$env/static/private'; 4import * as flags from '$lib/flags'; 5 6export const handle = createHandle({ secret: FLAGS_SECRET, flags });

FLAGS_SECRET

Required for precompute and Flags Explorer. Must be 32 random bytes, base64-encoded:

sh
1node -e "console.log(crypto.randomBytes(32).toString('base64url'))"

Store as FLAGS_SECRET env var. On Vercel: vc env add FLAGS_SECRET then vc env pull.

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:

  1. Declare flags and group them in an array
  2. Call precompute(flagGroup) in middleware, get a code string
  3. Rewrite request to /${code}/original-path
  4. 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
encryptFlagValuesEncrypt resolved flag values
decryptFlagValuesDecrypt flag values
encryptFlagDefinitionsEncrypt flag definitions/metadata
decryptFlagDefinitionsDecrypt flag definitions
encryptOverridesEncrypt toolbar overrides
decryptOverridesDecrypt toolbar overrides

All use FLAGS_SECRET by default. Example:

tsx
1import { encryptFlagValues } from 'flags'; 2import { FlagValues } from 'flags/react'; 3 4async function ConfidentialFlags({ values }) { 5 const encrypted = await encryptFlagValues(values); 6 return <FlagValues values={encrypted} />; 7}

React components

tsx
1import { FlagValues, FlagDefinitions } from 'flags/react'; 2 3// Renders script tag with flag values for Flags Explorer 4const flagVals = { myFlag: true }; 5<FlagValues values={flagVals} /> 6 7// Renders script tag with flag definitions for Flags Explorer 8const flagDefs = { myFlag: { options: [...], description: '...' } }; 9<FlagDefinitions definitions={flagDefs} />

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

関連スキル

Looking for an alternative to flags-sdk or another community skill for your workflow? Explore these related open-source skills.

すべて表示

openclaw-release-maintainer

Logo of openclaw
openclaw

Your own personal AI assistant. Any OS. Any Platform. The lobster way. 🦞

333.8k
0
AI

widget-generator

Logo of f
f

Generate customizable widget plugins for the prompts.chat feed system

149.6k
0
AI

flags

Logo of vercel
vercel

The React Framework

138.4k
0
ブラウザ

pr-review

Logo of pytorch
pytorch

Tensors and Dynamic neural networks in Python with strong GPU acceleration

98.6k
0
開発者