PlaybookPrompts

Design a feature flag implementation and rollout strategy

Coding & Development feature-flagsdeploymentarchitecture

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.

Prompt
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.
Variables to fill in
  • {{LANGUAGE_FRAMEWORK}}
  • {{FEATURE_DESCRIPTION}}
  • {{ROLLOUT_PLAN}}
  • {{EXISTING_FLAG_INFRA}}

How to use this prompt

  1. Copy the prompt above (Copy button on the top-right).
  2. Replace each {{VAR}} with your own value. Variables: {{LANGUAGE_FRAMEWORK}}{{FEATURE_DESCRIPTION}}{{ROLLOUT_PLAN}}{{EXISTING_FLAG_INFRA}}.
  3. Paste it into one of the recommended tools below.
  4. 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.

Heads up: some of the links on this page are affiliate links — meaning we may earn a commission if you sign up after clicking, at no extra cost to you. We only recommend tools we'd put on our own stack. You can see our full affiliate disclosure here.

Pair this prompt with a tool

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.