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

# Linear から API ドキュメントを自動生成

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="Linear から API ドキュメントを自動生成" description="ドキュメント用のプレイブックを作成し、それを Linear のラベルとして同期しておけば、チケットにそのラベルを付けるだけで誰でもドキュメント生成を実行できます。" prompt="Linear チケットで説明されているエンドポイントに対して、社内のドキュメント標準に従った API ドキュメントを生成する、!add-docs という名前のプレイブックを作成してください。" category="プロジェクト管理" features="連携, プレイブック" devinUrl="https://app.devin.ai/settings/connections/linear" />

<div className="uc-detail-wrapper">
  <Tip>手動でのセットアップが面倒ですか？このページへのリンクをDevinのセッションに貼り付け、すべての設定を依頼してください。</Tip>

  <Steps>
    <Step title="ドキュメント向けのプレイブックを作成する">
      まずは、標準化したいタスク用の[playbook](/ja/product-guides/creating-playbooks)を作成します。この例では、チームメンバーがチケットにラベルを付けたときに API ドキュメントを自動生成する playbook を作成します。

      [**Settings > Playbooks**](https://app.devin.ai/settings/playbooks?utm_source=docs\&utm_medium=use-case-gallery) に移動し、**Create playbook** をクリックします。名前とマクロ (例: `!add-docs`) を指定します。

      具体的な手順をステップごとに記述します。実際のファイルパスや運用ルールを参照させて、Devin がチームの標準に従えるようにします:

      <PromptBlock type="playbook">
        ```txt !add-docs playbook theme={null}
        対象の機能やエンドポイントのコンテキストを理解するために Linear のチケットを読む。そのうえで、次を実行する:

        1. 関連するソースコード（ルートハンドラー、コントローラー、
           モデル、型定義）を探す
        2. docs/api/ にある既存ドキュメントを読み、使用している
           フォーマットと運用ルールを把握する
        3. 以下をカバーするドキュメントを生成する:
           エンドポイント URL、HTTP メソッド、リクエスト／レスポンスの
           スキーマ、認証要件、エラーコード、curl を使った使用例
        4. docs/sidebar.json で新しいページをドキュメントの
           サイドバーに追加する
        5. 関連するエンドポイントがある場合は、相互参照を追加する
        6. 新しいドキュメントを含む PR を作成する
        ```
      </PromptBlock>

      playbook が具体的であればあるほど、アウトプットの品質は高くなります。チームで実際に使っているドキュメントテンプレート、スタイルガイド、ツール類を参照させてください。効果的な playbook の書き方については、[playbook docs](/ja/product-guides/creating-playbooks) も参照してください。
    </Step>

    <Step title="プレイブックを Linear に同期する">
      まだ [Linear integration](/ja/integrations/linear) を接続していない場合は、[**Settings > Connections > Linear**](https://app.devin.ai/settings/connections/linear?utm_source=docs\&utm_medium=use-case-gallery) に移動し、**Connect** をクリックします。Devin にアクセス権を付与するチームを選択します。

      接続できたら、**Synced playbook labels** までスクロールし、**Add playbook** をクリックします。ドロップダウンから `!add-docs` を選択します。これにより、Linear の **Devin Playbooks** ラベルグループの配下に `!add-docs` というラベルが自動的に作成されます。

      今後は誰かがチケットにそのラベルを追加すると、Devin がそのプレイブックを使ってセッションを開始します。

      <Note>プレイブックラベルを Linear に自動同期するには、Linear ワークスペースで **Manage workspace labels** が **All members** に設定されている必要があります (Linear の **Settings > Security** にあります) 。これが有効になっていない場合は、Linear でラベルを手動で作成する必要があります。</Note>
    </Step>

    <Step title="チケットにラベルを付けてドキュメントを生成する">
      チームメンバーが次のようなチケットに `!add-docs` ラベルを追加すると:

      > **ENG-215**: Add POST /api/v2/webhooks endpoint — accepts a URL and event types, validates the URL is reachable, stores the subscription, and returns the webhook ID.

      Devin が自動的にセッションを開始し、あなたのドキュメント向けプレイブックに従います:

      * **チケットを読む** — エンドポイントの説明、パラメータ、およびリンクされた PR を取得する
      * **ソースコードを探す** — ルートハンドラー、リクエスト検証スキーマ、レスポンスタイプを特定する
      * **ドキュメントを生成する** — 既存のフォーマットに従って `docs/api/` に新しいページを作成する
      * **PR を作成する** — 新しいドキュメントページと更新されたサイドバーを含める

      これはバッチ処理にも適しています。**Cmd+A** でチケットを複数選択し、右クリックして `!add-docs` ラベルを追加すると、複数のエンドポイントのドキュメントを並列で生成できます。

      <Tip>Linear との連携機能がインストールされていると、Devin は Linear のツールに直接アクセスできるため、プレイブックで Devin に対して、結果に基づいてチケットのラベルやステータスを更新するよう指示できます。ラベルは他の自動化をトリガーできるので、ワークフローを連鎖させることも可能です。たとえば、ドキュメント生成後に `Docs Ready` ラベルを付与して、テックライターにレビューを通知するといったことができます。</Tip>
    </Step>

    <Step title="チーム向けプレイブックをさらに作成する">
      同じパターンは、あらゆる定型的なタスクに使えます。プレイブックを作成してラベルとして同期すれば、チームはどのチケットからでもそれをトリガーできます。例えば次のようなものがあります:

      * **`!write-tests`** — チケットに記載された機能に対してテストカバレッジを追加する
      * **`!refactor`** — チームの規約に従ってコードをリファクタリングする
      * **`!security-audit`** — セキュリティ上の脆弱性についてコードをレビューし、修正を含む PR を作成する
      * **`!migrate`** — 標準化されたマイグレーション (依存関係のアップグレード、API バージョンの更新) を実行する

      [automation triggers](/ja/integrations/linear) を設定して、誰もラベルを適用しなくても Devin が自動で作業を開始するようにすることもできます。[**Settings > Connections > Linear**](https://app.devin.ai/settings/connections/linear?utm_source=docs\&utm_medium=use-case-gallery) に移動し、**Automation triggers** までスクロールして、チケットが特定のステータスやラベルに遷移したときに起動するトリガーを設定します。
    </Step>
  </Steps>
</div>
