Skip to content

getaero-io/gtm-eng-skills / skills/deepline-ads-audiences

deepline-ads-audiences

Verified

Use this skill when building, enriching, auditing, or uploading B2B paid ads audiences to Google Customer Match, Meta/Facebook Custom Audiences, or LinkedIn Matched Audiences. Triggers on phrases like '/deepline-ads-audience', '/deepline-ads-audiences', 'upload this audience', 'create custom audiences', 'personal email hashes', 'increase Facebook match rate', 'Google ads audience', 'Meta audience', 'FB audience', or any workflow that turns CRM/customer/contact data into paid ads upload lists. Skip for outbound prospecting sequences, cold email, or pure campaign copywriting.

plays/audit-no-double-hash.play.ts

View on GitHub
import deepline from 'deepline';
import {
  auditHashRows,
  auditUploadFile,
  normalizeSha256,
  sha256Hex,
} from './shared/audience-hash';

type HashRow = Record<string, string | undefined>;

function collectHashes(row: HashRow, columns: string[]): string[] {
  const hashes: string[] = [];
  for (const column of columns) {
    const hash = normalizeSha256(row[column]);
    if (hash) hashes.push(hash);
  }
  return hashes;
}

export const config = {
  name: 'ads-audience-audit-no-double-hash',
  description:
    'Verify a paid-ads upload payload is hash-only, deduped, and free of hash-of-hash mistakes before it reaches a platform.',
};

export default async function (input: {
  payloadFile: string;
  providerHashFile: string;
  providerHashColumns?: string[];
}) {
  const payloadDataset = await deepline.csv<HashRow>(input.payloadFile);
  const providerDataset = await deepline.csv<HashRow>(input.providerHashFile);
  const payloadRows = await payloadDataset.materialize();
  const providerRows = await providerDataset.materialize();
  const providerHashColumns = input.providerHashColumns ?? [
    'email_sha256',
    'personal_email_sha256',
    'hashed_personal_email_sha256',
    'aviato_hash',
    'limadata_hash',
  ];

  const payloadHashes = new Set(
    payloadRows
      .map((row) => normalizeSha256(row.email_sha256))
      .filter((hash): hash is string => Boolean(hash)),
  );
  const providerHashes = new Set<string>();
  providerRows.forEach((row) => {
    collectHashes(row, providerHashColumns).forEach((hash) =>
      providerHashes.add(hash),
    );
  });

  const missingProviderHashes = Array.from(providerHashes).filter(
    (hash) => !payloadHashes.has(hash),
  );
  const doubleHashedProviderHashes = Array.from(providerHashes)
    .map((hash) => sha256Hex(hash))
    .filter((hash) => payloadHashes.has(hash));
  const audit = auditHashRows(payloadRows);
  // Column purity, plain names beside hashed emails, names without zip, and
  // hash-of-hash inside the payload itself: each uploads cleanly and matches
  // nothing, so this is the only place they can be caught.
  const fileAudit = auditUploadFile(payloadRows);

  const ok =
    audit.malformedHashes === 0 &&
    audit.duplicateHashes === 0 &&
    audit.rawEmailFieldsPresent === false &&
    fileAudit.ok &&
    missingProviderHashes.length === 0 &&
    doubleHashedProviderHashes.length === 0;

  if (!ok) {
    throw new Error(
      JSON.stringify({
        message: 'Audience hash audit failed.',
        audit,
        file_audit: fileAudit,
        provider_hashes: providerHashes.size,
        missing_provider_hashes: missingProviderHashes.length,
        double_hashed_provider_hashes: doubleHashedProviderHashes.length,
        missing_provider_hash_examples: missingProviderHashes.slice(0, 5),
        double_hashed_provider_hash_examples: doubleHashedProviderHashes.slice(
          0,
          5,
        ),
      }),
    );
  }

  return {
    ok: true,
    audit,
    file_audit: fileAudit,
    provider_hashes: providerHashes.size,
    missing_provider_hashes: 0,
    double_hashed_provider_hashes: 0,
  };
}
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: 196kUpdated Claude CodeCodexVerifiedInstall