Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

flags-sdk

БесплатноБез исполняемых скриптовНе проверен

Feature flags, A/B tests, and gradual rollouts in any app or framework. Use whenever the user is planning, adding, or changing a feature flag, toggle, kill…

motormetricsот motormetrics★ 22 звезды на GitHub

Об этом скилле

Set up and use the 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.

When the user asks to install, configure, or set up feature flags, follow Set up the SDK (including vercel env pull when .env.local is missing). When they ask to create or add a flag, follow Create a flag. A request is CLI-only when the user asks to inspect, create, or change a remote flag and the request involves no code; then follow CLI-only flag management. Inside an app repository, treat an ambiguous request as the full flow. Do not leave CLI steps as "next steps" for the user — execute them yourself.

Choose an approach

Check the project's stack before writing code. Vercel Flags works with three integrations (SDKs):

  • Next.js or SvelteKit: use the Flags SDK, as described in the rest of this skill. It adds automatic Flags Explorer integration and precompute for static pages.
  • Any other framework or a plain server (for example Express): use @vercel/flags-core directly. Follow Core client in other frameworks and skip the Toolbar and Flags Explorer steps in Set up the SDK.
  • Already on OpenFeature, or the user wants provider portability: register the Vercel Flags OpenFeature provider (Using OpenFeature with Vercel Flags).

When the project already uses another flag provider, keep it and connect it through its adapter (references/providers.md). The vercel flags CLI steps work the same for every integration.

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,
});

Version note: The SDK is published as flags (renamed from @vercel/flags; that old name still appears in changelog history). flags 4.2.0+ accepts the adapter factory by reference (adapter: vercelAdapter) and resolves it once per declaration. Older versions require calling it (adapter: vercelAdapter()). The called form still works on new versions, so prefer the shorthand unless you're targeting flags < 4.2.0.

Set up the SDK

One-time project setup. Run this when the Flags SDK is not installed yet, or when Toolbar / Flags Explorer / .env.local are missing. Skip any step that is already done.

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)
  • Is the project linked? → Skip vercel link in step 2
  • Does .env.local contain VERCEL_OIDC_TOKEN= (or a FLAGS= SDK key)? → Env vars already pulled, skip step 3
  • Is @vercel/toolbar in package.json? → Skip toolbar setup (step 4)
  • Does flags.ts (or lib/flags.ts, src/flags.ts) exist? → Skip creating it (step 5)
  • Does app/.well-known/vercel/flags/route.ts exist? → Flags Explorer already set up, skip step 6

Steps

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

    pnpm i flags @flags-sdk/vercel
    
  2. Link the project to Vercel (required for vercel env pull and local OIDC token refresh):

    Prerequisite: The Vercel CLI must be installed and authenticated. If it is not installed, run pnpm i -g vercel. For authentication or linking issues, follow the vercel-cli skill if it's already available. If it isn't, suggest the user install it with `npx skills add vercel/vercel@vercel-

Полный SKILL.md на GitHub

Установить flags-sdk в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/api.mdreferences/nextjs.mdreferences/providers.mdreferences/sveltekit.md

FAQ

Что делает скилл flags-sdk?

Feature flags, A/B tests, and gradual rollouts in any app or framework. Use whenever the user is planning, adding, or changing a feature flag, toggle, kill switch, experiment, or percentage rollout, or wants to gate or hide a feature for some users, even before a library or provider is chosen. Covers Vercel Flags, the Flags SDK (`flags`, `@flags-sdk/*`), `@vercel/flags-core`, OpenFeature, provider adapters such as Statsig, LaunchDarkly, and PostHog, Flags Explorer, and the `vercel flags` CLI.

Как установить скилл flags-sdk?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл flags-sdk запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить flags-sdk с