> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Clean Up Feature Flags Post-Release

export const UseCaseHero = ({title, description, prompt, category, features, devinUrl, agent, intent, playbookId, type}) => {
  const encodedPrompt = encodeURIComponent(prompt || '');
  const tag = 'docs-use-case-gallery';
  const utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=hero-cta';
  const agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  const devinHref = type === 'schedule' ? 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + (prompt ? '&prompt=' + encodedPrompt : '') : type === 'review' ? 'https://app.devin.ai/review?' + utm : agent === 'ada' ? 'https://app.devin.ai/search?' + utm + '&noSubmit=true' + (prompt ? '&prompt=' + encodedPrompt : '') : devinUrl ? devinUrl.includes('?') ? devinUrl + '&' + utm + agentParams : devinUrl + '?' + utm + agentParams : prompt ? 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encodedPrompt : 'https://app.devin.ai/?' + utm + agentParams;
  const buttonLabel = type === 'schedule' ? 'Schedule in Devin ↗' : type === 'review' ? 'Set Up Devin Review ↗' : agent === 'advanced' ? 'Try in Devin ↗' : agent === 'dana' ? 'Try in Dana ↗' : agent === 'ada' ? 'Try in Ask Devin ↗' : 'Try in Devin ↗';
  const featureList = features ? features.split(',').map(f => f.trim()) : [];
  return <div className="uc-hero">
      <div className="uc-hero-inner">
        <div className="uc-hero-left">
          <h1 className="uc-hero-title">{title}</h1>
          <p className="uc-hero-desc">{description}</p>
          <div>
            <a href={devinHref} target="_blank" rel="noopener noreferrer" className="try-in-devin-btn">
              {buttonLabel}
            </a>
          </div>
        </div>
        <div className="uc-hero-meta">
          <div className="uc-meta-item">
            <span className="uc-meta-label">Author</span>
            <span className="uc-meta-value">Cognition</span>
          </div>
          <div className="uc-meta-item">
            <span className="uc-meta-label">Category</span>
            <span className="uc-meta-value">{category}</span>
          </div>
          {featureList.length > 0 && <div className="uc-meta-item">
              <span className="uc-meta-label">Features</span>
              <span className="uc-meta-value">{featureList.join(', ')}</span>
            </div>}
        </div>
      </div>
    </div>;
};

export const PromptBlock = ({children, type, agent, intent, playbookId}) => {
  var utm = 'utm_source=docs&utm_medium=use-case-gallery&utm_campaign=prompt-block';
  var tag = 'docs-use-case-gallery';
  var agentParams = (agent ? '&agent=' + agent : '') + (intent ? '&intent=' + intent : '') + (playbookId ? '&playbookId=' + playbookId : '');
  var label = type === 'schedule' ? 'Schedule in Devin' : type === 'playbook' ? 'Create Playbook' : type === 'knowledge' ? 'Add to Knowledge' : agent === 'advanced' ? 'Try in Devin' : agent === 'dana' ? 'Try in Dana' : agent === 'ada' ? 'Try in Ask Devin' : 'Try in Devin';
  var buildUrl = function (text) {
    var encoded = encodeURIComponent(text);
    if (type === 'schedule') return 'https://app.devin.ai/settings/schedules/create?' + utm + agentParams + '&prompt=' + encoded;
    if (type === 'playbook') return 'https://app.devin.ai/settings/playbooks/create?' + utm + '&body=' + encoded;
    if (type === 'knowledge') return 'https://app.devin.ai/knowledge?' + utm + '&body=' + encoded;
    if (agent === 'ada') return 'https://app.devin.ai/search?' + utm + '&noSubmit=true&prompt=' + encoded;
    return 'https://app.devin.ai/?tags=' + tag + '&' + utm + agentParams + '&prompt=' + encoded;
  };
  const ref = React.useRef(null);
  const [href, setHref] = React.useState('#');
  React.useEffect(() => {
    if (!ref.current) return;
    var codeEl = ref.current.querySelector('pre code');
    if (codeEl) {
      var text = codeEl.textContent.trim();
      if (text) setHref(buildUrl(text));
    }
    var header = ref.current.querySelector('[data-component-part="code-block-header"]');
    if (header && !header.querySelector('.prompt-block-devin-link')) {
      var link = document.createElement('a');
      link.href = href;
      link.target = '_blank';
      link.rel = 'noopener noreferrer';
      link.className = 'prompt-block-devin-link';
      link.style.cssText = 'display:inline-flex;align-items:center;gap:6px;text-decoration:none;color:#fff;font-size:11px;font-weight:500;padding:4px 10px;border-radius:6px;white-space:nowrap;background:#317CFF;transition:background 0.2s;margin-left:8px;';
      link.innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/><polyline points="15 3 21 3 21 9"/><line x1="10" y1="14" x2="21" y2="3"/></svg> ' + label;
      link.onmouseenter = function () {
        link.style.background = '#2968D9';
      };
      link.onmouseleave = function () {
        link.style.background = '#317CFF';
      };
      header.appendChild(link);
    }
    var existingLink = ref.current.querySelector('.prompt-block-devin-link');
    if (existingLink && href !== '#') existingLink.href = href;
  });
  return <div className="prompt-block" ref={ref}>{children}</div>;
};

<UseCaseHero title="Clean Up Feature Flags Post-Release" description="Schedule a one-time Devin session to strip out a feature flag and its dead code after your release stabilizes." prompt="Next Friday at 9 AM, remove the feature flag 'enable_new_checkout' from our codebase. Delete the flag definition, keep the enabled code path, remove the disabled path, update tests, and open a PR." category="Automations" features="Schedules" type="schedule" />

<div className="uc-detail-wrapper">
  <Tip>Don't want to set this up manually? Paste a link to this page into a Devin session and ask it to set everything up for you.</Tip>

  <Steps>
    <Step title="Schedule the cleanup when you ship the flag">
      You just deployed a new checkout flow behind `enable_new_checkout`. It's enabled in production, but you want a week of monitoring before you commit to removing the old code. Instead of creating a ticket you'll forget about, schedule a one-time Devin session right now — while the context is fresh.

      Open the [schedule creation page](https://app.devin.ai/settings/schedules/create?utm_source=docs\&utm_medium=use-case-gallery) and set the type to **One-time**. Pick a date after your monitoring window (e.g., next Friday at 9 AM). Select a **Slack channel** so your team gets notified when the session runs and the PR is ready. Then paste your prompt:

      <PromptBlock type="schedule">
        ```txt Clean up feature flag after release theme={null}
        Remove the feature flag "enable_new_checkout" from the codebase:

        1. Delete the flag definition from src/config/featureFlags.ts
        2. Find every conditional that checks this flag (useFeatureFlag, isEnabled,
           if/else branches) and keep only the enabled path
        3. Delete the old checkout implementation that's now unreachable
        4. Remove or update any tests that mock this flag
        5. Run the test suite and open a PR with a summary of what was removed
        ```
      </PromptBlock>
    </Step>

    <Step title="Make the prompt thorough">
      Feature flags hide in unexpected places — config files, test fixtures, comments, environment variables. The more context you put in the prompt, the cleaner the result. Include:

      * **How your flags work** — where they're defined and how they're checked (e.g., `useFeatureFlag('name')` in React, `isEnabled('name')` in backend services)
      * **What not to touch** — the flag framework itself vs. the specific flag (e.g., "don't modify `src/lib/featureFlags/` — that's the framework")
      * **Where the old and new code live** — e.g., "the old checkout is in `src/pages/checkout/legacy/`, the new flow is in `src/pages/checkout/v2/`"
      * **Cleanup scope** — comments, docs, `.env` files, and CI configs that reference the flag should also be cleaned up

      A prompt with this level of detail lets Devin trace every reference in one pass — no follow-up sweep needed.
    </Step>

    <Step title="Review the PR when it lands">
      When the scheduled session fires, Devin traces every usage of the flag across your codebase, keeps the enabled code path, strips the disabled path and dead code, cleans up tests, and opens a PR. You'll get an email notification when it's ready.

      A typical PR looks like this:

      ```
      Removed feature flag: enable_new_checkout

      - Deleted flag from src/config/featureFlags.ts (1 file)
      - Removed 12 conditional branches across 7 files
      - Deleted src/pages/checkout/legacy/ (4 files, 380 lines)
      - Updated 3 test files — removed flag mocking, deleted old-path tests
      - All 1,204 tests passing
      ```

      Before merging, double-check that no business logic from the old path should have been preserved — error handling, analytics events, or edge-case fallbacks sometimes live inside the "disabled" branch.
    </Step>
  </Steps>
</div>
