Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsCommunityBlog
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

Back to skills

Retention Analysis

ASecurity

Analyze user retention and churn using survival analysis, cohort analysis, and machine learning. Calculate retention rates, build survival curves, predict churn risk, and generate retention optimization strategies. Use when working with user subscription data, membership information, or when user mentions retention, churn, survival analysis, or customer lifetime value.

281 stars
0 votes
0 copies
2 views
Added 2/7/2026
datapythonbashtesting

Security Analysis

A96/100
mediumInstalls packages at runtime which could introduce malicious dependencies

Scanned 2/12/2026

Install to Claude Code

$npx -y skills add liangdabiao/claude-data-analysis-ultra-main --skill retention-analysis --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Retention Analysis?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Retention Analysis
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/liangdabiao-retention-analysis/badge)](https://www.skillsdirectory.com/skills/liangdabiao-retention-analysis)

More formats (shields.io, HTML) on the badges page.

Download Zip
Files
SKILL.md
---
name: retention-analysis
description: Analyze user retention and churn using survival analysis, cohort analysis, and machine learning. Calculate retention rates, build survival curves, predict churn risk, and generate retention optimization strategies. Use when working with user subscription data, membership information, or when user mentions retention, churn, survival analysis, or customer lifetime value.
allowed-tools: Read, Write, Edit, Bash, Grep, Glob
---

# Retention Analysis Skill

Analyze user retention patterns, predict customer churn, and optimize retention strategies using advanced statistical methods and machine learning techniques.

## Quick Start

This skill helps you:
1. **Calculate retention rates** and churn metrics
2. **Build survival curves** using Kaplan-Meier analysis
3. **Perform cohort analysis** to understand behavior patterns
4. **Predict churn risk** with machine learning models
5. **Identify retention drivers** using Cox regression
6. **Generate actionable insights** for retention improvement

## When to Use

- **SaaS Product Analysis**: User subscription renewal and cancellation patterns
- **Membership Programs**: Member engagement and loyalty analysis
- **E-commerce**: Customer repeat purchase behavior and subscription boxes
- **Gaming Apps**: Player retention and engagement metrics
- **Service Industries**: Customer satisfaction and long-term relationships
- **Subscription Businesses**: Monthly/yearly subscription analysis

## Key Requirements

Install required packages:
```bash
pip install pandas numpy matplotlib seaborn scikit-learn lifelines
```

## Core Workflow

### 1. Data Preparation
Your data should include:
- **User identifiers**: Unique user/customer IDs
- **Time variables**: Registration date, activity dates, subscription period
- **Event indicators**: Churn status (1=churned, 0=active)
- **User attributes**: Demographics, behavior, subscription details
- **Optional**: Usage metrics, payment history, engagement data

### 2. Analysis Process
1. **Data preprocessing**: Clean and prepare retention data
2. **Survival analysis**: Build Kaplan-Meier curves
3. **Cohort analysis**: Group users by acquisition time
4. **Risk modeling**: Identify churn drivers with Cox regression
5. **Churn prediction**: Build machine learning prediction models
6. **Insight generation**: Create actionable recommendations

### 3. Output Deliverables
- Retention rate tables and charts
- Survival curves with confidence intervals
- Cohort heatmaps and behavior patterns
- Churn risk scores and feature importance
- Retention optimization strategies

## Example Usage Scenarios

### SaaS Subscription Analysis
```python
# Analyze monthly subscription renewal patterns
# Predict which users are likely to churn
# Identify features that drive long-term retention
```

### Membership Program Analysis
```python
# Track member engagement over time
# Compare retention across membership tiers
# Analyze payment method impact on retention
```

### E-commerce Customer Retention
```python
# Analyze repeat purchase patterns
# Calculate customer lifetime value
# Identify high-value customer segments
```

## Key Analysis Methods

### Survival Analysis
- **Kaplan-Meier Estimator**: Non-parametric survival curve
- **Log-rank Test**: Compare survival between groups
- **Cox Proportional Hazards**: Multi-variable risk modeling
- **Median Survival Time**: Time when 50% of users have churned

### Cohort Analysis
- **Time-based Cohorts**: Group by acquisition month/quarter
- **Behavior-based Cohorts**: Group by usage patterns
- **Retention Matrix**: Visualize retention over time periods
- **Cohort Comparison**: Compare different cohort behaviors

### Machine Learning Prediction
- **Logistic Regression**: Binary churn classification
- **Random Forest**: Non-linear pattern detection
- **Gradient Boosting**: High accuracy prediction
- **Feature Importance**: Identify key churn drivers

## Common Business Questions Answered

1. **What is our overall retention rate?**
2. **How does retention vary by user segment?**
3. **What factors most influence customer churn?**
4. **Which users are at highest risk of leaving?**
5. **How can we improve long-term retention?**
6. **What is the typical customer lifetime?**

## Integration Examples

See [examples/](examples/) directory for:
- `basic_retention.py` - Survival analysis basics
- `cohort_analysis.py` - Cohort-based retention analysis
- `churn_prediction.py` - ML-based churn prediction
- Sample datasets for testing

## Best Practices

1. **Data Quality**: Ensure accurate churn definitions and time measurements
2. **Event Definition**: Clearly define what constitutes "churn"
3. **Time Windows**: Choose appropriate analysis periods
4. **Segmentation**: Analyze different user groups separately
5. **Validation**: Always validate models with test data
6. **Business Context**: Consider operational constraints and costs

## Advanced Features

- **Competing Risks Analysis**: Different types of churn
- **Time-varying Covariates**: Dynamic feature analysis
- **Customer Lifetime Value**: Integrate retention with revenue
- **Retention Forecasting**: Predict future retention trends
- **A/B Testing**: Measure retention improvement impact

Attribution

liangdabiaoliangdabiao
View sourceMore from liangdabiao →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Rank Tracker

This skill helps you track, analyze, and report on keyword ranking positions over time. It monitors both traditional SERP rankings and AI/GEO visibility to provide comprehensive search performance insights.

1821 votes

Youtube Competitor Analyzer

Find and analyze YouTube competitor channels using YouTube Data API v3. Discover competitors through keyword search, category matching, content similarity, and related channel discovery. Compare metrics, content strategies, and market positioning. Use when users want to (1) Find competitors for their YouTube channel, (2) Analyze competitor performance metrics, (3) Compare their channel against competitors, (4) Identify content gaps and opportunities, (5) Benchmark against similar creators, (6...

31 votes

Twitter Algorithm Optimizer

Analyze and optimize tweets for maximum reach using Twitter's open-source algorithm insights. Rewrite and edit user tweets to improve engagement and visibility based on how the recommendation system ranks content.

742580 votes

Weather Fetcher

Instructions for fetching current weather temperature data for Karachi, Pakistan from wttr.in API

655280 votes

Weather

Get current weather and forecasts (no API key required).

476190 votes
View all in data →