tomgranot/hubspot-admin-skills/cleanup-lead-owners
Claude Code and agent skill by tomgranot/hubspot-admin-skills
- community
Checking that the SKILL.md file is still in the repository.
Remove non-employee users from HubSpot and reassign their orphaned contacts, companies, and deals. Pairs with the assign-unowned-contacts skill for comprehensive ownership cleanup.
Install
npx vskill@latest install tomgranot/hubspot-admin-skills/cleanup-lead-ownersSKILL.md
Cleanup Lead Owners
Remove departed employees from HubSpot and reassign their CRM records. Orphaned records with no active owner fall through the cracks.
Prerequisites
- A HubSpot service key (
HUBSPOT_ACCESS_TOKENin.env; an existing legacy private app token also works) withcrm.objects.owners.readand contact/company/deal write scopes - Python 3.10+ with `uv`
- 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: Plan
Confirm with the user before starting:
- Who receives reassigned records — a single default owner, or territory/round-robin rules?
- Which flagged users should be deactivated vs merely stripped of records?
Stage 2: Before
Identify non-employee owners via the Owners API:
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 3: Execute
- 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-contacts` after reassignment to catch any records that ended up without an owner.
Stage 4: After
- 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).
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.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cleanup-lead-owners/SKILL.md
Popularity
- Repository stars
- 56
- Repository forks
- 15
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/tomgranot/hubspot-admin-skills/cleanup-lead-owners)