Skip to main content
skill CX Codex

cleanup-forms — Claude Code skill: what it does, how to install

Audits and cleans up unused, test, and deprecated HubSpot forms via the Forms API. Keeps dashboards, workflows, and reporting clean.

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

What cleanup-forms does

The skill inventories HubSpot forms to remove leftover test drafts and abandoned assets. First, it asks whether to delete forms immediately or tag them with a [DEPRECATED] prefix. It also lets you protect legal, compliance, or campaign forms from accidental changes. Then it fetches the complete list via Marketing Forms API v3, recording submission counts, creation dates, and last submission timestamps.

Candidates for removal include forms with zero submissions over 30 days, forms inactive for six months, and items containing keywords like test, temp, or draft. Crucially, deleted forms cannot be restored in HubSpot. While contact records keep their submission logs, the form definition itself disappears forever unless exported beforehand.

You need Python 3.10+, uv, and a HUBSPOT_ACCESS_TOKEN in .env with the forms scope. Some HubSpot tiers return a 403 on the Forms API, forcing you to finish the cleanup manually under Marketing > Forms.

What it helps with

  • identify HubSpot forms with zero submissions older than 30 days
  • flag test and draft forms left over from development
  • verify whether stale forms are tied to active workflows or live pages
  • remove confirmed unused forms through Marketing Forms API v3

Example prompts for the agent

  • Audit our HubSpot forms and list those with zero submissions created over a month ago
  • Find all forms with test or draft in the name and check if they are embedded anywhere
  • Prefix inactive HubSpot forms with [DEPRECATED] instead of deleting them right away

How to install cleanup-forms

1Skills CLI (Vercel)

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

2Manually: put the files in place

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

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

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

Questions about cleanup-forms

How do I install cleanup-forms in Claude Code?

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

What permissions and tools are required?

You need Python 3.10+, uv, and a HUBSPOT_ACCESS_TOKEN in your .env file granted the forms scope.

Can deleted forms be restored in HubSpot?

No, deleted forms cannot be restored. Contact records preserve past submissions, but the form structure must be exported beforehand if you need a backup.

Source text

SKILL.md · MIT
---
name: cleanup-forms
description: "Audit and remove unused, test, or deprecated forms from HubSpot. Identifies forms with zero submissions, forms not embedded on any page, and test forms left over from development."
license: MIT
metadata:
  author: tomgranot
  version: "1.1"
  category: ongoing-maintenance
---

# Cleanup Forms

Audit HubSpot forms to remove unused and test forms. Stale forms clutter the forms dashboard and can cause confusion when building workflows or reports.

## Prerequisites

- A HubSpot service key (`HUBSPOT_ACCESS_TOKEN` in `.env`; an existing legacy private app token also works) with `forms` scope
- Python 3.10+ with [`uv`](https://github.com/astral-sh/uv)
- Note: The Forms API may return 403 on some plan tiers. If so, perform the audit manually in the HubSpot UI under Marketing > Forms.

## Step-by-Step Instructions

### Stage 1: Plan

Confirm with the user before starting:

1. How aggressive to be: delete outright, or prefix with "[DEPRECATED]" first and delete next quarter?
2. Any forms that must never be touched (compliance, legal, active campaigns)?

### Stage 2: Before

Inventory all forms via the Marketing Forms 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"}

forms, after = [], None
while True:
    params = {"limit": 100}
    if after:
        params["after"] = after
    resp = requests.get(f"{BASE}/marketing/v3/forms", headers=HEADERS, params=params)
    resp.raise_for_status()
    data = resp.json()
    forms.extend(data.get("results", []))
    after = data.get("paging", {}).get("next", {}).get("after")
    if not after:
        break
```

For each form, record: form ID, name, type, submission count, created date, last submission date.

### Stage 3: Execute

Flag forms matching any of these criteria:

1. **Zero submissions** and created more than 30 days ago
2. **No recent submissions** (last submission 6+ months ago) and not embedded on an active page
3. **Test forms** (names containing "test", "temp", "draft", "copy of")
4. **Deprecated forms** replaced by newer versions

Before deleting, check:
- Is the form referenced in any workflow enrollment trigger?
- Is the form embedded on any live landing page or website page?
- Is the form used in any pop-up or slide-in CTA?

Present the candidate list to the user and wait for explicit confirmation, then delete confirmed unused forms via the API (`DELETE /marketing/v3/forms/{formId}`) or UI.

### Stage 4: After

1. Re-run the inventory and confirm the deleted forms are gone.
2. Document what was deleted in a cleanup log.
3. If a form with submissions is deleted, the submission data is retained on the contact records — but the form definition is gone.

## Rollback

- Deleted forms cannot be restored in HubSpot.
- Before deleting a form with any submissions, export the form definition (field names, settings) so it can be recreated.
- Contact records retain their form submission history regardless of form deletion.

## Tips

- Establish a naming convention: `[TEAM] - Purpose - Version` (e.g., `[Marketing] - Webinar Registration - v2`).
- Prefix deprecated forms with "[DEPRECATED]" instead of deleting immediately — delete after one quarter of no usage.

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

Similar skills

All skills for Marketing and content →

From the same set37

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-lists 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. 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-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 build-smart-lists Creates core active dynamic lists in HubSpot using Lists API v3 and provides rules for UI-built segments. Useful for standardizing marketing audiences and sales prioritization. CX Codex +1 ★ 78repo stars build-lead-scoring This skill guides HubSpot setup for separate company-fit and contact-engagement scores. Use it to help sales and marketing prioritize leads by different signals. 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