GUIDE

Automate Customer Health Scoring with Claude Code

Build a custom health scoring system with Claude Code that pulls usage metrics, support data, and engagement signals into a scored dashboard your CS team actually trusts.

Your CS platform's built-in health score is a black box. It spits out a number, your team glances at it, and nobody trusts it enough to actually make decisions from it. I see this constantly: CS leaders who pay $60k+ per year for Gainsight or Totango and still rely on gut feel because the health score doesn't reflect how their customers actually behave.

The fix is to build your own. A health scoring system you designed, with weights you chose, pulling signals you trust. And with Claude Code, you can build it in a single afternoon without writing a line of code yourself.

Why Custom Health Scores Beat Vendor Defaults

Vendor health scores are built for the average customer of the average company. Your customers aren't average. Your product has unique engagement patterns. Your support team categorizes tickets differently. Your sales cycle means renewal risk shows up in signals that no generic algorithm would catch.

When I ran CS teams, the default health score flagged accounts as "healthy" two weeks before they churned. The signals were wrong for our business. Login frequency was weighted too heavily. We had customers who logged in daily but were miserable because the product didn't solve their core problem. A custom score that weighted feature depth over login frequency would have caught those accounts months earlier.

Building your own means you pick the inputs, assign the weights, and adjust them as you learn. That's the difference between a score your team ignores and a score that drives real action.

The Health Score Formula

Here's a concrete scoring model you can start with. Every signal gets a weight between 0 and 1, and the total adds up to 100 points:

Usage Signals (40 points)

  • Monthly Active Users vs. licensed seats (15 pts): If they're paying for 50 seats and only 12 people log in, that's a problem. Score = (active users / licensed seats) * 15.
  • Core feature adoption (15 pts): Identify 3-5 features that correlate with retention. Score based on how many the account has adopted. If they use all 5, full points. If they use 1, they get 3.
  • Usage trend (10 pts): Is usage going up, flat, or declining over the last 90 days? Increasing = 10, flat = 6, declining = 2.

Support Signals (20 points)

  • Ticket volume trend (10 pts): Compare this quarter to last quarter. Decreasing tickets = 10, stable = 7, increasing = 3. A spike in tickets often signals frustration building up.
  • Open escalations (10 pts): Any open P1/P2 escalations? No = 10. One = 5. More than one = 0. Escalations are the strongest churn predictor in most CS datasets.

Engagement Signals (20 points)

  • Executive sponsor activity (10 pts): Has the executive sponsor logged in or responded to an email in the last 30 days? Yes = 10. Last 60 days = 5. Over 60 days = 0. When the sponsor goes dark, the renewal conversation gets brutal.
  • QBR/meeting attendance (5 pts): Did they attend the last scheduled QBR? Yes = 5. No-show = 0.
  • Response time to CSM outreach (5 pts): Average days to respond to the last 3 CSM emails. Under 2 days = 5. Under 5 days = 3. Over 5 days = 0.

Sentiment Signals (20 points)

  • NPS/CSAT score (10 pts): Latest survey response. Promoter (9-10) = 10. Passive (7-8) = 6. Detractor (0-6) = 2. No response = 4 (silence is slightly worse than passive).
  • Sentiment trend (10 pts): Compare last 2 survey responses. Improving = 10. Stable = 6. Declining = 2. No data = 4.

Scoring Tiers

  • 80-100: Healthy. Expansion candidate.
  • 60-79: Monitor. Something is off; CSM should investigate.
  • 40-59: At risk. Trigger a save play.
  • 0-39: Critical. Escalate to CS leadership immediately.

Building It with Claude Code

Here's the step-by-step. You'll tell Claude Code what to build, and it handles the implementation.

Step 1: Define the project

Open Claude Code and describe the tool:

Build a customer health scoring tool in TypeScript. It should:
1. Accept a list of account IDs (or pull all active accounts from our database)
2. For each account, pull:
   - Usage data from our PostgreSQL database (MAU, feature adoption, trends)
   - Support tickets from Zendesk API (volume, escalations)
   - CRM data from HubSpot API (contract details, last contact dates)
   - NPS scores from Delighted API
3. Calculate a health score from 0-100 using a weighted formula
4. Output a CSV with columns: account_id, account_name, health_score,
   tier (Healthy/Monitor/At Risk/Critical), and each sub-score
5. Also generate a summary report flagging all Critical and At Risk accounts

Set up the project with proper environment variable handling for API keys.

Claude will scaffold the project structure, install dependencies, and start building the data connectors.

Step 2: Implement the scoring formula

Give Claude the exact formula. Be specific about how each signal maps to a score:

Here's the scoring formula. Implement each as a separate function:

Usage (40 pts total):
- seat_utilization: (active_users / licensed_seats) * 15, capped at 15
- feature_adoption: (adopted_core_features / 5) * 15
- usage_trend: if 90-day trend > 5% growth = 10,
  between -5% and 5% = 6, below -5% = 2

Support (20 pts total):
- ticket_trend: if tickets decreased QoQ = 10,
  stable (within 10%) = 7, increased = 3
- escalations: 0 open P1/P2 = 10, 1 = 5, 2+ = 0

Engagement (20 pts total):
- sponsor_activity: last login < 30 days = 10,
  < 60 days = 5, 60+ days = 0
- qbr_attendance: attended last QBR = 5, missed = 0
- response_time: avg < 2 days = 5, < 5 days = 3, 5+ days = 0

Sentiment (20 pts total):
- nps_score: 9-10 = 10, 7-8 = 6, 0-6 = 2, no response = 4
- nps_trend: improving = 10, stable = 6, declining = 2, no data = 4

Total = sum of all components. Tier: 80+ Healthy, 60-79 Monitor,
40-59 At Risk, 0-39 Critical.

Step 3: Build the output

Tell Claude what the output should look like. You want two things: a CSV for bulk analysis and a summary report for leadership:

Generate two outputs:

1. A CSV file (health_scores_YYYY-MM-DD.csv) with columns:
   account_id, account_name, health_score, tier,
   seat_utilization, feature_adoption, usage_trend,
   ticket_trend, escalations, sponsor_activity,
   qbr_attendance, response_time, nps_score, nps_trend,
   renewal_date, contract_value

2. A markdown summary report with:
   - Total accounts scored
   - Distribution by tier (count and %)
   - List of all Critical accounts with their lowest-scoring signals
   - List of At Risk accounts with renewal in the next 90 days
   - Total ARR at risk (sum of Critical + At Risk contract values)

Step 4: Test and calibrate

Run the tool against your real accounts. The first pass will reveal calibration issues. Maybe too many accounts land in "Monitor" because your feature adoption thresholds are too strict. Maybe not enough hit "Critical" because the escalation weight is too low. Adjust the weights and thresholds by telling Claude what to change. This calibration loop is where you turn a generic formula into something that reflects your actual business.

What the Output Looks Like

Here's a sample from the summary report:

# Customer Health Report — Q1 2026

## Portfolio Summary
- Accounts scored: 247
- Healthy (80+): 142 (57%)
- Monitor (60-79): 61 (25%)
- At Risk (40-59): 31 (13%)
- Critical (0-39): 13 (5%)

## Critical Accounts (Immediate Action Required)
| Account          | Score | Lowest Signal           | Renewal   | ARR     |
|------------------|-------|-------------------------|-----------|---------|
| Acme Corp        | 28    | Sponsor inactive 94 days| Jun 2026  | $85,000 |
| TechStart Inc    | 31    | NPS dropped 9→4         | Apr 2026  | $42,000 |
| GlobalRetail     | 34    | Usage down 38% QoQ      | May 2026  | $120,000|

## At Risk Accounts Renewing in 90 Days
| Account          | Score | Top Risk Signal         | Renewal   | ARR     |
|------------------|-------|-------------------------|-----------|---------|
| MidMarket LLC    | 48    | 3 open escalations      | Apr 2026  | $55,000 |
| DataFlow Systems | 52    | Feature adoption 1/5    | May 2026  | $38,000 |

## ARR at Risk
- Critical: $612,000
- At Risk (90-day renewals): $193,000
- Total: $805,000

That's the report you take to your CRO. No ambiguity. No gut feel. Just scored accounts with specific signals explaining why they're flagged, and dollar amounts attached. This is how you justify hiring another CSM, buying a tool, or restructuring your book of business.

Making It Operational

A health score that runs once is useful. A health score that runs automatically every week is a system. Here's how to take it from script to workflow:

  • Schedule it: Set up a cron job or use a tool like n8n to run the script every Monday morning. Your team starts the week with fresh scores.
  • Alert on changes: Add logic that flags accounts whose score dropped more than 15 points in a week. A sudden drop is almost always actionable.
  • Push to Slack: Send the Critical account list to your CS Slack channel every week. Keep it visible.
  • Track over time: Store each week's scores in a database table. Now you can trend health scores over time and correlate them with actual churn data to validate your weights.

Connecting It to Claude Code with MCP

Once your scoring system is working, you can bolt on MCP servers to give Claude live access to your data sources. That means you can ask Claude Code questions like "Which accounts dropped from Healthy to At Risk this month?" or "Show me all Critical accounts where the main signal is declining usage." Claude queries your scoring data in real-time and gives you answers.

You can also wire it into your agentic workflows: have Claude automatically draft re-engagement emails for At Risk accounts, or prepare save play briefs for Critical ones.

Customizing the Formula for Your Business

The formula above is a starting point. The real power comes from tuning it to your business. Here are adjustments I've seen CS leaders make:

  • B2B with long contracts: Weight engagement signals higher. If a customer signed a 3-year deal, usage dips in year 2 are normal. But if the sponsor goes dark, that's your red flag.
  • PLG companies: Weight usage signals at 50-60% of the total score. Usage is your primary churn predictor.
  • High-touch enterprise: Add a "relationship quality" signal based on CSM-reported health (subjective, but valuable as one input among many).
  • Multi-product: Score each product separately and roll up to an account-level composite.

The point is that you can make these changes in 10 minutes with Claude Code. Try a new weight, re-run the scores, see how the distribution shifts. You can't do that with a vendor tool. You'd be filing a feature request and waiting 6 months.

Get Started

If you haven't set up Claude Code yet, the install guide takes about 2 minutes. Then come back here and build your first health scoring run as a real project.

If you want hands-on coaching through the build, that's what we do at ClaudeFluent. I've walked CS leaders through exactly this kind of project, from raw idea to a running system their team depends on. The people who get the most out of training are the ones who bring a real problem. Health scoring is one of the best ones to start with because the payoff is immediate and visible to leadership.

Related Guides

WANT MORE LIKE THIS?

Learn to build with Claude Code

6 hours of hands-on training. Build real projects. Ship without waiting on engineering.

View Class Details