Install
$ agentstack add skill-tomgranot-hubspot-admin-skills-cleanup-lead-owners ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ● Environment & secrets Used
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Cleanup Lead Owners
Remove departed employees from HubSpot and reassign their CRM records. Orphaned records with no active owner fall through the cracks.
Prerequisites
- HubSpot API token in
.env - Python with
hubspot-api-clientinstalled viauv - A list of current employees (to compare against HubSpot users)
- A default owner or round-robin assignment rule for orphaned records
Step-by-Step Instructions
Stage 1: Before — Identify Non-Employee Owners
from hubspot import HubSpot
api_client = HubSpot(access_token=os.getenv("HUBSPOT_API_TOKEN"))
# Get all owners including deactivated
active_owners = api_client.crm.owners.owners_api.get_page(limit=100)
deactivated_owners = api_client.crm.owners.owners_api.get_page(
limit=100, archived=True
)
Cross-reference with your current employee list. Flag:
- Deactivated HubSpot users who still own records
- Active HubSpot users who are no longer employees
- Contractors or vendors who should not own records
For each flagged owner, count how many contacts, companies, and deals they own.
Stage 2: Execute — Reassign and Deactivate
- Reassign records owned by non-employees:
- Use the batch update API to reassign contacts to the appropriate active owner
- Apply round-robin or territory-based rules if no specific owner is obvious
- Reassign companies and deals associated with the same contacts
- Deactivate users who are no longer employees (requires Super Admin in HubSpot Settings > Users & Teams).
- Run
/assign-unowned-contactsafter reassignment to catch any records that ended up without an owner.
Stage 3: After — Verify
- Search for contacts where
hubspot_owner_idmatches any deactivated owner ID — count should be zero. - Confirm all reassigned contacts have an active owner.
- Check that no workflows broke due to owner changes (some workflows may filter by specific owners).
Stage 4: Rollback
- Owner reassignments can be reversed by batch-updating the
hubspot_owner_idback to the original value. - Keep a log of original owner assignments before making changes.
- Deactivated users can be reactivated in HubSpot Settings if needed.
Tips
- Run this whenever an employee leaves the company — do not wait for quarterly cleanup.
- Set up an offboarding checklist that includes HubSpot record reassignment.
- Pairs with
/assign-unowned-contactsfor comprehensive ownership hygiene.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: TomGranot
- Source: TomGranot/hubspot-admin-skills
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.