# Flags SDK

> Flags SDK is an open-source agent skill for developer tools. Guides an agent to add and configure feature flags in Next.js or SvelteKit with the Flags. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/ScaleDockHQ/better-supabase/tree/main/.agents/skills/flags-sdk/upstream
- **Repository:** https://github.com/scaledockhq/better-supabase
- **GitHub stars:** 5
- **License:** MIT
- **Skill name:** flags-sdk
- **Collection:** https://github.com/ScaleDockHQ/better-supabase
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-02

## About

This skill walks the agent through installing the Flags SDK and its Vercel adapter, linking a project and pulling environment variables, and setting up the Vercel Toolbar and Flags Explorer discovery route. It also covers declaring flags as typed functions, adding flags that already exist on Vercel, and reading several flags at once with a batched evaluate call instead of sequential awaits.

The instructions cover server-side evaluation, the precompute pattern for keeping pages static behind routing middleware, identify and dedupe helpers for targeting context, and encryption helpers used by Flags Explorer. Other provider adapters such as Statsig, LaunchDarkly and PostHog are documented in reference files, along with custom adapter patterns.

The workflow expects a Next.js or SvelteKit project, a package manager, and the Vercel CLI for linking and environment steps. Changing what a flag serves happens outside the code, in the Vercel dashboard or the vercel flags CLI, which the skill hands off to a companion skill.

## When your agent uses it

> Implement feature flags in Next.js or SvelteKit code with the Flags SDK (`flags` npm package). Use when installing or configuring the SDK, declaring flags with `flag()`, setting up Project Connections, wiring a provider adapter (`@flags-sdk/vercel`, Statsig, LaunchDarkly, PostHog, GrowthBook, Global Config, OpenFeature, Split, Flagsmith, Reflag, Optimizely, or custom), using `identify`, `dedupe`, or `evaluate`, keeping pages static with precompute, setting up Flags Explorer and the Vercel Toolbar, or encrypting flag values. Triggers: `flags/next`, `flags/sveltekit`, `flags/react`, `@flags-sdk/*`, `vercelAdapter`, precompute. For planning a flag, for Vercel Flags rollouts, experiments, and the `vercel flags` CLI, or for other frameworks, use the `vercel-flags` skill.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/ScaleDockHQ/better-supabase/tree/HEAD/.agents/skills/flags-sdk/upstream)
- [License: MIT](https://github.com/ScaleDockHQ/better-supabase/tree/HEAD/.agents/skills/flags-sdk/upstream)

## Features

- **Flag declaration:** Shows how to declare typed flags as callable functions with keys, defaults and options.
- **Vercel adapter setup:** Covers installing the adapter, linking the project and pulling local credentials.
- **Flags Explorer wiring:** Creates the discovery endpoint and Toolbar so flags can be overridden during development.
- **Precompute for static pages:** Explains encoding flag results into rewritten URLs so pages stay statically cached.
- **Batched flag evaluation:** Recommends a single evaluate call for multiple flags over sequential or parallel awaits.
- **Targeting with identify:** Shows how to resolve request entities with dedupe for per-user flag decisions.

## Good for

- Add a feature flag to a Next.js page and render a variant based on it
- Set up the Flags SDK and Vercel Toolbar in a SvelteKit project
- Wire an existing Vercel-managed flag into the code with the right default value
- Keep a marketing page static while still testing two layout variants
- Switch a flag declaration from LaunchDarkly or PostHog to another provider adapter

## Install

### Claude Code

This skill ships in the `better-supabase` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add ScaleDockHQ/better-supabase
/plugin install better-supabase@better-supabase
```

Or copy only this skill to `~/.claude/skills/flags-sdk`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/flags-sdk &&
cp -R "$tmp/.agents/skills/flags-sdk/upstream" ~/.claude/skills/flags-sdk &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/flags-sdk` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/flags-sdk` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/flags-sdk &&
cp -R "$tmp/.agents/skills/flags-sdk/upstream" ~/.agents/skills/flags-sdk &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/flags-sdk` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/flags-sdk` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/flags-sdk &&
cp -R "$tmp/.agents/skills/flags-sdk/upstream" ~/.cursor/skills/flags-sdk &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/flags-sdk` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/ScaleDockHQ/better-supabase.git --path .agents/skills/flags-sdk/upstream
```

Or copy the folder to `~/.gemini/skills/flags-sdk` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/flags-sdk`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/flags-sdk &&
cp -R "$tmp/.agents/skills/flags-sdk/upstream" ~/.copilot/skills/flags-sdk &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/flags-sdk` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/ScaleDockHQ/better-supabase.git
```

Then copy `better-supabase/.agents/skills/flags-sdk/upstream` into your agent's skills folder as `flags-sdk`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Which frameworks does the Flags SDK support?

The skill covers Next.js and SvelteKit. For other frameworks it points to the @vercel/flags-core package instead.

### Does Flags SDK change flag rollouts or targeting?

No. Changing what a flag serves happens in the dashboard or with the vercel flags CLI, which belongs to the separate vercel-flags skill.

### What does the setup need before Flags SDK runs?

A linked Vercel project, the Vercel CLI installed and authenticated, and the flags and @flags-sdk/vercel packages installed through the project's package manager.

### Which provider adapters are documented?

Vercel, Global Config, Statsig, LaunchDarkly, PostHog, GrowthBook, Flagsmith, Reflag, Split, Optimizely and OpenFeature, plus custom adapters.

### How do I install Flags SDK in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/flags-sdk to use it in all your projects, or to .claude/skills/flags-sdk in one project. Or install the better-supabase plugin, which includes it: /plugin marketplace add ScaleDockHQ/better-supabase, then /plugin install better-supabase@better-supabase.

### Does Flags SDK run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Flags SDK?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Flags SDK?

The closest alternatives to Flags SDK are Flagship, Env vars, Vercel optimize, React frontend and Antfu.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Flagship](https://ai-powered.com/skills/flagship): Flagship is an open-source agent skill for developer tools.
- [Env vars](https://ai-powered.com/skills/env-vars): Env vars is an open-source agent skill for cloud and infrastructure.
- [Vercel optimize](https://ai-powered.com/skills/vercel-optimize): Vercel optimize is an open-source agent skill for cloud and infrastructure.
- [React frontend](https://ai-powered.com/skills/react-frontend): React frontend is an open-source agent skill for developer tools.
- [Antfu](https://ai-powered.com/skills/antfu): Antfu is an open-source agent skill for developer tools.
- [Vllm plugin fl setup flagos](https://ai-powered.com/skills/vllm-plugin-fl-setup-flagos): Vllm plugin fl setup flagos is an open-source agent skill for developer tools.
- [Vue](https://ai-powered.com/skills/vue): Vue is an open-source agent skill for developer tools.
- [Vercel CLI with tokens](https://ai-powered.com/skills/vercel-cli-with-tokens): Vercel CLI with tokens is a free agent skill for cloud and infrastructure.

---
Source: https://ai-powered.com/skills/flags-sdk-scaledockhq
