📊diff-intake
- プラグイン
- amplitude
- ソース
- GitHub で見る ↗
説明
PRまたはブランチの差分を読み取り、下流の分析計装スキルが利用できる構造化されたYAML形式の変更概要を生成します。 次のような場合に使用: ユーザーがPRリンク・ブランチ比較・生のdiffを共有し、「何が変わったか」「何をトラッキングすべきか」「フィーチャーをどのように計装するか」を把握したい場合の最初のステップとして使用します。 「review this PR」「what changed in this branch」「help me instrument this diff」「check analytics coverage for this change」など、アナリティクスレビューワークフローを開始するリクエストや、それに類するフレーズをトリガーとして起動します。
原文を表示
Reads a PR or branch diff and produces a structured YAML change brief for downstream analytics instrumentation skills. Use this as the first step whenever a user shares a PR link, branch comparison, or raw diff and wants to understand what changed, what needs tracking, or how to instrument a feature. Trigger on phrases like "review this PR", "what changed in this branch", "help me instrument this diff", "check analytics coverage for this change", or any request to start the analytics review workflow.
ユースケース
- ✓PRやブランチの差分内容を確認したい
- ✓変更箇所をYAML形式で構造化したい
- ✓アナリティクス計装箇所を把握したい
- ✓変更内容のトラッキング対象を決めるとき
本文(日本語訳)
diff-intake
このスキルをステップごとに順番に実行してください。
あなたはアナリティクス計装ワークフローのステップ1です。後続のスキル(discover-event-surfaces、instrument-events)が利用するコンパクトなYAML形式の変更ブリーフを生成してください。出力は機械可読かつ正確に保つこと — YAMLブロックの前後に説明文を付けないこと。
ステップ1: 変更ファイルの取得とカテゴリ分類
変更ファイルの一覧をソースから取得し、それぞれをカテゴリに分類します。
変更の取得方法
- PR URL の場合
gh pr view <number-or-url> gh pr view <pr-number> --json files --jq '.files[] | "\(.path)\t+\(.additions) -\(.deletions)\t"' - ブランチ比較の場合
git log <main|master>..<branch> git diff --stat <main|master>..<branch> - 曖昧な指定(PR番号、ブランチ名など): 適切な形式を推定して取得すること。認証エラーが発生した場合を除き、確認のための質問はしないこと。
ファイルのカテゴリ分類
各ファイルをパスに基づいて以下のカテゴリに割り当てます:
| カテゴリ | 対象の例 |
|---|---|
| Core Logic | アプリケーションのソースコード(例: src/auth/login.py、database/models.ts) |
| Generated | パスに generated を含むもの |
| Testing | テストファイル |
| Config / Dependencies | package.json、docker-compose.yml など |
| Documentation | README、docs/ 配下 |
| Noise | ロックファイル、.svg、自動生成されたマイグレーションファイル |
各ファイルについて以下を記録します: パス、カテゴリ、変更種別(Added / Modified / Deleted)、アナリティクス関連度(1〜5)。
ステップ2: ファイルサマリーマップの構築
Core Logic に分類されたファイルをすべて読み込み、ファイルサマリーマップを作成します。 処理・記載の対象は Core Logic ファイルのみとします。
詳細差分の取得方法
- PR の場合
レスポンスをもとに詳細差分を取得:gh pr view <number-or-url> --json baseRefOid,headRefOidgit diff <baseRefOid>...<headRefOid> -- <file1> <file2> <file_n> - ブランチ比較の場合
git diff main..feature/foo -- <file1> <file2> <file_n>
各ファイルについて記録する項目
summary— 変更内容を2行以内でまとめた要約stack—frontend、backend、またはshared
ユーザー向け変更点とタッチされたサーフェスの導出
差分および変更ファイルを読み込む際、後続のイベント検出スキルが必要とする上位レベルのシグナルも合わせて生成します:
user_facing_changes— ユーザー、PM、またはアナリストにとって意味のある具体的な動作変更のフラットなリスト。各項目は「ユーザーが新たにできること・見えるようになったこと・体験が変わったこと」を記述すること。純粋な内部リファクタリングは除外すること。surfaces.components— ユーザー向け変更に直接関与するUIコンポーネント、ルート、ページ、ハンドラー、その他のインタラクションサーフェス。低レベルのヘルパーより、計装ポイントとして適切な箇所を優先すること。
各サーフェスについて記録する項目:
name— コンポーネント名、ルート名、ページ名、フック名、またはサーフェス名file— リポジトリルートからの相対パスchange—added、modified、またはdeleted
バックエンドのみの変更、または明確なインタラクティブサーフェスが存在しない場合は、surfaces.components を作成せず省略すること。
ステップ3: 変更全体の分類
変更の種別とアナリティクスのスコープを推定します:
| 種別 | アナリティクスへの影響 |
|---|---|
feat |
高 — 新しいサーフェスのトラッキングが必要になる可能性が高い |
fix |
低〜中 — 既存イベントの条件に影響する可能性がある |
refactor |
低 — トラッキングのパスが移動する可能性があり、回帰リスクあり |
perf |
低 — 通常トラッキングへの影響なし |
revert |
中 — 失われたトラッキングの確認が必要 |
style / docs / test / build / ci / chore |
なし — アナリティクス分析はスキップ |
analytics_scope は検出された種別のうち最も高い影響度を設定します:
none— 影響のない種別のみlow—perfまたはrefactorのみmedium—fixを含むhigh— 機能追加または機能拡張を含む
analytics_scope が none の場合は、ブリーフを出力した上で後続スキルは不要である旨を記載すること。
ステップ4: YAMLブリーフの出力
YAMLブロックのみを出力すること — 前後に説明文を付けないこと。
フォーマットを厳密に守ること。
file_summary_map には各ファイルを個別にリストアップすること(glob指定不可)。
change_brief:
classification:
primary: feat # 主となるconventional commitの種別
types: [feat, fix] # 検出されたすべての種別
analytics_scope: high # none | low | medium | high
stack: frontend # frontend | backend | fullstack
summary: "変更全体を1文で説明"
user_facing_changes:
- "ユーザーはアバターをドラッグ&ドロップでアップロードし、保存前にプレビューできるようになった。"
surfaces:
components:
- name: "AvatarUpload"
file: "src/components/AvatarUpload.tsx"
change: modified
file_summary_map: # 各エントリにlayerフィールドを含める
- file: "src/components/AvatarUpload.tsx"
summary: "ドラッグ&ドロップとプレビュー機能を持つアバターアップロード用の新コンポーネント"
layer: frontend # frontend | backend | shared
- file: "src/api/upload.ts"
summary: "アップロードエンドポイントのハンドラー。ファイル種別を検証しS3に保存する"
layer: backend
原文(English)を表示
diff-intake
Follow this skill step by step. You are step 1 of the analytics instrumentation workflow. Produce a compact YAML change brief that downstream skills (discover-event-surfaces, instrument-events) will consume. Keep the output machine-readable and precise — no prose around the YAML block.
Step 1: Gather changed files and categorize
Fetch the list of changed files from the source, then categorize each one.
Fetching changes
- PR URL
gh pr view <number-or-url>gh pr view <pr-number> --json files --jq '.files[] | "\(.path)\t+\(.additions) -\(.deletions)\t"' - Branch comparison
git log <main|master>..<branch>git diff --stat <main|master>..<branch> - Ambiguous mention (PR number, branch name): infer the right form and fetch without asking unless auth fails.
Categorize files
Assign each file to a category based on its path:
- Core Logic: application source (e.g. src/auth/login.py, database/models.ts)
- Generated: anything with
generatedin its path - Testing: test files
- Config / Dependencies: package.json, docker-compose.yml, etc.
- Documentation: READMEs, docs/
- Noise: lock-files, .svg, auto-generated migrations
For each file, record: path, category, change type (Added / Modified / Deleted), and analytics likelihood (1–5).
Step 2: Build the file summary map
Read every single Core Logic file and create the file summary map. Only process and include Core Logic files.
Fetching detailed diffs
- PR
gh pr view <number-or-url> --json baseRefOid,headRefOidUsing the response, get a detailed diffgit diff <baseRefOid>...<headRefOid> -- <file1> <file2> <file_n> - Branch comparison
git diff main..feature/foo -- <file1> <file2> <file_n>
For each file, record
summary— 2-line summary of what changedstack— frontend, backend, or shared
Also derive user-facing changes and touched surfaces
While reading the diff and the changed files, also produce the higher-level signals that downstream event discovery needs:
user_facing_changes— a flat list of concrete behavior changes that matter to a user, PM, or analyst. Each item should describe what a user can now do, see, or experience differently. Omit purely internal refactors.surfaces.components— the UI components, routes, pages, handlers, or other interaction surfaces directly involved in those user-facing changes. Prefer likely instrumentation points over low-level helpers.
For each surface, record:
name— component, route, page, hook, or surface namefile— repo-relative pathchange—added,modified, ordeleted
If the change is backend-only or has no clear interactive surface, omit
surfaces.components rather than inventing one.
Step 3: Classify the overall change
Infer the change type and analytics scope:
| Type | Analytics implication |
|---|---|
| feat | High — new surfaces likely need tracking |
| fix | Low–Medium — may affect existing event conditions |
| refactor | Low — tracking paths may move, regression risk |
| perf | Low — usually no tracking impact |
| revert | Medium — need to check what tracking was lost |
| style / docs / test / build / ci / chore | None — skip analytics analysis |
analytics_scope = highest implication present:
none— only no-impact typeslow— only perf/refactormedium— fixhigh— any feature or capability addition
If analytics_scope is none, emit the brief and note that downstream skills are not needed.
Step 4: Emit the YAML brief
Output only the YAML block — no prose before or after. Follow the format exactly. List each file individually in file_summary_map (no globs).
change_brief:
classification:
primary: feat # dominant conventional commit type
types: [feat, fix] # all types detected
analytics_scope: high # none | low | medium | high
stack: frontend # frontend | backend | fullstack
summary: "One sentence describing the overall change"
user_facing_changes:
- "Users can now upload an avatar with drag-and-drop and preview it before saving."
surfaces:
components:
- name: "AvatarUpload"
file: "src/components/AvatarUpload.tsx"
change: modified
file_summary_map: # each entry includes a layer field
- file: "src/components/AvatarUpload.tsx"
summary: "New component for avatar upload with drag-and-drop and preview"
layer: frontend # frontend | backend | shared
- file: "src/api/upload.ts"
summary: "Upload endpoint handler, validates file type and persists to S3"
layer: backend
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。