From magic-powers
Map existing analytics SDK implementations in a codebase to understand naming conventions and instrumentation patterns. Uses mcp__Amplitude__get_event_properties.
npx claudepluginhub kienbui1995/magic-powers --plugin magic-powersThis skill uses the workspace's default tool permissions.
- Before adding new analytics instrumentation to an unfamiliar codebase
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
instrument-events needs to know the project's SDK style and naming conventionScan the codebase for analytics SDK usage:
Common SDKs to look for:
@amplitude/analytics-browser, amplitude-js, @amplitude/nodemixpanel-browser, mixpanel@segment/analytics-next, analytics.jsposthog-jsanalytics.ts, tracking.ts, events.ts, telemetry.tsSearch patterns:
import.*amplitude
import.*mixpanel
import.*segment
import.*analytics
require.*analytics
Find the initialization file: where is init() or load() called? What API key pattern is used? What default properties are set at init time?
Search for every place analytics events are sent:
Amplitude patterns:
amplitude.track('event_name', { prop: value })
amplitude.logEvent('event_name', { prop: value })
client.track({ event_type: 'event_name', event_properties: {} })
Generic patterns:
analytics.track('event_name', properties)
trackEvent('event_name', properties)
logEvent('event_name', properties)
sendEvent('event_name', properties)
Collect: file path, line number, event name, properties passed. Build a full inventory.
From the collected tracking calls, catalog:
Event names:
camelCase, snake_case, Title Case, kebab-case, or mixedProperty patterns:
Determine the single authoritative naming convention:
Dominant pattern: snake_case (found in 47/52 events)
Exceptions: 5 events use camelCase (legacy, pre-2024)
Recommendation: use snake_case for all new events
Document any caveats: some properties use camelCase even when event names use snake_case (common in mixed teams).
Universal properties (appear in >80% of events) — likely set via super properties or middleware:
// These are probably set once at init or login:
{
user_id: string,
platform: 'web' | 'ios' | 'android',
app_version: string,
environment: 'production' | 'staging'
}
Event-specific properties — only relevant for particular events. Catalog by category:
page_name, referrer_url, page_sectionbutton_label, element_id, interaction_typeitem_id, price, currency, quantityMost codebases wrap the raw SDK. Find:
Document the wrapper API so new instrumentation uses the same pattern, not the raw SDK.
Example finding:
// src/analytics/index.ts — use this, not amplitude directly
import { track } from '@/analytics';
track('checkout_completed', { order_id, total });
Produce an instrumentation guide:
instrumentation_guide:
sdk: "Amplitude Browser SDK v2"
entry_point: "src/analytics/index.ts"
naming_convention: snake_case
event_constants_file: "src/analytics/events.ts"
universal_properties:
set_at_init: [user_id, platform, app_version]
set_at_login: [user_plan, user_role, account_id]
example_call: |
import { track } from '@/analytics';
import { Events } from '@/analytics/events';
track(Events.CHECKOUT_COMPLETED, {
order_id: order.id,
total: order.totalAmount,
payment_method: order.paymentMethod,
});
type_definitions_file: "src/analytics/types.ts"
naming_inconsistencies:
- "legacy_click_event uses camelCase — do not follow this pattern"
mcp__Amplitude__get_event_properties — cross-reference discovered event names with Amplitude's recorded schema to verify events are actually reaching Amplitude and what properties Amplitude has recordedA YAML instrumentation guide with:
instrumentation_guide:
sdk: <SDK name and version>
entry_point: <file path to analytics module>
naming_convention: <snake_case|camelCase|Title Case>
event_constants_file: <file path or null>
universal_properties: {set_at_init: [...], set_at_login: [...]}
example_call: <code snippet showing correct usage>
type_definitions_file: <file path or null>
naming_inconsistencies: <list of exceptions to document>
total_events_found: <count>
After output, state: "Pattern documented. This guide is the style reference for instrument-events."