> ## 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.

# 本番ホットフィックスをプレイブック化する

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="本番ホットフィックスをプレイブックに変換する" description="インシデント対応セッションで実施した手順をそのまま抽出し、チームが毎回同じ手順で修正を再現できるようにします。" prompt="先週火曜日のメモリリークインシデント対応セッションは教科書どおりの内容でした — Devin がコネクションプール内のリークを特定し、修正を適用し、ステージング環境で検証してから、ダウンタイムゼロでデプロイしました: [session link]。このセッションから再利用可能なホットフィックスプレイブックを抽出し、オンコールエンジニアが今後のメモリ関連の問題で同じプロセスを踏めるようにしてください。" category="Devin Optimization" features="Advanced, Playbooks" agent="advanced" intent="create" />

<div className="uc-detail-wrapper">
  <Tip>手動で設定したくないですか? このページへのリンクを Devin セッションに貼り付けて、必要な設定をすべて行うよう依頼してください。</Tip>

  <Steps>
    <Step title="記録する価値のあるインシデントセッションを特定する">
      本番インシデントを解決すると、診断の各ステップ、実行したすべてのコマンド、プレッシャーのかかる状況下で行ったあらゆる判断が記録された Devin セッションのトランスクリプトが残ります。そのトランスクリプトこそが、次回以降オンコールチームが再利用できるプレイブックの素材になります。

      すべてのインシデントセッションがプレイブックに適しているわけではありません。Devin が明確で再現可能な手順に従っているセッションを探してください — チームが日常的によく遭遇するタイプのインシデントです:

      * **メモリリーク** — 原因となる箇所を特定し、修正を適用し、デプロイ後のヒープ使用量を検証したもの
      * **コネクションプール枯渇** — 根本原因を特定し、プール設定をチューニングし、モニタリングを追加したもの
      * **カスケードタイムアウト** — 失敗している上流を切り分け、サーキットブレーカを追加し、復旧を検証したもの
    </Step>

    <Step title="プレイブックを作成する">
      [Devin のホーム画面](https://app.devin.ai/?utm_source=docs\&utm_medium=use-case-gallery)を開き、新しいセッションを開始します。プレイブック化したいセッションの内容を説明します。

      インシデントセッションのリンクを貼り付けて、プレイブックで何をカバーすべきかを記述します。**一般化の範囲** を具体的に指定してください — プレイブックは、壊れた特定サービスだけでなく、その*クラス*のインシデント全般に対して通用する必要があります。

      <PromptBlock agent="advanced" intent="create">
        ```txt Create hotfix playbook from incident session theme={null}
        This session diagnosed and fixed a memory leak in our payments service
        caused by unclosed database connections:
        https://app.devin.ai/sessions/abc123

        Create a reusable hotfix playbook for memory-leak incidents that any
        on-call engineer can attach to a new session. It should:
        - Generalize the diagnostic steps (not payments-specific)
        - Include the heap profiling approach from the session
        - Capture how it validated the fix in staging before deploying
        - Keep the rollback procedure in case the fix makes things worse
        - Add a step for posting a summary to the #incidents Slack channel
        ```
      </PromptBlock>

      同じタイプのインシデントが複数解決されている場合 (例: メモリリークセッションが 2 つあるなど) は、すべて追加してください。Devin がセッション間の共通パターンを特定し、より堅牢な[プレイブック](/ja/product-guides/creating-playbooks)を生成します。
    </Step>

    <Step title="次のインシデントでプレイブックを検証する">
      実際の検証は、そのプレイブックが同じクラスの*別の*インシデントで機能するかどうかです。次にメモリ関連の問題が発生したら、新しい Devin セッションを開始し、プレイブックをアタッチし、影響を受けているサービスを対象に実行します。

      <PromptBlock>
        ```txt Diagnose memory leak in the notifications service theme={null}
        Use the attached hotfix playbook to investigate and fix a memory leak
        in the notifications service. OOM kills started at 03:12 UTC.
        The service is at src/services/notifications/.
        ```
      </PromptBlock>

      そのセッションでインシデントを問題なく解決できれば、プレイブックは十分に一般化されているといえます。うまくいかない場合 — 例えばリークパターンが異なる、あるいはサービスが別のデータベースドライバを使っているなど — は、そのセッションを Devin に渡してプレイブックを改善するよう依頼します。そのワークフローについては [Fix a Flaky DB Migration Playbook](/ja/use-cases/gallery/improve-playbook-from-sessions) を参照してください。
    </Step>
  </Steps>
</div>
