mixpanel-analytics
MixPanel analytics tracking implementation and review Skill for Django4Lyfe optimo_analytics module. Implements new events following established patterns and reviews implementations for PII protection, schema design, and code quality.
When & Why to Use This Skill
This Claude skill automates the end-to-end lifecycle of MixPanel analytics tracking within Django applications, specifically optimized for the optimo_analytics module. It streamlines the implementation of new tracking events—from schema definition to test creation—while providing rigorous automated reviews to ensure PII protection, schema consistency, and adherence to architectural standards.
Use Cases
- Standardized Event Implementation: Use the /implement command to guide the creation of new MixPanel events through a 7-step checklist, ensuring all constants, schemas, and service helpers are correctly defined.
- PII & Privacy Auditing: Automatically scan code for Personally Identifiable Information (PII) violations to ensure sensitive data like emails or addresses are never sent to MixPanel.
- Automated Code Review: Run /review on staged changes or feature branches to verify schema design, naming conventions, and service layer patterns before merging.
- Data Integrity & Testing: Generate and audit test coverage for analytics events to ensure that tracking logic is robust and doesn't break core business workflows.
- Legacy Code Refactoring: Audit the entire analytics module to identify and fix inconsistent event naming or outdated timestamp formats.
| name | mixpanel-analytics |
|---|---|
| description | "Mixpanel analytics tracking implementation + review skill for Django optimo_analytics: add events and audit for PII safety, schema design, and code quality." |
| allowed-tools | Bash Read Edit Write Glob Grep |
MixPanel Analytics Skill
When to Use This Skill
Use this Skill in the Django4Lyfe backend when working with MixPanel analytics
tracking in the optimo_analytics module:
/mixpanel-analytics:implement– to implement new MixPanel tracking events or update existing ones following established patterns (7-step checklist)./mixpanel-analytics:review– to review MixPanel implementations for correctness, PII protection, and adherence to Django4Lyfe standards.
Example Prompts
Implement Mode
- "Use
/mixpanel-analytics:implementto add a new event for tracking when a user completes their profile setup." - "Run
/mixpanel-analytics:implement svc.surveys.reminder_sentto add tracking for survey reminder notifications." - "Implement MixPanel tracking for the new HRIS CSV validation feature using
/mixpanel-analytics:implement."
Review Mode
- "Run
/mixpanel-analytics:review stagedto check my staged MixPanel changes for PII violations and pattern compliance." - "Use
/mixpanel-analytics:review branchto audit all analytics changes on this feature branch." - "Review the entire optimo_analytics module with
/mixpanel-analytics:review all."
Modes
This Skill behaves differently based on how it is invoked:
implementmode – invoked via/mixpanel-analytics:implement:- Guides implementation of new MixPanel events through 7 steps.
- Creates constants, schemas, registry entries, service methods, and tests.
- Enforces PII protection and code patterns.
reviewmode – invoked via/mixpanel-analytics:review:- Audits existing implementations for compliance.
- Checks PII protection, schema design, service patterns, and test coverage.
- Generates structured review reports with severity tags.
Environment & Context Gathering
When this Skill runs, gather context first:
# Git context
git branch --show-current
git status --porcelain
git diff --cached --name-only | grep -E "optimo_analytics|mixpanel"
# Analytics module stats
grep -c "^ [A-Z_]* = " optimo_analytics/constants.py 2>/dev/null || echo "0"
grep -c "^class Mxp" optimo_analytics/schemas.py 2>/dev/null || echo "0"
grep -c "MixPanelEvent\." optimo_analytics/registry.py 2>/dev/null || echo "0"
ls -1 optimo_analytics/service/*.py 2>/dev/null | xargs -I{} basename {} .py
Read key reference files:
optimo_analytics/AGENTS.md– module-level rules and PII guidelinesoptimo_analytics/schemas.py– existing schema patternsoptimo_analytics/service/AGENTS.md– service layer patternsoptimo_analytics/tests/AGENTS.md– test patterns
Implementation Mode
For the full templates and step-by-step implementation checklist, use:
Checklist (summary):
- Add event constant (
optimo_analytics/constants.py) - Create schema (
optimo_analytics/schemas.py) - Register schema (
optimo_analytics/registry.py) - Add tracking helper (
optimo_analytics/service/{domain}.py) - Export helper (
optimo_analytics/service/__init__.py) - Add tests (
optimo_analytics/tests/) - Integrate call site in business logic
Critical Rules (Do Not Violate)
- PII: never send names/emails/phones/addresses; identifiers are UUID strings;
organization_nameis allowed but never logged. - Fire-and-forget: keyword-only args + try/except wrapper; never let tracking break business logic.
- Event names:
{prefix}.{object}.{action}[.error]; do not encode execution context (e.g., "cron") in the event name. - distinct_id: user UUID →
org_<org_uuid>→slack_/apikey_/webhook_; never a raw org UUID. - Timestamps: Unix ms (
datetime_to_timestamp_ms()), not ISO strings. is_cron_job: only when tracking-time must align with the original action; includecron_execution_timestampwhen set.
Review Mode
For the full checklist, automated checks, and report template, use:
Summary checklist:
- [P0] PII protection
- [P1] Event registration completeness
- [P1] Schema design + types
- [P1] Service method patterns
- [P2] Test coverage
- [P2] Naming, timestamps,
is_cron_job, distinct_id, exports
References
- Implementation templates: references/implementation.md
- Review checklist + report template: references/review.md
Compatibility Notes
This Skill is designed to work with both Claude Code and OpenAI Codex.
- Claude Code: install the corresponding plugin and use its slash commands (see
plugins/mixpanel-analytics/commands/). - Codex: install the Skill directory and invoke
name: mixpanel-analytics.
For installation, see this repo's README.md.