flags

Implement Next.js experimental feature flags with type declarations and Zod validation.

1|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/daithang59/docvault --skill flags-daithang59
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flags
Source: https://github.com/daithang59/docvault/tree/main/.agent/skills/flags
Command: npx skills add https://github.com/daithang59/docvault --skill flags-daithang59

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers manage and implement experimental feature flags within the Next.js framework, ensuring proper integration across different build and runtime environments.

Core Features & Use Cases

  • Flag Definition: Guides the process of defining new feature flags, including type declarations and schema validation.
  • Build-time Injection: Explains how to inject flags into user-bundled code during the build process.
  • Runtime Plumbing: Details how to make flags available in pre-compiled runtime bundles, covering environment variable setup and separate bundle variants.
  • Use Case: When introducing a new experimental rendering strategy in Next.js, use this Skill to correctly define the flag, make it available in both client-side components and server-side runtime code, and ensure it functions as expected across development and production builds.

Quick Start

Use the flags skill to add a new experimental feature flag to Next.js configuration.

Frequently Asked Questions about flags

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I inject Next.js experimental feature flags during the build process?

Next.js experimental feature flags can be injected during the build process using DefinePlugin to expose flag values directly to bundled code, ensuring correct integration across different build and runtime environments.

What is the best way to define type declarations and schema validation for Next.js feature flags?

The best way to define Next.js feature flags is by combining TypeScript type declarations with Zod schema validation, which establishes strict typing and validates flag configurations before they enter the build pipeline.

How do I make experimental features available in pre-compiled Next.js runtime bundles?

To make experimental features available in pre-compiled Next.js runtime bundles, set up runtime environment variable plumbing and choose between runtime environment variable branching or generating separate bundle variants for flag consumption.

When should I use runtime environment variable branching versus separate bundle variants for feature flags?

Use runtime environment variable branching for dynamic flag consumption at runtime, whereas separate bundle variants are chosen when you need to pre-compile distinct bundle outputs with hardcoded flag values for specific build targets.

Can I use Zod schema validation to manage Next.js experimental feature flags?

Yes, Zod schema validation can be used to manage Next.js experimental feature flags by validating the flag configurations before build-time injection, ensuring type safety and preventing invalid flag states from entering production.