cohort-analysis
Scannednpx machina-cli add skill guia-matthieu/clawfu-skills/cohort-analysis --openclawFiles (1)
SKILL.md
3.4 KB
Cohort Analysis
Analyze retention and behavior patterns by grouping users into cohorts - understand how different customer groups behave over time.
When to Use This Skill
- Retention tracking - Measure how users stick around over time
- Acquisition analysis - Compare cohorts from different channels
- Product changes - Measure impact on user behavior
- Churn prediction - Identify at-risk cohorts
- LTV estimation - Project customer lifetime value
What Claude Does vs What You Decide
| Claude Does | You Decide |
|---|---|
| Structures analysis frameworks | Metric definitions |
| Identifies patterns in data | Business interpretation |
| Creates visualization templates | Dashboard design |
| Suggests optimization areas | Action priorities |
| Calculates statistical measures | Decision thresholds |
Dependencies
pip install pandas plotly click
Commands
Retention Analysis
python scripts/main.py retention data.csv --date-col signup --event-col purchase
python scripts/main.py retention data.csv --date-col signup --periods week
Visualize Cohorts
python scripts/main.py visualize cohorts.csv --output retention_chart.html
Export Report
python scripts/main.py report data.csv --date-col signup --event-col active --output report.html
Examples
Example 1: Analyze User Retention
python scripts/main.py retention users.csv --date-col signup_date --event-col last_active
# Output:
# Cohort Retention Analysis
# ──────────────────────────────────
# Cohort Users M1 M2 M3 M4
# Jan 2024 1,234 65% 48% 42% 38%
# Feb 2024 1,456 62% 45% 41% --
# Mar 2024 1,321 68% 52% -- --
# Apr 2024 1,567 64% -- -- --
#
# Avg Retention: 65% → 48% → 42% → 38%
# Best Cohort: Mar 2024 (68% M1)
Example 2: Generate Visual Report
python scripts/main.py report transactions.csv \
--date-col signup \
--event-col purchase_date \
--output retention_report.html
# Generates interactive HTML with:
# - Retention heatmap
# - Cohort size chart
# - Trend analysis
Cohort Table Format
| Cohort | Size | Period 0 | Period 1 | Period 2 | Period 3 |
|---|---|---|---|---|---|
| 2024-01 | 1234 | 100% | 65% | 48% | 42% |
| 2024-02 | 1456 | 100% | 62% | 45% | - |
| 2024-03 | 1321 | 100% | 68% | - | - |
Skill Boundaries
What This Skill Does Well
- Structuring data analysis
- Identifying patterns and trends
- Creating visualization frameworks
- Calculating statistical measures
What This Skill Cannot Do
- Access your actual data
- Replace statistical expertise
- Make business decisions
- Guarantee prediction accuracy
Related Skills
- ab-test-stats - Test retention experiments
- funnel-analyzer - Analyze conversion funnels
Skill Metadata
- Mode: centaur
category: analytics
subcategory: retention
dependencies: [pandas, plotly]
difficulty: intermediate
time_saved: 4+ hours/week
Source
git clone https://github.com/guia-matthieu/clawfu-skills/blob/main/skills/analytics/cohort-analysis/SKILL.mdView on GitHub Overview
Cohort analysis groups users by shared attributes (like signup date or channel) to reveal how retention and behavior evolve over time. This helps you measure retention, understand lifecycle patterns, compare cohorts across acquisitions, and flag churn risks for proactive optimization.
How This Skill Works
Define cohorts (e.g., by signup_date) and compute period-based retention (Period 0, 1, 2, etc.) for each cohort using pandas, producing retention tables and visualizations. Use the provided CLI commands to run retention analysis, visualize cohorts, and export a report for sharing with stakeholders.
When to Use It
- Retention tracking
- Acquisition analysis
- Product changes
- Churn prediction
- LTV estimation
Quick Start
- Step 1: Retention analysis - python scripts/main.py retention data.csv --date-col signup --event-col purchase
- Step 2: Visualize cohorts - python scripts/main.py visualize cohorts.csv --output retention_chart.html
- Step 3: Export report - python scripts/main.py report data.csv --date-col signup --event-col active --output report.html
Best Practices
- Define cohorts using meaningful attributes (e.g., signup date and channel) so comparisons are actionable
- Use consistent time buckets (week or month) and a fixed baseline for all cohorts
- Ensure inputs include required date and event columns and align column names
- Clean data before analysis (deduplicate records, fix missing dates, normalize formats)
- Compare multiple cohorts over the same horizon to identify drivers and trends
Example Use Cases
- An e-commerce app tracks retention by signup month to identify onboarding or channel effects on long-term engagement
- A SaaS product compares cohorts from organic vs paid channels to optimize acquisition spend
- A product team measures the impact of a feature release on subsequent engagement across cohorts
- Churn risk is detected by cohorts showing rapidly declining retention curves
- LTV is estimated by projecting revenue from observed cohort retention patterns
Frequently Asked Questions
Add this skill to your agents