Design a feature flag implementation and rollout strategy
Shipping a feature flag without a clear structure leads to permanent flags, untested flag removal paths, and messy conditional logic. This prompt designs both the code-level implementation and the lifecycle plan.
You are a senior engineer designing a feature flag system for a new feature. Help me implement this cleanly from the start.
Language / framework: {{LANGUAGE_FRAMEWORK}}
Feature description: {{FEATURE_DESCRIPTION}}
Rollout plan (e.g., '10% of users, then 50%, then 100% over 2 weeks' or 'internal employees first'):
{{ROLLOUT_PLAN}}
Existing flag infrastructure (if any — SDK name, config system, or 'none'):
{{EXISTING_FLAG_INFRA}}
Complete these steps:
1. Recommend where to place the flag check in the codebase (entry point, middleware, service layer, component). Explain the trade-off of checking early vs. late.
2. Write the flag check code snippet for {{LANGUAGE_FRAMEWORK}}, following these rules: (a) the flag must default to OFF if the config is missing, (b) the code path for flag=false must be the existing behavior with no changes, (c) avoid nesting flag checks inside flag checks.
3. Define the flag's data structure: name (use a specific name, not 'my_flag'), type (boolean, string variant, percentage), and the context keys used for targeting (user ID, account tier, region, etc.).
4. Write a checklist for the engineer to complete before each rollout phase (smoke test criteria, metrics to watch, rollback trigger conditions).
5. Write the flag removal plan: what code to delete, what tests to update, and what the PR description should confirm when the flag is retired.
6. Flag if the described rollout plan requires session stickiness or consistent hashing to avoid users flickering between experiences, and note how to handle it. {{LANGUAGE_FRAMEWORK}}{{FEATURE_DESCRIPTION}}{{ROLLOUT_PLAN}}{{EXISTING_FLAG_INFRA}}
How to use this prompt
- Copy the prompt above (Copy button on the top-right).
- Replace each
{{VAR}}with your own value. Variables:{{LANGUAGE_FRAMEWORK}}{{FEATURE_DESCRIPTION}}{{ROLLOUT_PLAN}}{{EXISTING_FLAG_INFRA}}. - Paste it into one of the recommended tools below.
- Iterate: tighten constraints in the prompt if the output is generic.
Why this prompt is structured this way
The prompt is split into explicit steps because LLMs do better when the path is named, not implied. Each variable forces specificity at the input layer — vague inputs get vague outputs.
Pair this prompt with a tool
Cursor
$20/moAI-first code editor forked from VS Code.
Cursor is VS Code with first-class LLM integration. Multi-file edits, codebase Q&A, autocomplete that's actually useful. The default IDE for many shipping engineers in 2026.
Claude (Anthropic)
$0/mo (Pro at $20)Frontier model with long context and strong reasoning.
Claude (Opus / Sonnet / Haiku tiers) is the assistant favored by writers and engineers who care about reasoning quality and tone. 1M token context on Opus.
ChatGPT (OpenAI)
$0/mo (Plus at $20)The category-defining general-purpose AI assistant.
ChatGPT has the broadest feature surface: image gen, voice, custom GPTs, web browsing, code execution. Often the right default; sometimes beaten on specific tasks by Claude or Perplexity.
The PlaybookPrompts weekly
One short email per week. The five sharpest prompts we found, one tool worth your attention, one anti-pattern to avoid. Unsubscribe in one click.
Newsletter signup is not configured. Set PUBLIC_NEWSLETTER_USERNAME in the build env.