cleanup-properties — скилл для Claude Code
Находит и архивирует неиспользуемые пользовательские поля в сделках, контактах и компаниях HubSpot. Защищает от переполнения свойств CRM.
npx skills add TomGranot/hubspot-admin-skills --skill cleanup-properties -a claude-codeЧто делает cleanup-properties
Скилл сканирует кастомные свойства объектов contacts, companies и deals через HubSpot Properties API v3. Скрипт проверяет наличие значений в записях и определяет, привязано ли свойство к активным формам, спискам или воркфлоу.
Поля с нулевым числом заполненных записей и названиями вроде test, temp или old_ помечаются на удаление. Свойства интеграций с префиксом hs_salesforce_* и вычисляемые поля скилл требует согласовывать перед очисткой. Сначала выполняется архивация через API-запрос, чтобы данные не исчезли безвозвратно.
Для работы нужны Python 3.10+ с пакетным менеджером uv и токен HUBSPOT_ACCESS_TOKEN в .env. Без разрешений crm.schemas.*.read и crm.schemas.*.write запросы к схеме завершатся ошибкой доступа.
Какие задачи решает
- найти пустые кастомные поля в сделках, контактах и компаниях
- архивировать устаревшие свойства без безвозвратной потери данных
- проверить зависимости полей от активных форм и воркфлоу
- выявить тестовые поля с префиксами temp_ и old_
Примеры запросов агенту
- Проверь кастомные свойства в сделках и найди поля без заполненных значений
- Архивируй неиспользуемые тестовые поля контактов через HubSpot API
- Составь список свойств с префиксом old_ для компаний
Как установить cleanup-properties
1Через Skills CLI (Vercel)
npx skills add TomGranot/hubspot-admin-skills --skill cleanup-properties -a claude-code2Вручную: положить файлы
~/.claude/skills/cleanup-properties/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/cleanup-properties/
1Через Skills CLI (Vercel)
npx skills add TomGranot/hubspot-admin-skills --skill cleanup-properties -a codex2Вручную: положить файлы
.agents/skills/cleanup-properties/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add TomGranot/hubspot-admin-skills --skill cleanup-properties -a cursor2Вручную: положить файлы
.cursor/skills/cleanup-properties/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install TomGranot/hubspot-admin-skills cleanup-properties2Вручную: положить файлы
.github/skills/cleanup-properties/SKILL.md1Через Skills CLI (Vercel)
npx skills add TomGranot/hubspot-admin-skills --skill cleanup-properties -a gemini-cli2Командой платформы
gemini skills install https://github.com/TomGranot/hubspot-admin-skills --path skills/cleanup-propertiesВручную: положить файлы
.devin/skills/cleanup-properties/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add TomGranot/hubspot-admin-skills --skill cleanup-properties -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о cleanup-properties
Как установить cleanup-properties в Claude Code?
Выполните команду npx skills add TomGranot/hubspot-admin-skills --skill cleanup-properties -a claude-code. Скилл сохранится в файл ~/.claude/skills/cleanup-properties/SKILL.md.
Что делает cleanup-properties?
Скилл подключается к HubSpot Properties API, выявляет брошенные свойства объектов и пошагово архивирует их с возможностью отката.
Можно ли восстановить удалённые поля?
Архивированные свойства можно разархивировать в любой момент. Если свойство удалено окончательно, восстановить его параметры и историю значений нельзя.
Исходный текст
SKILL.md · MIT
---
name: cleanup-properties
description: "Archive or delete unused custom properties across all HubSpot object types (contacts, companies, deals). Identifies Salesforce sync properties, test/temp properties, and obsolete form fields."
license: MIT
metadata:
author: tomgranot
version: "1.1"
category: ongoing-maintenance
---
# Cleanup Properties
Remove or archive unused custom properties. Property bloat slows down forms, confuses users, and makes data mapping harder.
## Prerequisites
- A HubSpot service key (`HUBSPOT_ACCESS_TOKEN` in `.env`; an existing legacy private app token also works) with `crm.schemas.*.read` and `crm.schemas.*.write` scopes
- Python 3.10+ with [`uv`](https://github.com/astral-sh/uv)
## Step-by-Step Instructions
### Stage 1: Plan
Confirm with the user before starting:
1. Archive-first policy (recommended) or direct deletion for clearly dead test properties?
2. Is a Salesforce (or other CRM) sync active? If yes, get the sync property mapping before touching anything.
### Stage 2: Before
Inventory custom properties for each object type via the Properties 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"}
for obj_type in ["contacts", "companies", "deals"]:
resp = requests.get(f"{BASE}/crm/v3/properties/{obj_type}", headers=HEADERS)
resp.raise_for_status()
custom_props = [p for p in resp.json()["results"] if not p.get("hubspotDefined")]
```
For each custom property, record: name, label, object type, type, group, number of records with a value (requires search queries), whether it is used in any form/workflow/list.
### Stage 3: Execute
**Safe to delete:**
- Properties with zero populated records and not used in any form, workflow, or list
- Properties with names containing "test", "temp", "old_", "copy_of"
- Properties created by deactivated integrations
**Handle with care:**
- **Salesforce sync properties** (`hs_salesforce_*` prefix or mapped in sync settings) — do not delete without coordinating with the Salesforce admin
- **Form fields** — check if the property is used on any active form before deleting
- **Workflow dependencies** — check if any workflow reads or sets this property
- **Calculated properties** — check if other calculated properties reference this one
**Archive instead of delete** when:
- The property has historical data that might be needed for reporting
- You are unsure whether anything depends on it
Archive candidates via `DELETE /crm/v3/properties/{objectType}/{propertyName}` (this archives — the property moves to the archived state) after presenting the list to the user and getting explicit confirmation.
### Stage 4: After
1. Archive properties first (HubSpot supports property archiving).
2. Wait 30 days, then delete archived properties that caused no issues.
3. Document all changes in a cleanup log.
## Rollback
- Archived properties can be unarchived at any time.
- Deleted properties cannot be restored. The property definition and all associated data are permanently lost.
- Always archive before deleting to provide a safety window.
## Tips
- Run this quarterly as part of the database cleanup routine.
- Establish a property naming convention going forward (e.g., `team_purpose_detail`).
- Limit who can create custom properties to prevent sprawl.
- HubSpot has a property limit per object type — cleanup prevents hitting it.
© tomgranot · MIT · TomGranot/hubspot-admin-skills