clay-observability

0
0
Source

Set up comprehensive observability for Clay integrations with metrics, traces, and alerts. Use when implementing monitoring for Clay operations, setting up dashboards, or configuring alerting for Clay integration health. Trigger with phrases like "clay monitoring", "clay metrics", "clay observability", "monitor clay", "clay alerts", "clay tracing".

Install

mkdir -p .claude/skills/clay-observability && curl -L -o skill.zip "https://mcp.directory/api/skills/download/5410" && unzip -o skill.zip -d .claude/skills/clay-observability && rm skill.zip

Installs to .claude/skills/clay-observability

About this skill

Clay Observability

Overview

Monitor Clay data enrichment pipeline health across four dimensions: credit consumption velocity, enrichment success rates (hit rates), data quality scores, and CRM sync reliability. Clay's credit-based pricing model makes observability essential for cost control.

Prerequisites

  • Clay account with table access
  • Metrics infrastructure (Prometheus/Grafana, Datadog, or custom)
  • Webhook receiver that logs enrichment results
  • Understanding of your enrichment column configuration

Instructions

Step 1: Instrument Your Clay Webhook Handler

// src/clay/metrics.ts — collect metrics from enriched data flowing back from Clay
interface ClayMetrics {
  enrichmentsReceived: number;
  enrichmentsWithEmail: number;
  enrichmentsWithCompany: number;
  enrichmentsWithPhone: number;
  estimatedCreditsUsed: number;
  averageICPScore: number;
  leadsTier: { A: number; B: number; C: number; D: number };
}

class ClayMetricsCollector {
  private metrics: ClayMetrics = {
    enrichmentsReceived: 0,
    enrichmentsWithEmail: 0,
    enrichmentsWithCompany: 0,
    enrichmentsWithPhone: 0,
    estimatedCreditsUsed: 0,
    averageICPScore: 0,
    leadsTier: { A: 0, B: 0, C: 0, D: 0 },
  };
  private scoreSum = 0;

  record(lead: Record<string, any>, creditsPerRow: number = 6) {
    this.metrics.enrichmentsReceived++;
    if (lead.work_email) this.metrics.enrichmentsWithEmail++;
    if (lead.company_name) this.metrics.enrichmentsWithCompany++;
    if (lead.phone_number) this.metrics.enrichmentsWithPhone++;
    this.metrics.estimatedCreditsUsed += creditsPerRow;

    const score = lead.icp_score || 0;
    this.scoreSum += score;
    this.metrics.averageICPScore = this.scoreSum / this.metrics.enrichmentsReceived;

    if (score >= 80) this.metrics.leadsTier.A++;
    else if (score >= 60) this.metrics.leadsTier.B++;
    else if (score >= 40) this.metrics.leadsTier.C++;
    else this.metrics.leadsTier.D++;
  }

  getReport(): string {
    const m = this.metrics;
    const emailRate = m.enrichmentsReceived > 0
      ? ((m.enrichmentsWithEmail / m.enrichmentsReceived) * 100).toFixed(1)
      : '0';
    const companyRate = m.enrichmentsReceived > 0
      ? ((m.enrichmentsWithCompany / m.enrichmentsReceived) * 100).toFixed(1)
      : '0';

    return [
      `=== Clay Enrichment Report ===`,
      `Total processed: ${m.enrichmentsReceived}`,
      `Email find rate: ${emailRate}%`,
      `Company match rate: ${companyRate}%`,
      `Avg ICP score: ${m.averageICPScore.toFixed(1)}`,
      `Lead distribution: A=${m.leadsTier.A} B=${m.leadsTier.B} C=${m.leadsTier.C} D=${m.leadsTier.D}`,
      `Estimated credits used: ${m.estimatedCreditsUsed}`,
      `Cost per email found: ${(m.estimatedCreditsUsed / Math.max(m.enrichmentsWithEmail, 1)).toFixed(1)} credits`,
    ].join('\n');
  }
}

Step 2: Set Up Prometheus Metrics (Optional)

// src/clay/prometheus-metrics.ts
import { Counter, Gauge, Histogram } from 'prom-client';

// Counters
const clayEnrichmentsTotal = new Counter({
  name: 'clay_enrichments_total',
  help: 'Total enrichments received from Clay',
  labelNames: ['table', 'status'],
});

const clayCreditsUsed = new Counter({
  name: 'clay_credits_used_total',
  help: 'Estimated Clay credits consumed',
  labelNames: ['table', 'enrichment_type'],
});

// Gauges
const clayHitRate = new Gauge({
  name: 'clay_enrichment_hit_rate',
  help: 'Enrichment hit rate percentage',
  labelNames: ['table', 'field'],
});

const clayCreditBalance = new Gauge({
  name: 'clay_credit_balance',
  help: 'Remaining Clay credits',
});

const clayICPScore = new Histogram({
  name: 'clay_icp_score',
  help: 'Distribution of ICP scores',
  buckets: [20, 40, 60, 80, 100],
  labelNames: ['table'],
});

// Record enrichment
function recordEnrichment(table: string, lead: Record<string, any>) {
  clayEnrichmentsTotal.inc({ table, status: lead.work_email ? 'enriched' : 'empty' });
  clayCreditsUsed.inc({ table, enrichment_type: 'waterfall' }, 6);
  clayICPScore.observe({ table }, lead.icp_score || 0);
}

Step 3: Configure Alerting Rules

# prometheus/clay-alerts.yml
groups:
  - name: clay-enrichment
    rules:
      - alert: ClayCreditBurnHigh
        expr: rate(clay_credits_used_total[1h]) > 200
        for: 15m
        labels:
          severity: warning
        annotations:
          summary: "Clay credit burn rate > 200/hour. Monthly projection: {{ $value | humanize }} credits"

      - alert: ClayLowEmailHitRate
        expr: clay_enrichment_hit_rate{field="email"} < 40
        for: 30m
        labels:
          severity: warning
        annotations:
          summary: "Email find rate below 40% on table {{ $labels.table }}. Check input data quality."

      - alert: ClayCreditBalanceLow
        expr: clay_credit_balance < 500
        labels:
          severity: critical
        annotations:
          summary: "Clay credit balance below 500. Enrichments will stop when credits run out."

      - alert: ClayWebhookFailureRate
        expr: rate(clay_enrichments_total{status="error"}[15m]) > 0.1
        labels:
          severity: warning
        annotations:
          summary: "Clay webhook callback failure rate > 10%"

Step 4: Build a Dashboard

Key panels for a Clay observability dashboard:

dashboard_panels:
  row_1:
    - name: "Credit Balance"
      type: gauge
      metric: clay_credit_balance
      thresholds: [500, 1000, 5000]

    - name: "Credits Used Today"
      type: stat
      metric: increase(clay_credits_used_total[24h])

    - name: "Email Hit Rate"
      type: gauge
      metric: clay_enrichment_hit_rate{field="email"}
      thresholds: [40, 60, 80]

  row_2:
    - name: "Credit Burn Rate (hourly)"
      type: timeseries
      metric: rate(clay_credits_used_total[1h])

    - name: "ICP Score Distribution"
      type: histogram
      metric: clay_icp_score

  row_3:
    - name: "Lead Tier Breakdown"
      type: piechart
      metric: clay_enrichments_total by (tier)

    - name: "Cost per Enriched Lead"
      type: stat
      metric: clay_credits_used_total / clay_enrichments_total{status="enriched"}

Step 5: Daily Summary Report

// src/clay/daily-report.ts — generate daily enrichment summary
function generateDailyReport(collector: ClayMetricsCollector): void {
  console.log(collector.getReport());

  // Post to Slack
  if (process.env.SLACK_WEBHOOK_URL) {
    fetch(process.env.SLACK_WEBHOOK_URL, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        text: `*Daily Clay Enrichment Report*\n\`\`\`\n${collector.getReport()}\n\`\`\``,
      }),
    }).catch(console.error);
  }
}

Error Handling

IssueCauseSolution
Credits depleting fastHigh waterfall depth or uncapped tablesAdd credit burn alert, reduce waterfall
Hit rate near 0%Invalid input data (personal domains, typos)Add data quality monitoring, pre-filter
Missing metricsWebhook handler not instrumentedAdd metrics collection to callback handler
Dashboard shows stale dataMetrics not being pushedVerify Prometheus scrape config

Resources

Next Steps

For incident response, see clay-incident-runbook.

svg-icon-generator

jeremylongshore

Svg Icon Generator - Auto-activating skill for Visual Content. Triggers on: svg icon generator, svg icon generator Part of the Visual Content skill category.

6814

d2-diagram-creator

jeremylongshore

D2 Diagram Creator - Auto-activating skill for Visual Content. Triggers on: d2 diagram creator, d2 diagram creator Part of the Visual Content skill category.

2212

performing-penetration-testing

jeremylongshore

This skill enables automated penetration testing of web applications. It uses the penetration-tester plugin to identify vulnerabilities, including OWASP Top 10 threats, and suggests exploitation techniques. Use this skill when the user requests a "penetration test", "pentest", "vulnerability assessment", or asks to "exploit" a web application. It provides comprehensive reporting on identified security flaws.

379

designing-database-schemas

jeremylongshore

Design and visualize efficient database schemas, normalize data, map relationships, and generate ERD diagrams and SQL statements.

978

performing-security-audits

jeremylongshore

This skill allows Claude to conduct comprehensive security audits of code, infrastructure, and configurations. It leverages various tools within the security-pro-pack plugin, including vulnerability scanning, compliance checking, cryptography review, and infrastructure security analysis. Use this skill when a user requests a "security audit," "vulnerability assessment," "compliance review," or any task involving identifying and mitigating security risks. It helps to ensure code and systems adhere to security best practices and compliance standards.

86

django-view-generator

jeremylongshore

Generate django view generator operations. Auto-activating skill for Backend Development. Triggers on: django view generator, django view generator Part of the Backend Development skill category. Use when working with django view generator functionality. Trigger with phrases like "django view generator", "django generator", "django".

15

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

642969

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

590705

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318398

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

339397

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

451339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.