skills/product-tracking-audit-current-tracking/SKILL.md
Reverse-engineer the current state of analytics tracking from a codebase. Scans for SDK calls, identity management, and instrumentation patterns to produce a factual inventory — not recommendations. Outputs .telemetry/current-state.yaml and a timestamped audit report. Use when the user wants to know what's currently tracked, audit existing analytics, capture tracking reality before designing a new plan, 'what analytics do we have,' 'what events are tracked,' 'scan for tracking,' or 'tracking inventory.'
npx skillsauth add accoil/product-tracking-skills product-tracking-audit-current-trackingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a product telemetry engineer capturing the current state of tracking in a codebase. Your job is to describe reality — not judge it, not recommend fixes, not design the ideal state.
| File | What it covers | When to read |
|------|---------------|--------------|
| references/output-formats.md | Templates for all output files | Writing current-state.yaml, audit report, current-implementation.md |
| references/sdk-comparison.md | Side-by-side SDK differences | Identifying which SDK is in use |
| references/implementation-architecture.md | Centralized definitions, queue-based delivery | Understanding instrumentation patterns |
| references/anti-patterns.md | PII in properties, noise events, redundancy | Noting hygiene issues (but not recommending) |
| references/common-mistakes.md | 19 frequent instrumentation mistakes | Identifying patterns in findings |
| references/identity-and-groups.md | Identify/group call patterns | Checking identity management |
| references/segment.md | Segment SDK specifics | Auditing Segment implementation |
| references/amplitude.md | Amplitude SDK specifics | Auditing Amplitude implementation |
| references/mixpanel.md | Mixpanel SDK specifics | Auditing Mixpanel implementation |
| references/posthog.md | PostHog SDK specifics | Auditing PostHog implementation |
| references/accoil.md | Accoil integration specifics | Auditing Accoil implementation |
Produce a current-state tracking plan — a reverse-engineered description of what's actually tracked in the codebase. This is a factual inventory, not a gap analysis.
Output: .telemetry/current-state.yaml + .telemetry/audits/YYYY-MM-DD.md
Check before starting:
.telemetry/ folder — If it doesn't exist, create it: mkdir -p .telemetry/audits.telemetry/product.md — If this file exists, read it for product context (entity model, feature areas) to make the audit more targeted. If it doesn't exist, proceed anyway — the audit can run without it, but suggest: "No product model found. Consider running the product-tracking-model-product skill first for richer context (e.g., 'model this product') — but I can audit the codebase without it."Context inheritance: Read .telemetry/product.md first if it exists. Present what you found as confirmation, not as new questions: "From the product model, I see this is a [language] [framework] codebase targeting [destinations]. Using [language]-appropriate detection patterns." Only ask if something is missing or ambiguous.
This phase is deliberately non-judgmental. The outputs should read like a census, not a report card.
Why? The audit is an input to design. Design decides what should change. Separating observation from judgement keeps the audit reusable and unbiased.
Ask which SDK is used, or detect automatically:
Segment: analytics.track(, analytics.identify(, analytics.group(
Amplitude: amplitude.track(, amplitude.setUserId(, logEvent(
Mixpanel: mixpanel.track(, mixpanel.identify(, mixpanel.people.set(
PostHog: posthog.capture(, posthog.identify(
Generic: track(, trackEvent(, logEvent(
Greenfield shortcut: If no analytics SDK is detected in dependencies and no tracking calls are found in the codebase, this is a greenfield project. Skip the full audit process and produce a minimal current-state file:
# Current State: greenfield (no tracking detected)
# Scanned: YYYY-MM-DD
# SDK: none
events: []
identity:
identify_calls: []
group_calls: []
patterns:
naming_style: n/a
centralized: n/a
Write this to .telemetry/current-state.yaml, note "Greenfield — no existing tracking detected" in conversation, and suggest proceeding directly to the product-tracking-design-tracking-plan skill (e.g., "design tracking plan"). No audit report file is needed.
Skip .telemetry/current-implementation.md for greenfield projects — there's no implementation to describe.
If an SDK is detected, read the matching SDK reference before proceeding with the full audit.
Scan the codebase systematically:
# Adjust pattern for detected SDK
rg "analytics\.(track|identify|group|page)" --type js --type ts -n
For each tracking call, extract:
This step is mandatory. For every event definition found, verify it is actually called somewhere in the codebase:
Search for imports and call sites of each event function. Do not assume an event is live just because it is defined. Many codebases accumulate dead event definitions over time.
Report the LIVE/ORPHANED status for every event. Summarize orphan counts by domain at the end of the audit.
Look for:
identify() calls — where, when, what traitsgroup() calls — where, when, what traitspage() / screen() calls — if presentFor B2C products, group() calls may not exist — this is expected, not a gap. Focus on identify() and event patterns.
Build the reverse-engineered tracking plan in .telemetry/current-state.yaml. See references/output-formats.md for the full YAML template. The file captures events (with name, status, locations, properties), identity management calls, and observed patterns.
Record factual observations about patterns:
button_clicked in different files with different property shapes"These are observations, not recommendations. State the fact, not the fix.
Document how analytics is currently wired — not what events are tracked (that's in current-state.yaml), but how the SDK is set up and calls are routed. Write this to .telemetry/current-implementation.md. This is a standalone file that the product-tracking-generate-implementation-guide skill will read as input.
Capture (as factual observations):
This is the same non-judgmental framing as the rest of the audit. Describe how it works, not whether it's right. See references/output-formats.md for the full template.
Produce a human-readable summary alongside the YAML.
Detailed templates for all output files are in references/output-formats.md.
.telemetry/current-state.yaml — Machine-readable reverse-engineered tracking plan. Events with names, status (LIVE/ORPHANED), locations, properties. Identity management. Observed patterns.
.telemetry/audits/YYYY-MM-DD.md — Human-readable audit report with event inventory table, identity management summary, observed patterns, and hygiene notes.
.telemetry/current-implementation.md — How analytics is currently wired: SDK version, initialization, client vs server, call routing, identity management, env vars, error handling, shutdown/flush.
Describe, don't prescribe. State what exists. Don't say what should exist — that's design's job. Never use checkmarks, warning icons, "Strong", "Gaps", or "Recommendations" framing. If you find yourself writing "should" or "missing", rephrase as an observation.
Be exhaustive. Find every tracking call. A missed event is a wrong census.
Verify every event is live. For each event definition, confirm it is actually called. Mark as LIVE or ORPHANED. This is not optional — orphan detection is a core audit deliverable.
Preserve exact names. Record event names exactly as they appear in code, including casing and formatting. Don't normalize them.
Note properties observed. Record actual property keys as a YAML list: properties: [key1, key2]. Do not use shorthand like { key1, key2 } — the output must be valid, parseable YAML.
Infer categories loosely. You can tag events with inferred categories (lifecycle, core_value, etc.) to help organize the inventory, but mark these as inferred.
Can be rerun cheaply. The audit should be fast to re-execute. If the codebase changes, just run it again.
Don't read the tracking plan. The audit captures reality independent of any ideal. If .telemetry/tracking-plan.yaml exists, don't compare against it — that comparison happens in design.
Write to files, summarize in conversation. Write detailed event inventories to the output files. Show only a concise summary in conversation (event counts, key patterns, orphan stats). Never paste more than 20 lines of raw data into the chat.
One audit report, one location. Output goes to .telemetry/audits/YYYY-MM-DD.md only. Do not create duplicate files at other paths.
Present decisions, not deliberation. Reason silently. The user should see findings, not your search process.
Describe what works. The current implementation section should highlight patterns worth preserving, not just document everything. If the existing implementation uses a clean centralized wrapper, note it — the implementation guide should build on what works rather than starting from scratch.
Note group hierarchy potential. If the codebase reveals entity relationships (accounts → workspaces → projects), note which analytics systems handle group hierarchy well (Segment, Mixpanel, and PostHog support multi-level groups natively; Amplitude requires workarounds). This observation helps the design phase choose the right architecture.
| SDK | Pattern | Package | Reference |
|-----|---------|---------|-----------|
| Segment | analytics.track( | @segment/analytics-node, @segment/analytics-next | references/segment.md |
| Amplitude | amplitude.track(, logEvent( | @amplitude/analytics-browser, @amplitude/analytics-node | references/amplitude.md |
| Mixpanel | mixpanel.track( | mixpanel-browser, mixpanel | references/mixpanel.md |
| PostHog | posthog.capture( | posthog-js, posthog-node | references/posthog.md |
| Accoil | Via Segment or direct API | @segment/analytics-node | references/accoil.md |
Read the matching guide before auditing — each SDK has different identity management, group calls, and configuration patterns.
Adapt detection patterns to the codebase language. The patterns above use JavaScript conventions. Read .telemetry/product.md for the tech stack, then adjust:
Gemfile for analytics-ruby, segment, ahoy_matey, posthog-ruby. Search for Analytics.track(, Ahoy.track(.requirements.txt / pyproject.toml for analytics-python, posthog, mixpanel, amplitude-analytics. Search for analytics.track(, posthog.capture(.go.mod for analytics SDKs. Search for SDK-specific method calls.pom.xml / build.gradle for analytics dependencies.model → audit → design → guide → implement ← feature updates
^
After audit, suggest the user run:
development
Build a structured product model by scanning the codebase and talking to the user. Produces .telemetry/product.md — a description of what the product does, who uses it, how value flows, and what entities exist. Use when starting telemetry work on a new codebase, when the user asks to 'model this product,' 'understand this product,' 'what does this product do,' 'map the product,' 'product model,' or when no .telemetry/product.md exists yet. This is the entry point for the telemetry lifecycle.
documentation
Update the tracking plan when a feature ships, changes, or is removed. Assesses whether new events are needed, extends existing events with properties where possible, and produces a versioned mini-delta with changelog entry. Updates .telemetry/tracking-plan.yaml, delta.md, and changelog.md. Use when the user ships a new feature, modifies existing functionality, wants to keep tracking coherent as the product evolves, 'feature shipped,' 'new feature tracking,' 'update tracking for [feature],' 'what tracking does this feature need,' or 'instrument new feature.'
development
Generate real instrumentation code from the tracking plan and instrumentation guide. Produces typed SDK wrapper functions, identity management, and integration guidance. Outputs files in a tracking/ directory. Use when the user wants to generate or regenerate tracking code, implement the delta plan, turn the instrumentation guide into working code, 'implement tracking,' 'generate code,' 'create tracking module,' or 'build analytics SDK wrapper.'
tools
Translate a tracking plan into an SDK-specific instrumentation guide. Shows how to make identify, group, and track calls using the target analytics SDK with real template code, architecture guidance, and constraint documentation. Outputs .telemetry/instrument.md. Covers 24 analytics destinations across product analytics, CDPs, web analytics, error monitoring, feature flags, and session tools. Use when the user has a tracking plan and needs to know how to implement it with a specific SDK like Segment, Amplitude, Mixpanel, PostHog, Accoil, Google Analytics, Sentry, LaunchDarkly, or via generic HTTP POST. Also use when user asks 'create instrumentation guide,' 'how to implement tracking,' 'SDK guide,' or 'generate implementation guide.'