Skill detail
add-analytics-instrumentation
End-to-end analytics instrumentation workflow for a PR, branch, file, directory, or feature. Reads the code, discovers what events should be tracked, and produces a concrete instrumentation plan — all in one shot. Use this skill whenever a user wants to add analytics to a PR, asks "instrument this…
Why we recommend it: Analytics instrumentation workflow is adjacent to TikTok Analytics, but codebase/product-analytics focused, not TikTok.
Inspect before use
Read the source instructions and check the requirements before you install this skill.
SKILL.md
The saved excerpt is a snapshot from when this skill was listed. The external source remains the complete and most current version.
--- name: add-analytics-instrumentation description: > End-to-end analytics instrumentation workflow for a PR, branch, file, directory, or feature. Reads the code, discovers what events should be tracked, and produces a concrete instrumentation plan — all in one shot. Use this skill whenever a user wants to add analytics to a PR, asks "instrument this PR", "add tracking to this branch", "what analytics does this file need", "instrument the checkout flow", "run the full instrumentation workflow", or any request that implies going from code changes to a tracking plan. Also trigger when the user gives you a PR link, branch name, file path, or feature description and mentions analytics, events, or instrumentation. This is the main entry point for the analytics workflow — prefer it over calling the individual steps (diff-intake, discover-event-surfaces, instrument-events) separately. --- # 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 type | How to recognize it | Example | | -------------------- | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------- | | **PR** | A PR URL, PR number, or phrases like "this PR", "my PR" | `instrument PR #42`, `https://github.com/org/repo/pull/42` | | **Branch** | A branch name or "this branch", "my branch", "current branch" | `instrument feature/checkout`, `add tracking to this branch` | | **File / Directory** | A file path, directory path, or glob pattern | `instrument src/components/Checkout.tsx`, `add analytics to src/payments/` | | **Feature** | A natural-language description of functionality, not a specific code reference | `instrument 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, juRead the full source on GitHub (opens external page)