Communitygithub.com

amplitude/builder-skills

Node/TypeScript MCP サーバーを Amplitude の @amplitude/mcp-analytics SDK でインストルメントし、ツールコール、セッション、根拠 (rationale) を Amplitude イベントとして追跡します。このスキルは、ユーザーが MCP サーバーに Amplitude アナリティクスを追加したい、「MCP Analytics」、「@amplitude/mcp-analytics」、「MCP サーバーをインストルメントしたい」、「MCP ツールコールを追跡したい」、「MCP ツールに rationale を追加したい」と述べた場合、またはエージェントトラフィック(Claude、Cursor、ChatGPT)を Amplitude に帰属させたい場合に使用します。また、MCP が返すリンクに UTM タグを追加する場合や、MCP イベントと Web/モバイル Amplitude データ間の identity/user_id の不一致をトラブルシューティングする場合にも使用します。

builder-skills とは?

このスキルは、Amplitude の MCP Analytics SDK を使用して、Node/TypeScript 製 MCP サーバーにアナリティクスを統合するための包括的なガイドです。主な目的は、すべてのツールコール、セッション、およびエージェントの根拠 (rationale) を Amplitude イベントとして自動的に追跡し、既存のプロダクトデータ(Web/モバイル)と結合可能にすることです。必須手順として SDK のインストールと全ツールへのラッパー適用、およびユーザー ID の統一を行い、推奨手順としてツールスキーマへの rationale フィールド追加によるエージェント意図のキャプチャ、および戻りリンクへの UTM パラメータ付与によるトラフィック帰属を実装します。スキルは、Version 1 のコードに頼らず常に最新の SDK README を参照することを強調し、よくある間違い(古い API の使用、未ラップのツール、ID 不一致など)を明示的に注意喚起します。特に rationale のキャプチャはサーバー側のスキーマ注入パターン(全ツールの入力スキーマに rationale フィールドを追加)で実現し、クライアント変更不要で全エージェントが根拠を提供するよう促します。

対応✓Claude Code~Codex CLI✓Cursor
npx skills add https://github.com/amplitude/builder-skills/tree/HEAD/engineering-skills/skills/instrument-mcp-server

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Amplitude MCP Analytics セットアップ

MCP サーバーをインストルメントして、すべてのツールコールを Amplitude イベントにし、製品の他の Amplitude データ(リテンション、収益、Web/モバイル使用状況)と結合可能にします。

権威ある SDK リファレンスはパッケージの README です: https://github.com/amplitude/Amplitude-MCP-Analytics-Node (npm: @amplitude/mcp-analytics)。 この SDK はプレビュー版であり急速に進化しています — 常に最新の README を取得し、インストール、API の形状、設定、デフォルトイベントについてはそれに従ってください。 記憶にあるスニペットやこのスキルの要約に依存せず、SDK API の詳細については README が優先されます。

4 つのステップがあります。ステップ 1~2 は必須で README に記載されています — このスキルでは、どのセクションに従うべきか、どの不変条件を確認すべきかを指示します。ステップ 3~4 は強く推奨され、SDK の外部(サーバーのツールスキーマと製品の Web アプリ)での変更が必要なため、ここに完全に文書化されています(SDK README では意図的にカバーされていません)。

順番に実行してください:ステップ 1(ツールコール)→ ステップ 2(ID)→ ステップ 3(Rationale)→ ステップ 4(UTM、サーバーがリンクを返す場合のみ)。何かを「完了」と呼ぶ前に ID を正しく設定してください — 後続のすべてはそれに依存します。

始める前に

以下を確認してください:

  1. これは @modelcontextprotocol/sdk 上に構築された Node/TypeScript MCP サーバーであること。この SDK は他の言語/ランタイムをサポートしていません。
  2. ユーザーがイベントを送信したいプロジェクトの Amplitude API キー を(取得できる状態で)持っていること。
  3. リポジトリが使用するパッケージマネージャー(pnpm/npm/yarn)— それに応じてインストールコマンドを調整してください。

ステップ 1 — SDK をインストールしてツールコールを追跡する(必須)

README を取得し、その Install および Quick start セクションに従ってください。常に最新の公開バージョンをインストール(例:pnpm add @amplitude/mcp-analytics@latest)してください — 記憶からバージョンを固定せず、このスキルからインストールコマンドを複製しないでください。

配線後に確認する不変条件(README がそれぞれ説明しています):

  • analytics.instrumentServer(server, ...) は server.connect() の前に実行される — 順序が重要です。
  • すべての ツールハンドラが analytics.instrumentTool(...) でラップされていること。ラップされていないツールは追跡されません。ラッパーはハンドラと同一の形状を持ち、サーバーがバインドされなかった場合は何もしないパススルーなので、防御的にラップしても安全です。
  • デフォルトイベントはすべて [MCP] プレフィックスを持つため、製品の既存の Amplitude イベントと衝突することはありません。現在のイベントセットとプロパティについては、README の デフォルトイベント テーブル(およびリポジトリ内の docs/events.md)を参照してください。

オプション:instrumentTool/instrumentServer の extra を介して、安定したカスタムディメンション(プラン層、チーム、機能フラグ)をアタッチします — README の カスタムイベントプロパティ セクションを参照してください。

ステップ 2 — ID を正しく設定する(必須、ステップ 1 を「完了」と呼ぶ前にこれを行ってください)

MCP イベントは、製品が Web/モバイルから Amplitude に既に送信している 同じ user_id を保持する必要があります。これをスキップすると、MCP の使用状況はプロダクトデータと結合できない切り離された集団として表示されます — これにより統合のほとんど意味が失われます。

現在の API については README の Identity セクションに従ってください。サーバーレベルのバインディング、ハンドラ内でのリクエストごとの setIdentity()、リクエストの authInfo クレームからのオプトインの resolveIdentity マッピングを提供しています。サーバーの認証モデルに合ったものを選んでください。

ユーザーに伝えるべき動作の1つ:完全に匿名でアンカーのないイベントは、明示的に emitAnonymousEvent: true でオプトインされない限り、デフォルトでドロップされます(ユーザーとしてカウントされません)。これは集計のみの追跡の場合です — これをオンにする前にユーザーの同意を得てください。カウント対象が変わるためです。

ステップ 3 — Rationale をキャプチャする(推奨)

人間がボタンをクリックするのとは異なり、エージェントはなぜツールを呼び出したかを伝えることができます。これをキャプチャすることで、データを「何が起こったか」から「ユーザーが何をしようとしていたか」に変えることができます。

SDK 側は1回の呼び出し(analytics.setRationale(...) — README の Rationale セクションを参照)ですが、SDK はツール入力から自力で rational を読み取ることはありません:rationale がどのようにサーバーに到達するかは、このスキルが実装するサーバー側の規約です。 実戦で試されたパターンはスキーマインジェクション — すべてのツールの入力スキーマにオプションの rationale フィールドを追加します。パラメータがエージェントが既に読むスキーマ内に記述されているため、エージェントは促されることなく、すべてのクライアントで、クライアント側の変更ゼロでそれを記入します:

// すべてのツールの入力スキーマに追加(zod の例):
rationale: z
  .string()
  .optional()
  .describe(
    'このツールを呼び出している理由と、その結果から何を学べるかを簡単に説明してください。',
  ),

次に、インストルメントされたハンドラ内でそれを読み取り、SDK に渡します:

analytics.instrumentTool(async (args, extra) => {
  if (typeof args.rationale === 'string') {
    analytics.setRationale(args.rationale);
  }
  return doWork(args);
}, { name: 'search' });

フィールドをオプションにすることで、エージェントが省略した場合でも何も壊れません。これは予約済みプロパティ [MCP] Rationale として出力されます(1,000 文字に切り詰められ、最後の書き込みが優先されます)。サンプルだけでなく、すべてのツールで行う価値があります。

ステップ 4 — 外部リンクに UTM タグを付ける(推奨、サーバーが URL を返す場合のみ)

このステップは完全に SDK の外部にあります — サーバーが URL を構築する方法を変更し、製品の Web 側アナリティクスに依存します。SDK README ではカバーされていません。

ツールの応答にリンク(ダッシュボード、ドキュメント、製品ページ)が含まれている場合、サーバーから出る前にタグを付けて、クリックスルーが MCP/エージェントトラフィックに帰属され、ダイレクトとして表示されないようにします:

function addUtmParams(url: string, clientName?: string): string {
  const u = new URL(url);
  u.searchParams.append('utm_source', 'mcp');
  u.searchParams.append('utm_medium', 'referral');
  // 接続されているクライアント(例:「Claude」、「Cursor」)、わかっている場合:
  u.searchParams.append('utm_content', clientName ?? 'unknown');
  return u.toString();
}

ツール応答内のすべての URL 構築パスをこのような1つの中央関数に通します — タグ付けされていないリンクが1つあるだけで、そのフローの帰属ストーリーが壊れます。

前提条件(これをユーザーに明示的に伝えてください): これは、Web アナリティクスがページビューイベント(またはサイトがランディング時に発火するイベント)で UTM パラメータをキャプチャする場合にのみ機能します。Amplitude の Browser SDK 2 はデフォルトでこれを行います — Track marketing attribution を参照してください(UTM、リファラー、クリック ID パラメータは標準でキャプチャされます)。カスタムのページビュートラッカーを使用している場合、UTM 値がそれらのイベントにも届いていることを確認する必要があります。そうしないと、MCP タグ付きクリックを結合する対象がなくなります。

関連する Amplitude ドキュメント:

インストルメント後

イベントが流れ始めたら、コーディングエージェントを Amplitude の公開 analyze-mcp-server スキルに向けて、意図クラスタリングを実行し、ツールコールのエラーパターンを意図別に表面化させてください。(このプロジェクトに mcp-intent-error-analysis スキルがインストールされている場合、それが該当します — ユーザーがデータを流して分析したい場合にそれを使用し、ここでその分析を複製しないでください。)

よくある間違いのフラグ

  • 現在の README ではなく古い API スニペットに従う — 毎回取得し直してください。SDK はプレビュー版で急速に変化しています。
  • 最新リリースではなく固定/古いバージョンをインストールする。
  • server.connect() の後で instrumentServer() を呼び出す — 前である必要があります。
  • 一部のツールハンドラだけをラップし、他はラップしない — すべてのツールに instrumentTool が必要です。
  • Web/モバイルで使用されているものと一致しない user_id を送信する — 結合可能性を壊し、統合の目的全体を損ないます。
  • ユーザーの理解なしに emitAnonymousEvent: true をオンにすると、アンカーレストラフィックで集計カウントが水増しされます。
  • UTM の前提条件(Web 側のキャプチャ)を忘れて、リンクにタグを付けるだけで十分だと考えること。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

amplitude/builder-skills

Performs deep analysis of a specific Amplitude chart to explain trends, anomalies, and likely drivers. Use when a metric looks unusual, investigating a spike or drop, or understanding the "why" behind numbers.

amplitude/builder-skills

Deeply analyze Amplitude dashboards by analyzing key charts, surfacing top areas for concern and takeaways, identify anomalies, then explain changes using customer feedback trends.

amplitude/builder-skills

Designs A/B tests with proper metrics and variants, analyzes running or completed experiments, and interprets results with statistical rigor. Use when setting up experiments, checking experiment status, analyzing results, or making ship decisions.

amplitude/builder-skills

Synthesizes customer feedback into actionable themes including feature requests, bugs, pain points, and praise. Use when planning product roadmap, understanding user sentiment, investigating specific issues, or preparing voice-of-customer reports.

amplitude/builder-skills

Analyze MCP server usage instrumented with Amplitude's MCP Analytics SDK: break usage and errors down by tool, read the rationales within each tool to see what callers are trying to do, and produce a prioritized write-up of actionable fixes. Use this skill whenever the user asks to understand how their MCP server is being used, what agents/users are trying to do with it, why tool calls are failing, what to fix or improve in their MCP server, or asks for an "MCP usage report", "tool error analysis", "intent analysis", "rationale clustering", or "MCP insights". Also trigger when the user mentions [MCP]-prefixed events, tool rationale, tool call errors, or just finished instrumenting their MCP server and wants to see what the data says. Requires the Amplitude MCP connector.

amplitude/builder-skills

Read lost deals and churned accounts from your CRM, extract reasons clustered by theme (missing features, pricing, competitors, UX), and write a prioritized weekly analysis with product improvement recommendations. Use before roadmap planning or to build the case for prioritizing retention work.

amplitude/builder-skills

Creates Amplitude charts from natural language descriptions, handling event selection, filters, groupings, and visualization choices. Use when you know what you want to measure but prefer not to build the chart manually.

amplitude/builder-skills

Guide an Amplitude user through building a custom agent by suggesting use cases grounded in their role and data, shaping the idea into a well-formed spec, and generating a ready-to-run Global Agent deeplink that creates it. Use to create, build, or set up a custom agent, automate a recurring analysis, or put a repeated report on a schedule.

amplitude/builder-skills

Builds comprehensive Amplitude dashboards from requirements or goals, organizing charts into logical sections with appropriate layouts. Use when creating a complete dashboard from scratch or assembling existing charts into a cohesive view.

amplitude/builder-skills

Monitors all active and recently completed experiments across Amplitude projects, triages them by importance, then runs deep analysis and reporting on the most impactful ones. Use when the user asks to "check on experiments", "experiment status", "experiment review", "what experiments are running", or wants a periodic experiment health report.

amplitude/builder-skills

Pull Intercom tickets and Slack support messages from the past 7 days, classify each signal, enrich with CRM data (ARR, plan, renewal), score by customer value and churn risk, and output a tiered priority report saved to Drive. Use when you need a fast, data-driven view of what support signals matter most.

amplitude/builder-skills

Use this skill whenever a user wants to improve existing pages on their website to get cited more by AI models — whether they say "our pages aren't getting cited", "improve this page for AI visibility", "which of our pages should we update", "make this article more cite-worthy", "our competitors are getting cited instead of us", "update our content for AI search", or any variation where the goal is improving an existing asset rather than creating something new. This skill pulls owned pages from AI Visibility, identifies which ones have citation potential but are underperforming, compares them against the external pages that are winning citations on the same topics, and produces section-level rewrites or a full-page update — then pushes the revision to the CMS as a draft. Trigger even if the user just says "help me get cited more" or "why is [competitor] getting cited instead of us".

amplitude/builder-skills

Use this skill whenever a user wants to win AI citations on prompts that competitors currently dominate — whether they say "competitors are getting cited instead of us", "we're losing on these prompts", "how do I outrank [competitor] in AI answers", "find prompts where we should be winning", "create content to beat [competitor]", or any variation where the goal is capturing AI share on prompts a competitor currently owns. This skill pulls competitor visibility data from AI Visibility, identifies the specific prompts where competitors win and Amplitude is absent, clusters them by intent, and produces targeted comparison pages, alternatives content, or rebuttal assets — then pushes drafts to CMS. Trigger on any mention of competitor, prompt hijack, outrank, or "why is [competitor] getting cited instead of us".

amplitude/builder-skills

Use this skill whenever a user wants to turn AI Visibility data into published content — whether they say "find content gaps", "what should we write about", "which topics have low visibility", "help me get cited by AI models", "create a blog post from our AI Visibility gaps", "we're losing to competitors on these prompts", or any variation where they want to go from AI visibility weakness to a draft article, landing page, or FAQ. This skill connects directly to Amplitude AI Visibility data (topics, prompts, visibility scores, citations, competitor data, full LLM responses and sources) and produces a publish-ready content brief plus full article draft. If the user mentions CMS (WordPress, Webflow, Contentful, Sanity, HubSpot, Ghost, Shopify), also trigger this skill to push the draft directly. Trigger even if they just say something vague like "what content should we create?" in an AI Visibility context.

amplitude/builder-skills

Use this skill whenever a user wants to test content variants before publishing to find which one will get cited most by AI models — whether they say "which version of this content will perform better", "test this article before we publish", "simulate how AI will respond to this content", "which angle should we use", "generate content variants and pick the winner", "run a simulation before publishing", or any variation where the goal is data-driven content selection rather than gut-feel publishing. This skill takes an identified content opportunity, generates 2–3 distinct variants with different angles or structures, scores them against actual AI model responses from AI Visibility, references the Simulate Changes feature for pre-publish validation, and produces a clear recommendation on which variant to publish — then pushes the winner to CMS. Trigger on any mention of "simulate", "test variants", "which performs better", "A/B content", or "before we publish".

amplitude/builder-skills

Use this skill whenever a user wants to understand which external sources are being cited by AI models on topics relevant to their brand, and wants to create content that will outrank those sources — whether they say "what sources are AI models citing", "why is [third-party site] being cited instead of us", "we want to be the definitive source on X", "build something that gets cited more than G2 or TechRadar", "create an authoritative asset", or any variation where the goal is producing a new reference asset (definition page, benchmark, methodology, glossary, comparison hub) designed to beat existing top-cited sources. This skill analyzes AI Visibility source data, reverse-engineers what makes top-cited pages authoritative, and produces a superior source asset — then pushes it to CMS as a draft. Trigger on any mention of "sources", "third-party citations", "authoritative content", "definitional pages", or "outrank".

amplitude/builder-skills

Instruments a pull request with Amplitude analytics that conform to the project's existing taxonomy. Reads the tracking plan via the Amplitude MCP server (events, properties, naming conventions), analyzes the PR diff to find the few user actions genuinely worth tracking, detects the codebase's SDK and tracking patterns, and adds instrumentation that matches both. Optionally (opt-in) stages new events and properties on an Amplitude tracking-plan branch for data-governance review. Use when asked to "instrument this PR", "add analytics to this change", "add tracking", "add Amplitude events", "instrument this feature", or "what should I track here".

amplitude/builder-skills

Diagnoses product health by cross-referencing Amplitude analytics (dashboards, charts, funnels, feedback, AI agent analytics), optionally Datadog (errors, latency, stack traces), and optionally Slack (qualitative feedback, bug reports, feature requests). Identifies what's broken, what's working, and what to do about it — with root causes, not just symptoms. Use when asked to "diagnose my product", "what's going on", "product health check", "what's broken", "where are users struggling", "give me a product diagnosis", or "what should I focus on".

amplitude/builder-skills

Turn one or more meeting transcripts, notes, or Slack threads into concise takeaways and clear action items with DRIs. Works with a single meeting or a batch from the whole week.

amplitude/builder-skills

Summarizes B2B account health by analyzing usage patterns, engagement trends, risk signals, and expansion opportunities. Use for customer success reviews, renewal preparation, QBRs, or account prioritization.

関連スキル