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

# Auto-Generate API Docs from Linear

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="Auto-Generate API Docs from Linear" description="Create a docs playbook, sync it as a Linear label, and let anyone on your team trigger documentation generation by labeling a ticket." prompt="Create a playbook called !add-docs that generates API documentation for the endpoint described in a Linear ticket, following our docs conventions." category="Project Management" features="Integrations, Playbooks" devinUrl="https://app.devin.ai/settings/connections/linear" />

<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="Write a docs playbook">
      Start by creating a [playbook](/product-guides/creating-playbooks) for the task you want to standardize. In this example, we'll build a playbook that generates API documentation whenever a team member labels a ticket.

      Go to [**Settings > Playbooks**](https://app.devin.ai/settings/playbooks?utm_source=docs\&utm_medium=use-case-gallery) and click **Create playbook**. Give it a name and a macro (e.g., `!add-docs`).

      Write specific, step-by-step instructions. Reference real file paths and conventions so Devin follows your team's standards:

      <PromptBlock type="playbook">
        ```txt !add-docs playbook theme={null}
        Read the Linear ticket for context on the feature or endpoint. Then:

        1. Find the relevant source code — route handlers, controllers,
           models, and type definitions
        2. Read our existing docs in docs/api/ to understand the format
           and conventions we use
        3. Generate documentation covering: endpoint URL, HTTP method,
           request/response schemas, authentication requirements, error
           codes, and a usage example with curl
        4. Add the new page to the docs sidebar in docs/sidebar.json
        5. If there are related endpoints, add cross-references
        6. Open a PR with the new documentation
        ```
      </PromptBlock>

      The more specific your playbook, the better the output. Reference your team's actual doc templates, style guides, and tooling. See the [playbook docs](/product-guides/creating-playbooks) for more on writing effective playbooks.
    </Step>

    <Step title="Sync the playbook to Linear">
      Connect your [Linear integration](/integrations/linear) if you haven't already: go to [**Settings > Connections > Linear**](https://app.devin.ai/settings/connections/linear?utm_source=docs\&utm_medium=use-case-gallery) and click **Connect**. Select the teams Devin should have access to.

      Once connected, scroll to **Synced playbook labels** and click **Add playbook**. Select `!add-docs` from the dropdown. This automatically creates a label called `!add-docs` in Linear under the **Devin Playbooks** label group.

      Now when anyone adds that label to a ticket, Devin starts a session using your playbook.

      <Note>For playbook labels to sync to Linear automatically, your Linear workspace must have **Manage workspace labels** set to **All members** (found under Linear's **Settings > Security**). If that's not enabled, you'll need to create the labels manually in Linear.</Note>
    </Step>

    <Step title="Label tickets and generate docs">
      When a team member adds the `!add-docs` label to a ticket like this:

      > **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 automatically starts a session and follows your docs playbook:

      * **Reads the ticket** — pulls the endpoint description, parameters, and any linked PRs
      * **Finds the source code** — locates the route handler, request validation schema, and response types
      * **Generates documentation** — creates a new page in `docs/api/` following your existing format
      * **Opens a PR** — includes the new doc page and updated sidebar

      This works well for batch operations too — multi-select tickets with **Cmd+A**, right-click, and add the `!add-docs` label to generate docs for multiple endpoints in parallel.

      <Tip>With the Linear integration installed, Devin natively has access to Linear's tools — so your playbook can instruct Devin to update ticket labels or status based on the outcome. Since labels can trigger other automations, you can chain workflows — e.g., after docs are generated, a `Docs Ready` label could notify the tech writer for review.</Tip>
    </Step>

    <Step title="Build more playbooks for your team">
      The same pattern works for any recurring task. Create a playbook, sync it as a label, and your team can trigger it from any ticket. Here are some ideas:

      * **`!write-tests`** — Add test coverage for the feature described in a ticket
      * **`!refactor`** — Refactor code following your team's conventions
      * **`!security-audit`** — Review code for security vulnerabilities and open a PR with fixes
      * **`!migrate`** — Run a standardized migration (dependency upgrade, API version bump)

      You can also set up [automation triggers](/integrations/linear) so Devin starts working without anyone applying a label at all. Go to [**Settings > Connections > Linear**](https://app.devin.ai/settings/connections/linear?utm_source=docs\&utm_medium=use-case-gallery), scroll to **Automation triggers**, and configure a trigger that fires when tickets transition to a specific status or label.
    </Step>
  </Steps>
</div>
