add-analytics-instrumentation

द्वारा amplitude

PR, branch, file, directory या feature के लिए एंड-टू-एंड analytics instrumentation workflow। कोड पढ़ता है, पता लगाता है कि किन events को track किया जाना चाहिए, और एक ठोस instrumentation plan तैयार करता है—वह भी एक ही बार में। जब भी कोई उपयोगकर्ता PR में analytics जोड़ना चाहे, पूछे “इस PR को instrument करो”, “इस branch में tracking जोड़ो”, “इस file के लिए कौन-से analytics चाहिए”, “checkout flow को instrument करो”, “पूरा instrumentation workflow चलाओ”, या ऐसा कोई अनुरोध करे जिसका आशय कोड से आगे बढ़कर... हो, तो इस skill का उपयोग करें।

npx skills add https://github.com/amplitude/mcp-marketplace --skill add-analytics-instrumentation

add-analytics-instrumentation

You are the orchestrator for the analytics instrumentation pipeline. Your job is to figure out what the user wants to instrument, gather the relevant code, and run the pipeline to produce a tracking plan.

Pipeline

Step 0: Capture intent

Before running anything, determine what the user wants to instrument. There are four input types — infer the type from what the user has already provided in the conversation. Only ask if it's genuinely ambiguous.

Input typeHow to recognize itExample
PRA PR URL, PR number, or phrases like "this PR", "my PR"instrument PR #42, https://github.com/org/repo/pull/42
BranchA branch name or "this branch", "my branch", "current branch"instrument feature/checkout, add tracking to this branch
File / DirectoryA file path, directory path, or glob patterninstrument src/components/Checkout.tsx, add analytics to src/payments/
FeatureA natural-language description of functionality, not a specific code referenceinstrument the onboarding flow, add tracking to the checkout experience

Inference rules:

  • If the user provided a URL or #number → PR
  • If the user provided something that looks like a branch name (contains /, no file extension, matches a git branch) → Branch
  • If the user provided a path that exists on disk (file or directory) → File / Directory
  • If none of the above match and the input is descriptive → Feature
  • If the conversation already contains a PR link, branch name, or file path from earlier messages, use that instead of asking again

If ambiguous, ask the user:

What would you like to instrument?

  1. A specific file or directory
  2. A PR
  3. A branch
  4. A feature (describe it and I'll find the relevant code)

Once you know the input type, proceed to the appropriate step:

  • PR or Branch → go to Step 1 (diff-intake)
  • File / Directory → go to Step 1a (direct file read)
  • Feature → go to Step 1b (feature search)

Step 1: diff-intake skill (PR or Branch)

Invoke the diff-intake skill with the user's PR or branch reference.

It produces a change_brief YAML block.

Capture the full YAML output — step 2 consumes it verbatim. Skip to Step 2.

Step 1a: Direct file read (File / Directory)

Skip diff-intake entirely — there's no diff to analyze. Instead, build the change_brief YAML yourself by reading the files directly.

  1. Resolve the input. If a directory, find all source files in it (skip tests, config, lock files, generated code). If a single file, just use that.
  2. Read each file and summarize what it does — focus on user-facing behavior, not implementation details.
  3. Scan for existing instrumentation using the same patterns as diff-intake: track(, trackEvent(, logEvent(, amplitude.track(, ampli., and analytics-related imports.
  4. Build the change_brief YAML with analytics_scope: high (the user explicitly asked to instrument these files, so assume they want tracking). Set primary: feat and classification.types: [feat]. Populate file_summary_map with each file's summary, layer, and existing instrumentation.

Proceed to Step 2 with the YAML you built.

Step 1b: Feature search (Feature)

The user described a feature in natural language. Your job is to find the relevant code, then build a change_brief.

  1. Search git commit history to find related commits. Use git log --all --grep="<patterns>". This will find relevant commits. Then read the git commit body to understand the feature and relevant files. If the results are good, then proceed to generating the change_brief YAML
  2. Search the codebase for files related to the described feature. Use a combination of:
    • Grep for keywords from the feature description (component names, route paths, function names, domain terms)
    • Glob for likely file paths (e.g., **/checkout/**, **/onboarding/**)
    • Read route definitions, navigation configs, or index files to find entry points
  3. Build the change_brief YAML.

Proceed to Step 2 with the YAML you built.

Step 2: discover-event-surfaces

Invoke the discover-event-surfaces skill, passing the change_brief YAML from step 1.

It produces an event_candidates YAML block. If there are zero candidates, stop and tell the user the change has user-facing impact but no events worth instrumenting were identified.

If event_candidates is empty, stop here and tell the user there's nothing to instrument.

Capture the full YAML output — step 3 consumes it.

Step 3: instrument-events

Invoke the instrument-events skill, passing the event_candidates YAML from step 2.

It produces a trackingPlan JSON with exact file locations, tracking code, and property definitions for every critical (priority 3) event.

Presenting the result

After step 3 completes, present the tracking plan to the user. Walk through each event briefly:

  • What it tracks and why it matters
  • Which Amplitude project(s) it routes to (appId/appIds) — call this out when the repo has an .amplitude/instrumentation-agent.yaml and events span more than one project
  • Where the tracking call goes (file + function)
  • What properties it sends

Then ask if they want to adjust anything or proceed to implementation.

Error handling

If any step fails (e.g., the PR doesn't exist, git commands error, no files to analyze), surface the error clearly and stop. Don't try to continue with incomplete data.

amplitude की और Skills

diff-intake
amplitude
PR या branch diff पढ़ता है और downstream analytics instrumentation skills के लिए एक संरचित YAML change brief तैयार करता है। जब भी कोई उपयोगकर्ता PR लिंक, branch comparison या raw diff साझा करे और यह समझना चाहे कि क्या बदला, किसकी tracking ज़रूरी है या किसी feature को instrument कैसे करना है, तो इसे पहले चरण के रूप में इस्तेमाल करें। “इस PR की समीक्षा करें”, “इस branch में क्या बदला”, “इस diff को instrument करने में मेरी मदद करें”, “इस बदलाव के लिए analytics coverage जाँचें” जैसे वाक्यांशों या analytics review शुरू करने के किसी भी अनुरोध पर सक्रिय करें...
developmentcode-reviewdata-analysis
discover-analytics-patterns
amplitude
पता लगाता है कि इस कोडबेस में एनालिटिक्स ट्रैकिंग कॉल वास्तव में कैसे लिखे गए हैं—इवेंट भेजने के लिए उपयोग किए गए ठोस SDK कॉल, फ़ंक्शन सिग्नेचर और इम्पोर्ट पैटर्न। इस स्किल का उपयोग तब करें जब आपको नई ट्रैकिंग जोड़ने से पहले मौजूदा एनालिटिक्स इंस्ट्रूमेंटेशन पैटर्न समझने हों, जब कोई पूछे कि “यहाँ इवेंट कैसे ट्रैक करते हैं?”, “एनालिटिक्स सेटअप दिखाएँ”, “इस कोडबेस में एनालिटिक्स का पैटर्न क्या है?”, या जब भी instrument-events या discover-event-surfaces स्किल्स इस बारे में हों...
developmentdata-analysisapi
discover-event-surfaces
amplitude
एक change_brief YAML (diff-intake का आउटपुट) लेकर, इंस्ट्रूमेंट करने के लिए संभावित analytics events की एक विस्तृत सूची तैयार करता है। यह PM की सोच रखने वाले इंजीनियर का दृष्टिकोण अपनाता है—विचार करने योग्य हर चीज़ सामने रखता है, ताकि PM तय कर सके कि वास्तव में क्या मायने रखता है। इसे analytics instrumentation workflow के चरण 2 के रूप में इस्तेमाल करें, ठीक उसके बाद जब diff-intake एक change_brief तैयार करे। जब भी किसी उपयोगकर्ता के पास change_brief YAML हो और वह जानना चाहे कि कौन-से analytics events जोड़ने हैं, या पूछे “क्या...
data-analysisproductivitydevelopment
instrument-events
amplitude
discover-event-surfaces से प्राप्त event_candidates YAML को लेकर, priority-3 (critical) इवेंट्स के लिए एक ठोस instrumentation plan तैयार करता है। Software Architect की तरह काम करते हुए, कोडबेस में मौजूदा analytics patterns खोजता है, hinted files पढ़कर पता लगाता है कि कौन-से variables scope में हैं, chart के लिए उपयोगी न्यूनतम properties डिज़ाइन करता है और हर tracking call के लिए सटीक insertion point पहचानता है। एक संरचित JSON trackingPlan आउटपुट करता है। इसे analytics instrumentation के चरण 3 के रूप में उपयोग करें...
developmentdata-analysisapi
taxonomy
amplitude
Amplitude में इवेंट टैक्सोनॉमी जनरेशन, डेटा ऑडिटिंग और गवर्नेंस की सर्वोत्तम प्रथाओं के लिए सत्य का स्रोत। इसका उपयोग तब करें जब किसी एजेंट को इवेंट ट्रैकिंग योजनाएँ, नामकरण परंपराएँ, प्रॉपर्टी मानक, डेटा गुणवत्ता या अप्रचलन वर्कफ़्लो बनाने, मान्य करने, ऑडिट करने, स्कोर करने या उनमें सुधार सुझाने की आवश्यकता हो—इसमें किसी योजना की ग्राहक के अपने मानक (Data → Settings naming conventions और AI Context) के विरुद्ध जाँच करना भी शामिल है। इसमें नामकरण नियम, प्रॉपर्टी मानक, स्कोरिंग फ़्रेमवर्क, सुरक्षित मेटाडेटा... शामिल हैं।
data-analysisproductivityapi