Automating Customer Success
Build a customer success system with health scores, churn prediction, automated outreach, and lifecycle tracking to retain and grow accounts.
What customer success means for SaaS businesses
Customer success is the practice of ensuring your customers achieve their desired outcomes using your product. It is proactive, not reactive — you reach out before customers have problems, not after they cancel. The economics are stark: acquiring a new customer costs 5 to 25 times more than retaining an existing one. A 5 percent improvement in retention can increase profits by 25 to 95 percent. Yet most startups spend 90 percent of their effort on acquisition and 10 percent on retention. A customer success system automates the repetitive parts of retention — tracking engagement, identifying at-risk accounts, and triggering the right communication at the right time. Ask Claude Code: Create a Next.js project with TypeScript, Tailwind, and Prisma for a customer success platform. Define the database schema. Customer (id, companyName, contactName, contactEmail, plan, mrr as monthly recurring revenue in pence, signedUpAt, lastActiveAt, healthScore as integer 0 to 100, lifecycleStage as onboarding or active or at_risk or churning or churned, metadata as JSON for custom fields). Activity (id, customerId, type as login or feature_used or support_ticket or payment or milestone, description, timestamp, properties as JSON). HealthScoreHistory (id, customerId, score, calculatedAt, components as JSON storing the breakdown). CommunicationLog (id, customerId, type as email or call or meeting, subject, body, sentAt, openedAt optional, repliedAt optional, triggeredBy as manual or automated). Seed with 50 sample customers with varied health scores, plans, and activity patterns. Ask Claude Code: Generate realistic customer data spanning 6 months of activity. Include customers at every lifecycle stage and health level to test the dashboard thoroughly.
Building the health score system
A customer health score is a single number (0 to 100) that summarises how likely a customer is to stay. It combines multiple signals into an actionable metric. Ask Claude Code: Create a health score engine at src/lib/health-score.ts. The score is a weighted average of five components. Product Usage (30 percent weight): how actively the customer uses your product. Calculate from login frequency (daily active ratio over the last 30 days), feature breadth (percentage of key features used at least once), and depth (time spent per session). Score 0 to 100 where daily usage of most features is 100 and no logins in 14 days is 0. Support Health (20 percent weight): the sentiment and volume of support interactions. Low ticket volume with fast resolution is healthy (score 80 to 100). High ticket volume or unresolved tickets is unhealthy (score 0 to 40). No support contact at all is neutral (score 50). Engagement (20 percent weight): how the customer interacts beyond product usage. Attending webinars, responding to emails, joining the community, and providing feedback are positive signals. Growth (15 percent weight): is the customer expanding usage? Increasing seat count, upgrading plans, or adding integrations are positive. Decreasing usage or downgrading is negative. Payment Health (15 percent weight): are payments on time? Failed payments, past-due invoices, or declined cards reduce this score. Ask Claude Code: Implement the scoring function. Calculate each component from the customer's activity data over the last 30 days. Apply the weights. Round to an integer. Store the score and its component breakdown in HealthScoreHistory. Run the scoring daily for all customers. Classify customers: 80 to 100 is Healthy (green), 60 to 79 is Neutral (yellow), 40 to 59 is At Risk (orange), and 0 to 39 is Critical (red). When a customer's score drops more than 15 points in a week, trigger an alert. Common error: health scores need calibration. If 80 percent of your customers score above 90, the scale is too generous and fails to differentiate. Adjust the weights and thresholds until the distribution roughly matches your actual retention data.
Churn prediction and risk identification
The best time to prevent churn is weeks before the customer is thinking about cancelling. Churn prediction identifies the warning signs early enough to intervene. Ask Claude Code: Create a churn prediction system at src/lib/churn-prediction.ts. Define churn indicators — patterns that historically precede cancellation. Login frequency decline: if a customer who logged in 5 times per week is now logging in once per week, that is a 80 percent drop. Feature abandonment: a customer stops using a feature they previously used regularly. Support escalation: multiple support tickets in a short period, especially about the same issue. Payment friction: failed payments or requests for invoices (sometimes a precursor to finance reviewing the subscription for cancellation). Champion departure: the primary contact changes (the person who chose your product may have left the company). Build a risk scoring function. Ask Claude Code: For each customer, calculate a churn risk probability as a percentage. Use the indicators above with empirical weights. Login decline contributes up to 30 percent of the risk. Feature abandonment contributes up to 25 percent. Support issues contribute up to 20 percent. Payment problems contribute up to 15 percent. Contract timing contributes up to 10 percent (customers approaching renewal dates are at higher risk). Flag customers where churn risk exceeds 40 percent. Create a churn risk dashboard. Ask Claude Code: Build a page at src/app/dashboard/risk/page.tsx that shows at-risk customers sorted by churn probability. Each row shows: the company name, current health score, churn risk percentage, the top risk factors (for example, Login frequency down 70 percent, Approaching renewal), the MRR at stake, and the recommended action (reach out, offer training, schedule review call, escalate to account manager). Show the total MRR at risk across all flagged customers as a prominent KPI. Ask Claude Code: Add a What Changed view for each at-risk customer. Show a timeline of health score changes with annotations explaining what caused each drop. This context helps the customer success manager have a relevant, informed conversation instead of a generic check-in. Common error: churn prediction must be validated against actual churn data. Track which flagged customers actually churned versus which were retained. Use this to refine the weights and thresholds over time.
Automated outreach and communication sequences
Manual outreach does not scale. If you have 500 customers and 50 are at risk at any given time, you cannot write individual emails for each one. Automation handles the routine communication while you focus on high-value interactions. Ask Claude Code: Create an automated communication system at src/lib/automation.ts. Define triggers: events that start an automated sequence. OnboardingTrigger: fires when a customer signs up but has not completed onboarding within 3 days. InactivityTrigger: fires when a customer's login frequency drops below 50 percent of their historical average for 7 consecutive days. HealthDropTrigger: fires when a customer's health score drops below 50. RenewalTrigger: fires 30 days before a customer's contract renewal date. MilestoneTrigger: fires when a customer reaches a positive milestone (100th session, 1-year anniversary, upgraded plan). Build email sequences for each trigger. Ask Claude Code: Create the Inactivity Sequence. Day 0 (trigger day): send a helpful email — not We noticed you have not logged in but rather We published a new guide on [Feature] that makes [their use case] easier. Include a direct link to the feature. Day 3: if still inactive, send a Personal check-in email from the founder — casual, short, asking if everything is okay and if there is anything you can help with. Day 7: if still inactive, send a We want to make sure you are getting value email with an offer for a free 15-minute onboarding call. Day 14: if still inactive, send a Survey email asking what would make the product more useful to them. Each email should look personal (plain text, no fancy HTML, from a real person's email address). Ask Claude Code: Create the email sending function. Use Resend to send emails. Store each sent email in the CommunicationLog. Track opens and clicks. If the customer replies (detect via incoming email webhook or manual logging), pause the automated sequence and alert the human team. Never send automated and human emails on the same day to the same customer. Common error: automated emails that feel robotic do more harm than good. Write every automated email as if you were writing it personally to that one customer. Use their name, reference their specific usage, and avoid corporate language.
Lifecycle tracking and customer journey mapping
Every customer goes through stages: onboarding, adoption, expansion, and (hopefully not) churn. Tracking where each customer is in their lifecycle helps you provide the right support at the right time. Ask Claude Code: Create a lifecycle management system at src/lib/lifecycle.ts. Define stages with entry criteria. Onboarding: from signup to completing key setup steps (defined per product — for example, connecting an integration, inviting a team member, completing a workflow). Active: completed onboarding and using the product regularly. Growing: actively expanding usage — adding seats, exploring new features, increasing usage volume. At Risk: health score below 60 or activity declining. Churning: has initiated cancellation or health score below 30. Churned: subscription cancelled. Build automatic stage transitions. Ask Claude Code: Create a daily job that evaluates each customer's current stage and advances or regresses them based on their activity and health score. Log every stage change with the reason. A customer can move backwards: an Active customer whose usage declines moves to At Risk. A Churning customer who re-engages moves back to Active. Create the customer journey dashboard. Ask Claude Code: Build a page showing the customer lifecycle as a funnel or flow diagram. Each stage shows the count of customers currently in that stage and the MRR in that stage. Between stages, show the transition rates: what percentage of onboarding customers become active, what percentage of active customers become at risk, and what percentage of at-risk customers churn. Add a Sankey diagram showing customer flow between stages over the last 30 days. Create individual customer timelines. Ask Claude Code: On each customer's detail page, show a timeline of every significant event: signup, onboarding milestones completed, support tickets, health score changes, lifecycle stage transitions, communications sent, and payment events. This single view gives the customer success manager complete context before any interaction. Common error: lifecycle stages should advance automatically based on data, not require manual updates. If a customer success manager has to manually move customers between stages, the data will always be stale.
Dashboard, reporting, and deployment
The customer success dashboard provides the daily operating view for your team. Ask Claude Code: Create the main dashboard at src/app/dashboard/page.tsx with these components. Portfolio Health: a summary showing the total number of customers by health band (healthy, neutral, at risk, critical) as a stacked bar chart. Total MRR with a breakdown by health band — this makes health tangible by tying it to revenue. Action Queue: a prioritised list of customers needing attention today. Sort by a combination of MRR at stake and churn risk. Each item shows the customer name, the issue (health score dropped, renewal approaching, inactive for 10 days), and a suggested action. Mark items as Done when actioned. Lifecycle Overview: a compact funnel showing customers at each lifecycle stage with week-over-week change. Highlight stages where the count is growing negatively (more customers moving to At Risk). Scheduled Communications: a feed of automated emails going out today. Allow manual review and cancellation before sending. Recent Activity: a feed of the latest customer activities across the portfolio. Build weekly and monthly reports. Ask Claude Code: Create automated reports. The Weekly Customer Health Report shows: customers whose health improved (celebrate wins), customers whose health declined (investigate), new at-risk customers, saved customers (moved from at-risk back to healthy), and churned customers with revenue impact. The Monthly Executive Summary shows: total customer count and growth, MRR and growth, churn rate (customer churn and revenue churn), expansion revenue (upgrades, additional seats), net revenue retention (the most important SaaS metric — should be above 100 percent), and health score distribution trend over the last 6 months. Deploy to Vercel with a PostgreSQL database. Ask Claude Code: Configure the project for production. Set up the daily health score calculation as a cron job. Set up the automated email triggers as a cron job. Configure environment variables for the database, Resend email API, and any integrations. Test the complete system: add a customer, simulate activity decline, verify the health score drops, verify the at-risk alert fires, verify the automated email sequence starts, and verify the dashboard reflects all changes.
Customer Retention Strategies
This guide is hands-on and practical. The full curriculum covers the conceptual foundations in depth with structured lessons and quizzes.
Go to lesson