backfill-geo-data
Skill75 starsChanged 20 days agoMITView on GitHub
Enrich missing geographic data (country, state, city) on contacts and companies using HubSpot workflows, external data providers, or IP-based geolocation.
- Reads credentials
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
Use HubSpot's built-in Operations Hub data quality tools or Breeze Intelligence (if available on your plan) to auto-fill geographic fields.
- Distinctive: line 27
Create a workflow triggered by: country is unknown AND email is known
- Distinctive: line 28
Use the "Enrich contact" action (Operations Hub Professional+) or Breeze Intelligence enrichment
- Distinctive: line 29
If enrichment fills country/state, the workflow completes
- Distinctive: line 30
If enrichment fails, branch to flag for manual review
- Very specific: line 61
Use /waterfall-enrich-contacts — it provides pluggable provider adapters (FullEnrich by default.
- Very specific: line 90
If enrichment data is inaccurate, filter contacts updated by the enrichment process (use hs_lastmodifieddate range) and clear the geo …
- Distinctive: line 91
Keep a backup export of the original data before running enrichment.
- Distinctive: line 96
Do not overwrite manually-entered geo data with enrichment data — always check "if empty" before writing.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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
Backfill Geographic Data
Fill in missing country, state, and city values on contacts and companies. Geographic data enables territory assignment, regional reporting, and compliance (GDPR, state privacy laws).
Prerequisites
- A HubSpot service key (
HUBSPOT_ACCESS_TOKENin.env; an existing legacy private app token also works) with contact and company read/write scopes - Python 3.10+ with
uv - Standardized geo values already in place (run
/standardize-geo-valuesfirst)
Enrichment Methods
Method 1: HubSpot Workflow Enrichment (Simplest)
Use HubSpot's built-in Operations Hub data quality tools or Breeze Intelligence (if available on your plan) to auto-fill geographic fields.
- Create a workflow triggered by: country is unknown AND email is known
- Use the "Enrich contact" action (Operations Hub Professional+) or Breeze Intelligence enrichment
- If enrichment fills country/state, the workflow completes
- If enrichment fails, branch to flag for manual review
Method 2: Company Domain Lookup (API-based)
For contacts with a company domain but no geo data, look up the company's geographic information:
import os, requests
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.environ["HUBSPOT_ACCESS_TOKEN"]
BASE = "https://api.hubapi.com"
HEADERS = {"Authorization": f"Bearer {TOKEN}", "Content-Type": "application/json"}
# Find contacts missing country but with company association
resp = requests.post(f"{BASE}/crm/v3/objects/contacts/search", headers=HEADERS, json={
"filterGroups": [{"filters": [
{"propertyName": "country", "operator": "NOT_HAS_PROPERTY"},
{"propertyName": "associatedcompanyid", "operator": "HAS_PROPERTY"},
]}],
"properties": ["email", "associatedcompanyid"],
"limit": 100,
})
resp.raise_for_status()Copy country/state/city from the associated company to the contact (same pattern as /enrich-company-name).
Method 3: External Data Provider
Use /waterfall-enrich-contacts — it provides pluggable provider adapters (FullEnrich by default; Apollo, Hunter, Dropcontact included, or bring your own), per-run cost caps, no-overwrite safety, and a CSV audit trail. Exhaust Methods 1-2 first: external lookups cost credits per contact, internal data is free.
Step-by-Step Instructions
Stage 1: Plan
- Choose the enrichment method (see above) based on volume, plan tier, and budget — confirm with the user.
- Confirm the no-overwrite rule: enrichment must only fill empty fields.
Stage 2: Before — Assess the Gap
- Count contacts missing country, state, and city.
- Segment by source — which lead sources tend to have missing geo data?
- Export a CSV baseline of the affected records before changing anything.
Stage 3: Execute — Run Enrichment
- Apply the chosen method (or combine methods for maximum coverage).
- Process in batches of 100 to respect rate limits.
- Validate enriched values against the standardized geo format from
/standardize-geo-values.
Stage 4: After — Verify
- Re-count contacts missing geographic fields. Calculate improvement percentage.
- Spot-check 20-30 enriched contacts for accuracy.
- Set up the new-contact hygiene workflow to prevent future gaps.
Rollback
- If enrichment data is inaccurate, filter contacts updated by the enrichment process (use
hs_lastmodifieddaterange) and clear the geo fields. - Keep a backup export of the original data before running enrichment.
Tips
- IP-based geolocation (from form submissions) is already captured by HubSpot in
ip_city,ip_state,ip_country. Copy these to the standard fields if the standard fields are empty. - Do not overwrite manually-entered geo data with enrichment data — always check "if empty" before writing.
In this repository40 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- assign-unowned-contactsSkill
- audit-api-usageSkill
- bounce-monitoring-workflowSkill
- build-lead-scoringSkill
- build-smart-listsSkill
- cleanup-dashboardsSkill
- cleanup-dealsSkill
- cleanup-formsSkill
- cleanup-lead-ownersSkill
- cleanup-listsSkill
- cleanup-propertiesSkill
- cleanup-workflowsSkill
- connect-hubspot-agent-cliSkill
- connect-hubspot-mcpSkill
- create-icp-tiersSkill
- create-segment-listsSkill
- delete-no-email-contactsSkill
- engagement-suppression-workflowSkill
- enrich-company-nameSkill
- enrich-industrySkill
- fix-lifecycle-stagesSkill
- hubspot-auditSkill
- hubspot-implementation-planSkill
- hubspot-marketing-auditSkill
- hubspot-sales-auditSkill
- lifecycle-progression-workflowSkill
- merge-duplicate-companiesSkill
- new-contact-hygiene-workflowSkill
- quarterly-database-cleanupSkill
- reassign-deactivated-ownersSkill
- review-bounced-contactsSkill
- sandbox-self-testSkill
- standardize-geo-valuesSkill
- suppress-ghost-contactsSkill
- suppress-global-unsubscribesSkill
- suppress-hard-bouncedSkill
- waterfall-enrich-contactsSkill
- weekly-cleanup-routineSkill
- workflows-as-codeSkill
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.

