Skip to main content
skill CX Codex

cleanup-lists — Claude Code skill for HubSpot list audits

This skill audits HubSpot lists for empty, unused, or similar entries, then prepares removal candidates for review. Use it when cleaning up list definitions in a HubSpot account.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add TomGranot/hubspot-admin-skills --skill cleanup-lists -a claude-code
Open on GitHub

What cleanup-lists does

The skill inventories HubSpot lists through the Lists API, recording each list’s ID, name, type, member count, and creation and update dates. It can export the inventory to CSV, then flag empty or unused lists, likely duplicates, test lists, and static lists that have not been updated for a long time. Check candidates against workflows, emails, and ad audiences: a list with no members may still act as an enrollment trigger.

You need a HubSpot token in HUBSPOT_ACCESS_TOKEN with crm.lists.read and crm.lists.write permissions, plus Python 3.10+ and uv. The skill asks for explicit approval after presenting removal candidates. HubSpot has no recycle bin for deleted lists, so export their criteria beforehand; for static lists, save member IDs too if needed.

If the Lists API returns 403 for your plan tier, the audit has to be done in the HubSpot UI. After deletion, the skill recommends checking the inventory again and recording the removed lists in a cleanup log.

What it helps with

  • find HubSpot lists with no members or stale static lists
  • check which lists are unused by workflows and emails
  • spot duplicate names and near-matching list filters
  • prepare removal candidates and record the cleanup

Example prompts for the agent

  • Audit the HubSpot lists and export the inventory to CSV.
  • Find lists that no workflows, emails, or ad audiences use.
  • Show me the removal candidates and wait for approval before deleting anything.

How to install cleanup-lists

1Skills CLI (Vercel)

npx skills add TomGranot/hubspot-admin-skills --skill cleanup-lists -a claude-code

2Manually: put the files in place

~/.claude/skills/cleanup-lists/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/cleanup-lists/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about cleanup-lists

How do I install cleanup-lists in Claude Code?

Run npx skills add TomGranot/hubspot-admin-skills --skill cleanup-lists -a claude-code. The skill file is placed at ~/.claude/skills/cleanup-lists/SKILL.md.

What does cleanup-lists do?

It inventories HubSpot lists, flags possible duplicates and unused entries, and prepares removal candidates. It asks for explicit approval before deletion.

What does cleanup-lists need to run?

It needs a HubSpot token in HUBSPOT_ACCESS_TOKEN with crm.lists.read and crm.lists.write permissions, plus Python 3.10+ and uv. If the Lists API returns 403 for your plan tier, perform the audit in the HubSpot UI.

Source text

SKILL.md · MIT
---
name: cleanup-lists
description: "Audit and remove unused, empty, or duplicate list definitions from HubSpot. Identifies lists with zero members, lists not used by any workflow or email, and overlapping list criteria."
license: MIT
metadata:
  author: tomgranot
  version: "1.1"
  category: ongoing-maintenance
---

# Cleanup Lists

Audit HubSpot lists to remove clutter. Unused lists slow down the UI, confuse team members, and can mask the lists that actually matter.

## Prerequisites

- A HubSpot service key (`HUBSPOT_ACCESS_TOKEN` in `.env`; an existing legacy private app token also works) with `crm.lists.read` (and `crm.lists.write` for deletion)
- Python 3.10+ with [`uv`](https://github.com/astral-sh/uv)
- Note: Lists API access may return 403 on some plan tiers. If so, perform the audit manually in the UI.

## Step-by-Step Instructions

### Stage 1: Plan

Confirm with the user before starting:

1. Delete outright, or prefix with "[ARCHIVE]" first and delete next quarter?
2. Any lists that must never be touched (suppression lists, compliance segments, active campaign audiences)?

### Stage 2: Before

Inventory all lists via the Lists API (v3):

```python
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"}

lists, offset = [], 0
while True:
    resp = requests.post(f"{BASE}/crm/v3/lists/search", headers=HEADERS,
                         json={"offset": offset, "count": 100})
    resp.raise_for_status()
    data = resp.json()
    lists.extend(data.get("lists", []))
    if not data.get("hasMore"):
        break
    offset = data.get("offset", offset + 100)
```

For each list, record: list ID, name, processing type (DYNAMIC/MANUAL), member count (`additionalProperties`), created date, last updated date.

Export to CSV for review.

### Stage 3: Execute

Flag lists matching any of these criteria:

1. **Zero members** and created more than 30 days ago
2. **Not referenced** by any workflow, email, or ad audience
3. **Duplicate names** or nearly identical filter criteria
4. **Test/temp lists** (names containing "test", "temp", "copy of", "old")
5. **Static lists** that have not been updated in 6+ months

Cross-reference with workflows and email campaigns before deleting — a list with zero members might still be used as an enrollment trigger.

Present the candidate list to the user and wait for explicit confirmation, then delete via `DELETE /crm/v3/lists/{listId}` or the UI.

### Stage 4: After

1. Re-run the inventory and confirm the deleted lists are gone.
2. Document what was deleted (list name, ID, reason) in a cleanup log.
3. Inform team members if any lists they created were removed.

## Rollback

- HubSpot does not have a list recycle bin. Deleted lists cannot be restored.
- Before deleting, export the list definition (filters/criteria) so it can be recreated if needed.
- Static lists: export member IDs before deletion if the membership data matters.

## Tips

- Run this quarterly as part of the database cleanup routine.
- Establish a naming convention going forward (e.g., prefix with team name or purpose).
- Archive lists by prefixing with "[ARCHIVE]" instead of deleting if you are unsure.

© tomgranot · MIT · TomGranot/hubspot-admin-skills

Similar skills

SKILL.md skills catalog →

From the same set37

create-icp-tiers Classifies HubSpot companies into ICP tiers using firmographic data. Creates a custom dropdown property via API and prepares 4 classification workflows. CX Codex +1 ★ 78repo stars connect-hubspot-mcp Connect Claude Code to HubSpot’s remote MCP server for CRM lookups, spot checks, and small edits that require confirmation. CX Codex +1 ★ 78repo stars cleanup-workflows Audits HubSpot workflows and flags the ones worth deleting: never enrolled, switched off for 90+ days, or left over from testing. CX Codex +1 ★ 78repo stars cleanup-properties Audits and archives unused custom properties across HubSpot contacts, companies, and deals. Prevents property bloat through the Properties API. CX Codex +1 ★ 78repo stars cleanup-lead-owners Strips departed employees out of HubSpot and moves their contacts, companies and deals to someone still on the team. Handy the week a person leaves. CX Codex +1 ★ 78repo stars cleanup-forms Audits and cleans up unused, test, and deprecated HubSpot forms via the Forms API. Keeps dashboards, workflows, and reporting clean. CX Codex +1 ★ 78repo stars cleanup-deals Finds overdue, stale, incomplete and likely test HubSpot deals, then routes flagged records to their owners for review. Test-deal deletion requires a human-reviewed CSV. CX Codex +1 ★ 78repo stars cleanup-dashboards Walks you through auditing HubSpot dashboards: spots abandoned screens, duplicates and test copies, then helps merge reports into a few that people actually open. CX Codex +1 ★ 78repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor