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

# Limpar feature flags após o lançamento

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="Limpar Feature Flags Após o Lançamento" description="Agende uma sessão única do Devin para remover um feature flag e seu código morto depois que o seu lançamento estabilizar." prompt="Na próxima sexta-feira às 9h, remova o feature flag 'enable_new_checkout' da nossa base de código. Exclua a definição do flag, mantenha o caminho de código habilitado, remova o caminho desabilitado, atualize os testes e abra um PR." category="Automations" features="Schedules" type="schedule" />

<div className="uc-detail-wrapper">
  <Tip>Não quer configurar isso manualmente? Cole um link desta página em uma sessão do Devin e peça para ele configurar tudo para você.</Tip>

  <Steps>
    <Step title="Agende a limpeza quando você publicar o flag">
      Você acabou de fazer o deploy de um novo fluxo de checkout atrás de `enable_new_checkout`. Ele está habilitado em produção, mas você quer uma semana de monitoramento antes de se comprometer a remover o código antigo. Em vez de criar um ticket que você vai esquecer, agende agora uma sessão única do Devin — enquanto o contexto ainda está fresco.

      Abra a [página de criação de agendamento](https://app.devin.ai/settings/schedules/create?utm_source=docs\&utm_medium=use-case-gallery) e defina o tipo como **One-time**. Escolha uma data após a sua janela de monitoramento (por exemplo, próxima sexta-feira às 9h). Selecione um **canal do Slack** para que sua equipe seja notificada quando a sessão for executada e o PR estiver pronto. Em seguida, cole seu 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="Deixe o prompt detalhado">
      Feature flags se escondem em lugares inesperados — arquivos de configuração, fixtures de teste, comentários, variáveis de ambiente. Quanto mais contexto você colocar no prompt, mais limpo será o resultado. Inclua:

      * **Como seus flags funcionam** — onde são definidos e como são verificados (por exemplo, `useFeatureFlag('name')` em React, `isEnabled('name')` em serviços de backend)
      * **O que não deve ser alterado** — o framework de flags em si vs. o flag específico (por exemplo, "não modifique `src/lib/featureFlags/` — esse é o framework")
      * **Onde o código antigo e o novo estão** — por exemplo, "o checkout antigo está em `src/pages/checkout/legacy/`, o novo fluxo está em `src/pages/checkout/v2/`"
      * **Escopo da limpeza** — comentários, docs, arquivos `.env` e configs de CI que fazem referência ao flag também devem ser limpos

      Um prompt com esse nível de detalhe permite que o Devin rastreie todas as referências em uma única passada — sem necessidade de uma varredura posterior.
    </Step>

    <Step title="Revise o PR quando ele for aberto">
      Quando a sessão agendada for executada, o Devin rastreia todos os usos do flag na sua base de código, mantém o caminho de código habilitado, remove o caminho desabilitado e o código morto, limpa os testes e abre um PR. Você receberá uma notificação por e-mail quando ele estiver pronto.

      Um PR típico se parece com isto:

      ```
      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
      ```

      Antes de fazer o merge, verifique com atenção se nenhuma lógica de negócio do caminho antigo deveria ter sido preservada — tratamento de erros, eventos de analytics ou fallbacks para casos extremos às vezes ficam dentro do branch "desabilitado".
    </Step>
  </Steps>
</div>
