
Flags
Step-by-step guide for wiring a new or changed Next.js experimental flag from type declaration through runtime bundles.
- skills.sh installs
- 900
- GitHub stars
- 143.6K
- last updated
- May 16, 2026
What it does
- Covers type declaration, zod schema, build-time injection, runtime env plumbing, and the choice between env-var branching and separate bundle variants
- Lists required files:
config-shared.ts,config-schema.ts,define-env.ts,next-server.ts,export/worker.ts, andmodule.compiled.js - Enforces DefinePlugin entries in
next-runtime.webpack-config.jsto be scoped tobundleType === 'app'sonext-server.tsassignments are not replaced - Designed for framework contributors editing Next.js internals, with links to the
dce-edge,react-vendoring, andruntime-debugskills
Install
$ npx -y skills add vercel/next.js --skill flags -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Feature Flags
Use this skill when adding or changing framework feature flags in Next.js internals.
Required Wiring
All flags need: config-shared.ts (type) → config-schema.ts (zod). If the flag is consumed in user-bundled code (client components, edge routes, app-page.ts template), also add it to define-env.ts for build-time injection. Runtime-only flags consumed exclusively in pre-compiled bundles can skip define-env.ts.
Where the Flag Is Consumed
Client/bundled code only (e.g. __NEXT_PPR in client components): define-env.ts is sufficient. Webpack/Turbopack replaces process.env.X at the user's build time.
Pre-compiled runtime bundles (e.g. code in app-render.tsx): The flag must also be set as a real process.env var at runtime, because app-render.tsx runs from pre-compiled bundles where define-env.ts doesn't reach. Two approaches:
Details
- Repository
- github.com/vercel/next.js
- Categories
- Frontend & UI Code, DevOps & Cloud
- First seen
- May 16, 2026
More from vercel/next.js
All 14Similar to Flags
More Frontend & UI Code
react-vendoringvercel/next.js945 installsVendored React channels, the entry-base.ts boundary, and type declarations for Next.js App Router react-server layers.
dce-edgevercel/next.js842 installsConditional require() and edge-runtime guardrails for webpack DCE in Next.js builds.
nextjs-env-variablesbobmatnyc/claude-mpm-skills153 installsGuide to Next.js environment variables covering file precedence, variable types, and deployment setup.
feature-flags-nextjsposthog/skills139 installsSetup guide for PostHog feature flags in Next.js, covering client hooks, server evaluation, and flag management.
nextjs-turbopackaffaan-m/ecc6.5K installsIncremental Turbopack guidance for Next.js 16+ dev speed, bundler choice, and proxy.ts naming.
viteantfu/skills42.3K installsComprehensive Vite reference covering configuration, plugin API, SSR, library builds, and the Vite 8 Rolldown migration.