Skip to content

getaero-io/gtm-eng-skills / skills/deepline-crm-cleaning

deepline-crm-cleaning

Verified

Use for CRM audits, duplicate detection, missing or stale fields, job changes, domain checks, acquisitions, parent-child relationships, repair plans, prevention, monitoring, and evaluation. Supports HubSpot, Salesforce, Attio, and mapped exports. Start with read-only analysis. Skip outreach writing, CRM interface design, and unrelated analysis.

FileKindSize
SKILL.mdskill md8.5 KB
adapters/attio.mdmarkdown3.3 KB
adapters/hubspot.mdmarkdown3.4 KB
adapters/other.mdmarkdown1.9 KB
adapters/salesforce.mdmarkdown3.7 KB
jobs/audit.mdmarkdown2.8 KB
jobs/dedupe.mdmarkdown4.6 KB
jobs/employment.mdmarkdown1.0 KB
jobs/enrich.mdmarkdown1.5 KB
jobs/evaluate.mdmarkdown1.8 KB
jobs/hierarchy.mdmarkdown1.9 KB
jobs/monitor.mdmarkdown1.1 KB
jobs/prevent.mdmarkdown1.2 KB
jobs/relationships.mdmarkdown1.0 KB
jobs/repair.mdmarkdown1.6 KB
plays/README.mdmarkdown14.5 KB
plays/audit-crm-snapshot.play.tsscript1.7 KB
plays/bun.lockother2.1 KB
plays/classify-company-domains.play.tsscript882 B
plays/collect-domain-evidence.play.tsscript1.8 KB
plays/collect-hubspot-companies.play.tsscript876 B
plays/deepline.jsonconfig27 B
plays/evaluate-crm-cleaning.play.tsscript3.5 KB
plays/package.jsonmanifest408 B
plays/plan-crm-domain-repairs.play.tsscript1.4 KB
plays/resolve-crm-contact-duplicates.play.tsscript1.9 KB
plays/sample-hubspot-crm.play.tsscript2.3 KB
plays/schemas/receipt.schema.jsonconfig13.1 KB
plays/score-crm-company-candidates.play.tsscript2.3 KB
plays/shared/assets/README.mdmarkdown566 B
plays/shared/assets/public-suffix-list.LICENSE.txtmarkdown16.7 KB
plays/shared/assets/public-suffix-list.txtmarkdown311.1 KB
plays/shared/assets/unicode.LICENSE.txtmarkdown1.9 KB
plays/shared/audit.tsscript30.7 KB
plays/shared/collect-domains.tsscript20.3 KB
plays/shared/company-candidates.tsscript16.7 KB
plays/shared/domain-policy.tsscript7.8 KB
plays/shared/domain-repairs.tsscript13.2 KB
plays/shared/domain.tsscript16.7 KB
plays/shared/duplicates.tsscript21.1 KB
plays/shared/evaluate.tsscript40.9 KB
plays/shared/hubspot.tsscript21.7 KB
plays/shared/identity-evaluation.tsscript14.4 KB
plays/shared/io.tsscript1.8 KB
plays/shared/json.tsscript6.8 KB
plays/shared/native.tsscript1004 B
plays/shared/time.tsscript1.9 KB
plays/shared/unicode-casefold.jsonconfig37.1 KB
shared/domain-evidence.mdmarkdown7.1 KB
shared/entity-model.mdmarkdown4.4 KB
shared/evaluation.mdmarkdown4.4 KB
shared/hierarchy-discovery.mdmarkdown4.5 KB
shared/metrics.mdmarkdown8.2 KB
shared/receipts.mdmarkdown5.9 KB
shared/source-connections.mdmarkdown1.5 KB
skill-metadata.jsonconfig851 B

plays/shared/json.ts

View on GitHub
import { createHash } from './native';
import casefold from './unicode-casefold.json';

// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Schema-validated dynamic CRM and receipt objects share this JSON boundary.
export type JsonObject = Record<string, any>;
export const HASH_FORMAT = 'crm-json-js-v1';

export function sha256(value: string | Uint8Array): string {
  return createHash('sha256').update(value).digest('hex');
}

export function compareCodepoints(a: string, b: string): number {
  const aa = Array.from(a, (c) => c.codePointAt(0)!);
  const bb = Array.from(b, (c) => c.codePointAt(0)!);
  for (let i = 0; i < Math.min(aa.length, bb.length); i++) {
    if (aa[i] !== bb[i]) return aa[i] - bb[i];
  }
  return aa.length - bb.length;
}

/** Versioned finite JSON encoding. Number spelling follows JavaScript JSON. */
export function canonicalJson(
  value: unknown,
  options: { ascii?: boolean } = {},
): string {
  const active = new Set<object>();
  function encode(item: unknown): string {
    if (item === null) return 'null';
    if (typeof item === 'string') {
      const result = JSON.stringify(item);
      return options.ascii
        ? result.replace(
            /[\u007f-\uffff]/g,
            (c) => '\\u' + c.charCodeAt(0).toString(16).padStart(4, '0'),
          )
        : result;
    }
    if (typeof item === 'number') {
      if (!Number.isFinite(item)) throw new Error('Non-finite JSON number');
      if (Number.isInteger(item) && !Number.isSafeInteger(item))
        throw new Error(
          'Unsafe JSON integer; encode exact identifiers as strings',
        );
      return JSON.stringify(item);
    }
    if (typeof item === 'boolean') return String(item);
    if (typeof item !== 'object') throw new Error('Expected a JSON value');
    if (active.has(item)) throw new Error('Cyclic JSON value');
    active.add(item);
    try {
      if (Array.isArray(item))
        return '[' + Array.from(item, encode).join(',') + ']';
      if (
        Object.getPrototypeOf(item) !== Object.prototype &&
        Object.getPrototypeOf(item) !== null
      ) {
        throw new Error('Expected a plain JSON object');
      }
      return (
        '{' +
        Object.keys(item)
          .sort(compareCodepoints)
          .map((key) => encode(key) + ':' + encode((item as JsonObject)[key]))
          .join(',') +
        '}'
      );
    } finally {
      active.delete(item);
    }
  }
  return encode(value);
}

/** Parse JSON without accepting duplicate keys or overflowing numbers. */
export function strictJsonParse(text: string): unknown {
  let offset = 0;
  const fail = (message: string): never => {
    throw new Error(`${message} at JSON offset ${offset}`);
  };
  const whitespace = () => {
    while (/[\t\n\r ]/.test(text[offset] ?? '\0')) offset++;
  };
  function string(): string {
    const start = offset++;
    while (offset < text.length) {
      const ch = text[offset++];
      if (ch === '"') return JSON.parse(text.slice(start, offset));
      if (ch === '\\') offset++;
    }
    return fail('Unterminated string');
  }
  function value(): unknown {
    whitespace();
    if (text[offset] === '"') return string();
    if (text[offset] === '{') {
      offset++;
      whitespace();
      const result: JsonObject = {};
      if (text[offset] === '}') {
        offset++;
        return result;
      }
      while (true) {
        whitespace();
        if (text[offset] !== '"') fail('Expected object key');
        const key = string();
        whitespace();
        if (Object.hasOwn(result, key)) fail(`Duplicate JSON key: ${key}`);
        if (text[offset++] !== ':') fail('Expected colon');
        Object.defineProperty(result, key, {
          value: value(),
          enumerable: true,
          writable: true,
          configurable: true,
        });
        whitespace();
        const next = text[offset++];
        if (next === '}') return result;
        if (next !== ',') fail('Expected comma');
      }
    }
    if (text[offset] === '[') {
      offset++;
      whitespace();
      const result: unknown[] = [];
      if (text[offset] === ']') {
        offset++;
        return result;
      }
      while (true) {
        result.push(value());
        whitespace();
        const next = text[offset++];
        if (next === ']') return result;
        if (next !== ',') fail('Expected comma');
      }
    }
    for (const [literal, result] of [
      ['true', true],
      ['false', false],
      ['null', null],
    ] as const) {
      if (text.startsWith(literal, offset)) {
        offset += literal.length;
        return result;
      }
    }
    const numeric = text
      .slice(offset)
      .match(/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/);
    if (!numeric) return fail('Expected JSON value');
    offset += numeric[0].length;
    const result = Number(numeric[0]);
    if (!Number.isFinite(result)) fail('Non-finite JSON number');
    if (Number.isInteger(result) && !Number.isSafeInteger(result))
      fail('Unsafe JSON integer; encode exact identifiers as strings');
    return result;
  }
  const result = value();
  whitespace();
  if (offset !== text.length) fail('Unexpected trailing input');
  return result;
}

/** Python 3 Unicode 16.0 full case folding, frozen independently of the host ICU. */
export function pythonCasefold(value: string): string {
  return Array.from(
    value,
    (char) => (casefold as Record<string, string>)[char] ?? char,
  ).join('');
}

/** Ratcliff/Obershelp matching with Python SequenceMatcher's stable tie order; no autojunk. */
export function sequenceMatcherRatio(left: string, right: string): number {
  const a = Array.from(left),
    b = Array.from(right);
  if (!a.length && !b.length) return 1;
  const positions = new Map<string, number[]>();
  b.forEach((char, index) => {
    const list = positions.get(char) ?? [];
    list.push(index);
    positions.set(char, list);
  });
  const pending = [[0, a.length, 0, b.length]];
  let matched = 0;
  while (pending.length) {
    const [alo, ahi, blo, bhi] = pending.pop()!;
    let bestA = alo,
      bestB = blo,
      bestSize = 0;
    let previous = new Map<number, number>();
    for (let i = alo; i < ahi; i++) {
      const current = new Map<number, number>();
      for (const j of positions.get(a[i]) ?? []) {
        if (j < blo) continue;
        if (j >= bhi) break;
        const size = (previous.get(j - 1) ?? 0) + 1;
        current.set(j, size);
        if (size > bestSize) {
          bestA = i - size + 1;
          bestB = j - size + 1;
          bestSize = size;
        }
      }
      previous = current;
    }
    if (!bestSize) continue;
    matched += bestSize;
    if (alo < bestA && blo < bestB) pending.push([alo, bestA, blo, bestB]);
    if (bestA + bestSize < ahi && bestB + bestSize < bhi)
      pending.push([bestA + bestSize, ahi, bestB + bestSize, bhi]);
  }
  return (2 * matched) / (a.length + b.length);
}
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall