getaero-io/gtm-eng-skills / engineering/warm-intro-scoring
warm-intro-scoring
Verifiedplays/reports.ts
View on GitHub/* eslint-disable @typescript-eslint/no-explicit-any -- Ported JSON contract/parity boundary; runtime validators reject malformed values. */
import {LEGACY_FIELDS} from './legacy';
const STYLE=":root{color-scheme:light}*{box-sizing:border-box}body{margin:0;background:#f6f5ef;color:#1d3029;font:16px/1.55 system-ui,sans-serif}\nmain{max-width:1120px;margin:auto;padding:44px 22px}h1{font-size:clamp(28px,5vw,48px);line-height:1.1;margin:12px 0}h2{font-size:22px}.eyebrow{letter-spacing:.12em;text-transform:uppercase;font-size:12px}.verdict{border-left:5px solid #a56b15;background:#fff5dc;padding:16px 20px;margin:24px 0}.cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}.card{padding:20px;border:1px solid #d2d9cf;border-radius:12px;background:white}.card strong{font-size:28px;display:block}section{margin-top:32px}.scroll{overflow-x:auto}table{border-collapse:collapse;width:100%;background:white}th,td{padding:12px;text-align:left;border-bottom:1px solid #dbe0d6;font-variant-numeric:tabular-nums}thead{background:#e3ecdf}p,li{max-width:85ch}small{color:#4c6156}pre{white-space:pre-wrap;overflow-wrap:anywhere;background:white;padding:16px}summary{cursor:pointer;padding:14px;border:1px solid #aab9a7;border-radius:8px}summary:focus-visible{outline:3px solid #315d48}";
const esc=(v:any)=>String(v).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''');
const number=(v:any)=>v===null?'Unavailable':Number(v).toFixed(3);
/** Same reviewed-path template and source fields as scripts/render.py. */
export function renderLegacy(rows:Record<string,any>[],template:string):string {
if(!template.includes('__PATH_DATA__'))throw new Error('Legacy review template marker missing');
const seen=new Set();const clean=rows.map(row=>{
if(!['campaign_id','owner_id','connector_id','target_id','path_id'].every(k=>row[k]))throw new Error('Stable path identities required');
if(seen.has(row.path_id))throw new Error('Duplicate path ID');seen.add(row.path_id);
for(const k of ['total_score','direct_intro_score','work_overlap_score','relationship_score','school_city_community_score','role_industry_score','investor_score']) {const v=row[k];if(v===null||v===undefined||(typeof v==='string'&&!v.trim())||!Number.isFinite(Number(v))||Number(v)<0)throw new Error('Scores must be finite and nonnegative');}
return Object.fromEntries(LEGACY_FIELDS.map(k=>[k,k in row?row[k]:'']));
});
const payload=JSON.stringify(clean).replace(/</g,'\\u003c').replace(/>/g,'\\u003e').replace(/&/g,'\\u0026');
return template.replace('__PATH_DATA__',()=>payload);
}
/** Reuses the Python report stylesheet and preserves all diagnostic data. */
export function renderEvaluation(report:Record<string,any>):string {
const c=report.coverage,o=report.outcomes;
const metricRows=Object.entries(report.metrics).map(([name,m]:[string,any])=>`<tr><th scope="row">${esc(name)}</th><td>${number(m.baseline)}</td><td>${number(m.candidate)}</td><td>${number(m.delta)}</td><td>${m.delta_ci95===null?'Unavailable':m.delta_ci95.map(number).join(' to ')}</td></tr>`).join('');
const queryRows=report.queries.map((r:any)=>`<tr><th scope="row">${esc(r.id)}</th><td>${esc(r.account_id)}</td><td>${esc(r.exclusion||'Eligible')}</td><td>${number(r.delta?.['recall@3']??null)}</td></tr>`).join('');
const title=report.status.replaceAll('_',' ');const details=esc(JSON.stringify(report,null,2));
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Warm intro evaluation</title><style>${STYLE}</style></head><body><main><div class="eyebrow">Warm intro scoring · evaluation</div><h1>Does the new ranking help?</h1><p>A paired comparison with explicit evidence coverage and outcome windows.</p><div class="verdict"><strong>${esc(title.charAt(0).toUpperCase()+title.slice(1))}</strong><br>No automatic promotion. These diagnostics do not establish causal uplift.</div><div class="cards"><div class="card"><small>Eligible queries / total</small><strong>${esc(c.eligible_queries)} / ${esc(c.total_queries)}</strong></div><div class="card"><small>Judged labels / total</small><strong>${esc(c.judged_labels)} / ${esc(c.total_labels)}</strong></div><div class="card"><small>Mature observed sends</small><strong>${esc(o.matured_sent_denominator)}</strong></div></div><section><h2>Ranking comparison</h2><p>Candidate minus baseline. Intervals resample accounts; repeated relationships across accounts may still be dependent.</p><div class="scroll"><table><thead><tr><th scope="col">Metric</th><th scope="col">Baseline</th><th scope="col">Candidate</th><th scope="col">Delta</th><th scope="col">95% interval</th></tr></thead><tbody>${metricRows}</tbody></table></div></section><section><h2>Observed outcomes · ${esc(o.window_days)}-day window</h2><p>Reply rate: <strong>${number(o.reply_rate)}</strong> · Meeting rate: <strong>${number(o.meeting_rate)}</strong>. Rates are proportions, conditional on mature, fully observed sends.</p><p>${esc(o.drafts)} drafts · ${esc(o.sent_immature)} open windows · ${esc(o.sent_unobserved)} mature sends with unknown outcomes. These records are excluded from the rate denominator.</p></section><section><h2>Coverage by query</h2><div class="scroll"><table><thead><tr><th scope="col">Query</th><th scope="col">Account</th><th scope="col">Eligibility</th><th scope="col">Recall@3 delta</th></tr></thead><tbody>${queryRows}</tbody></table></div></section><section><h2>Interpretation limits</h2><ul>${report.warnings.map((w:string)=>`<li>${esc(w)}</li>`).join('')}</ul></section><section><details><summary>Inspect complete scorecard and reproducibility metadata</summary><pre>${details}</pre></details></section></main></body></html>\n`;
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |