Cleanup Deals
by @tomgranot
Standardize deal pipelines, remove test deals, and address deals with missing amounts or close dates. Coordinates with Salesforce sync if applicable.
clawhub install cleanup-dealsπ About This Skill
name: cleanup-deals description: "Standardize deal pipelines, remove test deals, and address deals with missing amounts or close dates. Coordinates with Salesforce sync if applicable." license: MIT metadata: author: tomgranot version: "1.0" category: ongoing-maintenance
Cleanup Deals
Standardize deal data to make pipeline reporting accurate. Test deals, missing amounts, and stale opportunities distort forecasts and pipeline metrics.
Prerequisites
.envhubspot-api-client installed via uvImportant: Salesforce Sync Considerations
If deals are synced from Salesforce:
hs_salesforceopportunityid property.Step-by-Step Instructions
Stage 1: Before β Audit Deal Data
Pull deal metrics via the API:
from hubspot import HubSpot
from hubspot.crm.deals import PublicObjectSearchRequestapi_client = HubSpot(access_token=os.getenv("HUBSPOT_API_TOKEN"))
Deals missing amount
no_amount = PublicObjectSearchRequest(
filter_groups=[{
"filters": [{
"propertyName": "amount",
"operator": "NOT_HAS_PROPERTY"
}]
}]
)Deals missing close date
no_close = PublicObjectSearchRequest(
filter_groups=[{
"filters": [{
"propertyName": "closedate",
"operator": "NOT_HAS_PROPERTY"
}]
}]
)
Record: total deals, deals per pipeline stage, deals missing amount, deals missing close date, stale deals (open with no activity in 60+ days).
Stage 2: Execute β Clean Up
1. Delete test deals β search for deals with names containing "test", "demo", "sample", or with amount = $0 and no associated contacts.
2. Address missing amounts β export deals without amount and work with sales to fill in values or mark as lost.
3. Close stale deals β deals open with no activity in 90+ days should be reviewed with the deal owner. Set to "Closed Lost" if abandoned.
4. Standardize pipeline stages β ensure all pipelines have consistent stage names and probability percentages.
5. Remove unused pipelines β if a pipeline has zero active deals and is not in use, archive or delete it.
Stage 3: After β Verify
1. Re-run the deal audit queries. Confirm: - Test deals removed - Missing amount count decreased - Stale deal count decreased 2. Check pipeline reports for accuracy.
Stage 4: Rollback
Tips
amount and closedate as mandatory deal properties to prevent future gaps.βοΈ Configuration
.envhubspot-api-client installed via uvπ Tips & Best Practices
amount and closedate as mandatory deal properties to prevent future gaps.