contact-extraction
Skill2 starsChanged 3 months agoApache-2.0View on GitHub
Extracts a best-guess contact email for each firm in an Airtable Firms table by scraping the firm website (homepage plus contact/about pages, mailto and plaintext harvest), then writes one Contact per firm back to Airtable, deduped against existing Contacts. Use whenever the operator wants to get emails for discovered firms, run Stage 02, extract contacts, or find contact addresses for a list of firms. Reads Firms via the Airtable connector, runs the scraper in code execution, writes Contacts via the connector.
- Reads credentials
In this repository7 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- client-onboardingSkill
- corporate-researchSkill
- email-generationSkill
- firm-discoverySkill
- firm-reviewSkill
- voice-intakeSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
Read the Business Profile table (single row).
- Very specific: line 35
Write business-profile.json in the working directory:
- Very specific: line 43
Read the Firms table (read tools accept the plain name "Firms").
- Very specific: line 47
Write the firms to firms.json in the working directory as a JSON array.
- Distinctive: line 101
Keep the firm id → Contact record id mapping from these writes.
- Very specific: line 130
Read stage-02-final.json and reconcile it against what step 4 already wrote.
- Distinctive: line 139
The scrape held: leave the record alone.
- Very specific: line 170
Do not put in the pass 1 report: a table of every firm and its address, hit rate percentages or commentary on whether the rate is good, an …
- Very specific: line 176
Never end pass 1 with two open questions.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Contact Extraction
Version: 2.0.0 · Center for Rural AI
Turns discovered Firms into Contact records, one best email each. The scrape
logic is the real Stage 02 core (stage-02-extraction.mjs), unchanged.
extract.mjs is the runner: input loading, a resumable holding file, progress
logging, an optional graceful deadline. Neither script touches Airtable.
Flow: connector, then script, then connector
The connector handles the read and the write. The script does the scraping in between. This split is deliberate and proven.
0. Read Business Profile via the connector
Read the Business Profile table (single row). If the table is empty, stop and
tell the operator to run the client-onboarding skill first. business-url
is required: the scraper's User-Agent has no fallback for a missing URL, so a
blank field is also a hard stop.
Write business-profile.json in the working directory:
{ "business-name": "Example Inn", "business-url": "https://www.example.com" }1. Read Firms via the connector
Read the Firms table (read tools accept the plain name "Firms"). Filter to the
segment in play (e.g. Wedding). Keep each firm's Airtable record id (the rec...
value): it is the link key for the Contact you will write.
Write the firms to firms.json in the working directory as a JSON array. The
runner accepts the Airtable record shape directly:
{ "id": "rec...", "fields": { "firm-name": "...", "website-url": "..." } }
2. Dedup against existing Contacts, before scraping
The connector does not dedup. Read existing Contacts, collect their linked firm
ids into a Set, and remove any firm already linked to a Contact from
firms.json. Skipping this creates duplicate Contacts. This is the reliable
pattern.
3. Run the scraper
node extract.mjs --input firms.json --out stage-02-results.jsonOne attempt per firm, no retries. Results are written after every firm (crash
safe and resumable: re-running skips firms already done). For a large batch add
--deadline-ms 45000 to stop cleanly before a session limit, then run again to
resume.
Each result carries: firm_id (the link key), email (best), all_emails,
status ("found" or "needs_manual"), contact_source ("Scraped"), and
email_verified (always false: scraping is not deliverability).
4. Write Contacts via the connector, before offering pass 2
Write as soon as pass 1 finishes. Do not hold results back waiting for a
decision about Hunter. Everything up to this point lives only in
stage-02-results.json in the session's working directory. That file is crash-safe
within a session, but it does not survive the session ending: a closed tab, a
dropped connection, or a hit session limit takes the whole batch with it, and any
Hunter credits already spent are spent for nothing. Airtable is the only durable
place, so get the rows in early. Pass 2 updates them in place (step 6), so writing
first costs nothing.
For each found result, create one Contact linked to its firm. Write them
without asking — this is the step the operator asked for, and a Contact with an
email is never the wrong outcome.
Skip needs_manual results by default: a blank-email Contact is a row
email-generation cannot send to, so it buys nothing and clutters the table. The
firm stays in Firms either way, so nothing is lost and the Hunter pass (step 5) or
a later re-run can still fill it in. Only write blank-email placeholders if the
operator asks for them by name.
Writes require ids, not names. The create tool rejects the plain table name. You
need the Contacts table id (tbl...) and field ids (fld...). If
list_tables_for_base does not return them reliably, ask the operator to open
the Contacts table in Airtable and paste the URL: the tbl id is in it. Pass the
linked firm as a list containing the firm record id string. Pass email-verified
as boolean false.
Keep the firm id → Contact record id mapping from these writes. Step 6 needs it to update rather than duplicate.
5. Optional: enrich weak results with Hunter
extract.mjs's scrape alone finds an address, not a person, and often
nothing usable at all — a Hunter Domain Search pass recovers named contacts
and upgrades generic inboxes on the firms the scrape left weak.
A Hunter key is required (a paid plan — the free tier's 25 searches/month
isn't meaningful at real batch volume; the first paid tier's 24K credits is).
Resolve it the same way discover.mjs resolves Serper's, and in the same order:
read hunter-api-key from the single-row Airtable Config table via the connector
first, and only if that cell is empty ask the user to paste one (telling them it
belongs in base → Config table → hunter-api-key) or upload a hunter.key file
next to the script. Do not echo the key back into the conversation.
node enrich.mjs --hunter-key <key>
# or: HUNTER_API_KEY=<key> node enrich.mjsReads stage-02-results.json (from step 3) and firms.json (from step 1,
for a needs_manual firm's website), queries Hunter only for firms that were
needs_manual or had a generic shared-inbox address, and writes
stage-02-final.json — same crash-safe/resumable pattern as extract.mjs.
6. Update Contacts with what pass 2 won
Read stage-02-final.json and reconcile it against what step 4 already wrote.
Same rule as step 4: apply it, do not ask first. Per firm:
- Hunter won, and the firm already has a Contact (it was
foundin pass 1): update that record in place. Setemail,all-emails,first-name,last-name,title, andcontact-sourceto "Hunter". Update, never create, or you get two Contacts for one firm. - Hunter recovered a firm that was
needs_manual(so step 4 skipped it): create the Contact now, exactly as step 4 would have. - The scrape held: leave the record alone.
Then report, briefly: how many records gained a real name, how many firms were
recovered from needs_manual, and the running total of Contacts. Do not re-list
every firm — the table is in Airtable, and they can look.
Field mapping (holding file to Contacts)
emailtoemailall_emails(array) toall-emails(newline joined)contact_sourcetocontact-sourceemail_verifiedtoemail-verified(false)firm_idtofirm-id(link: a list holding the firm record id)- first-name, last-name, title: blank unless the Hunter enrichment step (step 5) ran and won for that firm — the scrape alone yields no name.
contact_sourceis "Scraped" unless Hunter's result won, in which case it's "Hunter".
Reporting pass 1
The operator wants to know it worked and what to do next. They do not want a per-firm audit. Keep the whole report to a few lines, in this shape:
- Lead with the result. "10 of your 14 firms now have a contact email, saved to Contacts." That is the headline, and it goes first.
- Name only the firms with no email, as a short list. These are the ones the next step goes after, so they are the only per-firm detail that earns its place.
- Close with the Hunter prompt, as an invitation to one action: say that
Hunter can chase the ones that came up empty and can also put a real name to
the generic
info@style addresses, then ask if they want to run it.
Do not put in the pass 1 report: a table of every firm and its address, hit
rate percentages or commentary on whether the rate is good, an explanation of why
first-name/title are blank, the email_verified or contact_source values, or
Hunter's pricing tiers. All of that is either already visible in Airtable or
irrelevant to the one decision in front of them.
Never end pass 1 with two open questions. The needs_manual firms are handled by
the default above, so the only question is whether to run Hunter.
Known limits
- Scraping finds an address, not a person. The optional Hunter step (step 5) recovers names for weak results; without it, or where Hunter also comes up empty, names stay blank.
fetch()plus regex only. No paid APIs, no new dependencies.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

