> ## 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="マージ済みのPRをDevinにスキャンさせ、ハードコードされた色や不足しているトークンを検出するようスケジュールします。" prompt="過去24時間にマージされたすべてのフロントエンドのPRをレビューしてください。それぞれについて、ハードコードされた色、標準外のスペーシング、不足しているデザイントークン、共有コンポーネントライブラリを使用していないコンポーネントなど、デザインシステムへの違反がないかを確認してください。各違反ごとに、「design-fix」ラベルを付けた Linear のチケットを作成してください。" category="自動化" features="スケジュール, 連携" type="schedule" />

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

  <Steps>
    <Step title="Devin に自社のデザインシステムを学習させる">
      スキャナがどれだけ有用かは、チェック対象となるルールの質にかかっています。自分で Knowledge エントリを書く代わりに、Devin にデザインシステムのソースファイルを指定して、Knowledge を自動生成させましょう。

      新しい [Devin セッション](https://app.devin.ai/?utm_source=docs\&utm_medium=use-case-gallery) を開き、次のようなプロンプトを貼り付けます:

      <PromptBlock agent="advanced" intent="create">
        ```txt Learn our design system and create Knowledge theme={null}
        Read our design system source files:
        - src/tokens/colors.ts (color palette and token names)
        - src/tokens/spacing.ts (spacing scale and grid rules)
        - src/components/ui/ (shared component library)

        Also read any README or documentation files in those directories.

        From what you learn, create Knowledge entries for each of these
        categories:

        1. Color tokens — which tokens exist, naming conventions, and that
           raw hex/rgb/hsl values are never allowed
        2. Spacing grid — the 4px grid system, available spacing tokens,
           and that hardcoded pixel values are forbidden
        3. Component library — which shared components exist, when to use
           each one, and that one-off alternatives are not allowed

        Set each entry’s trigger to fire when working with frontend code
        in this repo. Pin them to the acme/webapp repository.
        ```
      </PromptBlock>

      Devin はソースファイルを読み込み、ルールを抽出し、次のような Knowledge エントリを作成します:

      * **Color tokens** — *"すべてのカラーは `src/tokens/colors.ts` に定義されたトークンを使用しなければなりません。`#3B82F6` のような生の 16 進数値は絶対に使用しないでください。代わりに `colors.primary.500` を使用してください。"*
      * **Spacing grid** — *"すべてのスペーシングは 4px グリッドに従わなければなりません。`src/tokens/spacing.ts` に定義されたスペーシングトークン (例: `spacing.2` = 8px, `spacing.4` = 16px) を使用してください。`margin: 10px` のようなピクセル値のハードコードは行わないでください。"*
      * **Component library** — *"`src/components/ui/` にある共有コンポーネント (`<Button>`、`<Avatar>`、`<Modal>`、`<Card>` など) を必ず使用してください。その場限りの代替コンポーネントは作成しないでください。"*

      **Settings > Knowledge** で生成されたエントリを確認し、先に進む前に文言やトリガーを必要に応じて調整してください。
    </Step>

    <Step title="チケット作成用に Linear を連携する">
      日次スキャンでは検出した各違反ごとに Linear のチケットが作成されるため、スケジュールを設定する前に Linear を連携してください。

      1. **Settings > Connections > Linear** に移動し、**Connect** をクリックします
      2. Devin を承認し、アクセスさせるチームを選択します
      3. Linear で **"Design Debt"** というプロジェクトを作成します
      4. **"design-fix"** というラベルを作成します — 最後のステップで自動修正をトリガーするためにこれを使用します

      詳しいセットアップ方法については、[Linear integration](/ja/integrations/linear) を参照してください。
    </Step>

    <Step title="日次スキャンのスケジュール設定">
      **Settings > Schedules** に移動し、**Create schedule** をクリックします。次のように設定します:

      * **Name**: Design system scanner
      * **Schedule type**: Recurring
      * **Frequency**: 毎日午前9:00 (チームのタイムゾーン)
      * **Agent**: Devin
      * **Email notifications**: Always (毎朝結果が届くように)

      次の内容をプロンプトとして貼り付けます:

      <PromptBlock type="schedule">
        ```txt Daily design system scan theme={null}
        Review all frontend PRs merged in the last 24 hours in the
        acme/webapp repo. For each PR, check the diff for:

        1. Hardcoded color values (hex, rgb, hsl) instead of tokens
           from src/tokens/colors.ts
        2. Non-standard spacing that doesn't follow our 4px grid
        3. New components that duplicate existing ones in
           src/components/ui/
        4. Missing responsive breakpoints for any new layout code

        For each violation, create a Linear ticket in the "Design Debt"
        project with:
        - The "design-fix" label
        - File path and line number
        - What the violation is and how to fix it
        - The name of the person who authored the violating change
          (from the PR author or git blame)

        Skip files in src/vendor/ and src/legacy/ — those are
        intentional exceptions.
        ```
      </PromptBlock>

      入力ボックスから直接このスケジュールを作成することもできます。プロンプトを入力し、**three-dot menu** (⋯) をクリックして、**Schedule Devin** を選択します。詳しくは [Scheduled Sessions](/ja/product-guides/scheduled-sessions) を参照してください。

      毎朝スキャンが実行されたあと、Design Debt プロジェクトには次のようなチケットが作成されます:

      | Ticket | File                             | Violation               | Suggested fix                           |
      | ------ | -------------------------------- | ----------------------- | --------------------------------------- |
      | DD-101 | `src/pages/Settings.tsx:42`      | Hardcoded `#3B82F6`     | `colors.primary.500` に置き換える             |
      | DD-102 | `src/components/UserCard.tsx:18` | Custom avatar component | `src/components/ui/` の `<Avatar>` を使用する |
      | DD-103 | `src/pages/Dashboard.tsx:95`     | `margin: 10px`          | `spacing.3` を使用する (12px、最も近い 4px グリッド値) |
      | DD-104 | `src/views/Profile.tsx:33`       | No mobile breakpoint    | グリッドレイアウトに `md:` ブレークポイントを追加する          |
    </Step>

    <Step title="自動修正PRでループを完結">
      スキャナーの出力を信頼できるようになったら、同じ実行内で違反の修正までDevinに行わせるようプロンプトを変更します — 別のトリガーは不要です。スキャン用プロンプトの末尾に修正ステップを追加します:

      <PromptBlock type="schedule">
        ```txt 毎日のデザインシステムスキャン（自動修正付き） theme={null}
        過去24時間にacme/webappリポジトリにマージされた
        すべてのフロントエンドPRをレビューしてください。各PRについて、
        diffを以下の観点で確認してください:

        1. src/tokens/colors.ts のトークンではなく、ハードコードされた
           カラー値（hex, rgb, hsl）を使っている箇所
        2. 4pxグリッドに沿っていない非標準的なスペーシング
        3. src/components/ui/ に既存のものと重複する新規コンポーネント
        4. 新しいレイアウトコードに対してレスポンシブブレークポイントが
           足りていない箇所

        各違反について:
        - "Design Debt" プロジェクトに、"design-fix" ラベル付きで、
          ファイルパス、行番号、説明、およびその違反を含む変更の
          作者の名前を含めたLinearチケットを作成する
        - Knowledge にあるデザインシステムのルールに従って違反を修正する
        - 元のPRごとに、すべての修正を1つのPRにまとめ、関連する
          Linearチケットとリンクする

        src/vendor/ および src/legacy/ 内のファイルはスキップしてください —
        これらは意図的な例外です。
        ```
      </PromptBlock>

      これで全体のループが自動で回ります: **scan** → **ticket + fix PR** → **review**。毎朝、違反レポートと、それらを修正するPRの両方が揃った状態で確認できます。

      見つかったすべての違反の週次サマリーを生成するには、フォローアップとして次を実行します:

      <PromptBlock>
        ```txt 週次デザイン負債レポート theme={null}
        今週見つかったすべてのデザインシステム違反を要約してください。
        違反タイプごとにグルーピングし、どのファイルとコンポーネントが
        最も問題が多いかを示してください。レポートをSlackの
        #design-system に投稿してください。
        ```
      </PromptBlock>
    </Step>
  </Steps>
</div>
