← Back to work
pipeline · B2B SaaS

Deal Risk Scoring

B2B pipeline risk scoring. Cheap heuristics rank every deal; Claude explains only the ones worth a second look.

Stack
Python · Streamlit · pandas · Claude API
Demo
Live · scoring layer on 100 synthetic deals
My role
Designed & directed the build
Two-layer risk scoring cheap heuristics rank every deal → Claude explains only the top 10

Deal Triage two-layer scoring flow, left to right: pipeline deals come in from HubSpot, a CSV, or sample data and are normalized to open deals only, with closed or unmapped deals filtered out of scope. Layer one is a zero-cost deterministic heuristic that scores three signals against the team's own per-stage medians into a composite 0 to 100 risk score, sorting deals into High, Medium, or Low risk. Layer two ranks them and sends only the top 10 at-risk deals to Claude, which reads the editable RevOps-owned deal-risk prompt at runtime and returns output tiered by signal strength: a full memo with verbatim quotes when the signal is strong, or a short brief with no fabrication when it is thin. Output feeds a follow-up email draft and feedback capture.

The problem

Deals rarely die in the open — they slip quietly, and most tools catch it too late. Dashboards report lagging numbers, so by the time a deal turns red it’s already gone. The early signs — a close date that keeps moving, activity going quiet, a hesitation buried in a call — sit scattered across CRM fields and transcripts nobody reads together.

The decision

Two layers, each doing what it’s good at. Cheap heuristics score every open deal 0–100 on three signals — stage velocity, activity, close-date pressure — at zero API cost, and surface the top 10. Only then does Claude read those deals to explain the risk. Running an LLM over every deal is slow and buries the signal; heuristics rank, the LLM explains.

“Slow” is benchmarked against the team’s own pipeline history, not a fixed threshold — slow means slow for how this team’s deals actually move. That’s the difference between a score reps argue with and one they trust.

What I built

A CRM export goes in; every open deal comes out scored, closed deals filtered first. The top 10 go to Claude, which matches its output to the evidence: a strong deal with a transcript gets a full memo with dated quotes; a thin one gets two lines and a single next step — never false confidence. Around that: one-click follow-up drafts, thumbs up/down to tune the prompt, an enriched CSV export, and a methodology tab so reps can see how scoring works. The prompt lives in an editable file RevOps owns, not buried in code.

deal-risk.prompt.md EDITABLE · OWNED BY REVOPS
# deal-risk prompt — tiered by confidence

## High # past close, gone quiet, transcript
- full memo · 2–3 verbatim quotes, dated
- the one play to run next

## Low # thin signal, no transcript
- short brief · what's missing
- no invented risk
The live demo runs the scoring layer on 100 synthetic deals — no customer data, no API key needed. The Claude layer isn't wired into the hosted demo; clone the repo and add your own key to run it.