flags-sdk

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires flags, @flags-sdk/vercel, @vercel/toolbar, and includes references (resource) components.

What problem does it solve? Rolling out features safely and running A/B tests requires server-side flag evaluation, provider integration, and static page compatibility, which is complex to wire up manually in Next.js or SvelteKit applications. ## Core Features & Use Cases - Flags as Code: Declare each feature flag as a callable function with flag(), evaluate server-side, and batch evaluations with evaluate() for better performance. - Provider Adapters: Connect to Vercel Flags, Statsig, LaunchDarkly, PostHog, GrowthBook, Hypertune, Flagsmith, OpenFeature, and more, or write custom adapters. - Precompute Pattern: Keep pages static by evaluating flags in middleware and encoding results into URLs, with ISR and prerendering support via generatePermutations. - Use Case: Add a new feature flag end-to-end: register it with vercel flags add, pull environment variables, declare it with vercelAdapter, and conditionally render UI in a Next.js page. ## Quick Start Ask the agent to create a new boolean feature flag named 'new-dashboard' with Vercel Flags and use it in my Next.js page.

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 in Next.js with the Flags SDK?

Install flags and @flags-sdk/vercel, register the flag with vercel flags add, run vercel env pull, then declare it with flag() and vercelAdapter in a flags.ts file. Call the flag function in an async server component to get its value.

What is the precompute pattern in the Flags SDK?

The precompute pattern evaluates flags in middleware and encodes results into a URL code via rewrite, so pages read precomputed values instead of re-evaluating. This keeps pages static and servable from CDN, with generatePermutations enabling ISR and prerendering.

Which feature flag providers does the Flags SDK support?

Adapters exist for Vercel Flags, Statsig, LaunchDarkly, PostHog, GrowthBook, Hypertune, Flagsmith, Reflag, OpenFeature, and Global Config. Split and Optimizely currently support Flags Explorer data only, and you can write custom adapters.

Does the Flags SDK work with SvelteKit?

Yes, the flags/sveltekit module provides flag(), createHandle for hooks.server.ts, precompute, and generatePermutations. It supports the reroute hook plus middleware for precomputing, and integrates with the Vercel Toolbar via a Vite plugin.

Why should I use evaluate() instead of 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. This reduces parallel promises and microtask overhead compared to awaiting flags individually or using Promise.all.

Why is FLAGS_SECRET required and how do I generate it?

FLAGS_SECRET is required for the precompute pattern and Flags Explorer encryption. Generate it with node -e "console.log(crypto.randomBytes(32).toString('base64url'))" and set a separate sensitive value per environment on Vercel.