vercel avatar

Flags

When you're working on Next.js internals and need to add or modify feature flags, this walks you through the required wiring across multiple config files. You'll touch config-shared.ts for types, config-schema.ts for validation, and potentially define-env.ts depending on where the flag gets consumed. The skill breaks down the distinction between client-bundled code (where build-time injection works) and pre-compiled runtime bundles (where you need actual process.env variables set). The documentation is thorough on the two approaches for runtime flags, including the tradeoff between simpler runtime env vars versus separate bundle variants that eliminate dead code but add build complexity. This is narrow and deep, aimed squarely at Next.js contributors rather than app developers.

skills.sh installs
900
GitHub stars
139.5K
last updated
May 16, 2026

Install

$ npx -y skills add vercel/next.js --skill flags --agent claude-code

Installs into .claude/skills of the current project.

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:

Sponsors

Details

Repository
github.com/vercel/next.js
Categories
Frontend Development, Cloud & Infrastructure
First seen
May 16, 2026

More from vercel/next.js

All 14
1onmax avatarphaser-best-practicesonmax/nuxt-skillsBuilds and refactors Phaser 3 browser games. Use for creating a new Phaser project, adding scenes, entities, physics, UI, tilemaps, animations, input, audio, ca879skills.sh installs
2vercel avatardce-edgevercel/next.jsdce edge842skills.sh installs
3vercel avatarpr-status-triagevercel/next.jspr status triage839skills.sh installs
4vercel avatarwrite-guidevercel/next.jswrite guide721skills.sh installs
5plugin87 avatardesign-reviewplugin87/ux-ui-agent-skillsReview or audit a design/UI across 6 weighted dimensions with Nielsen's 10 heuristics and a prioritized findings table. Use when the user wants a design critiqu644skills.sh installs
6plugin87 avatarredesignplugin87/ux-ui-agent-skillsUpgrade an existing website or app to premium quality without breaking functionality — audit the current design, identify generic/AI tells, then apply taste and580skills.sh installs