Agent skill
cleanup
Run data retention cleanup jobs (quiz responses, PDFs, magic links, blacklist)
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/cleanup
SKILL.md
User Input
$ARGUMENTS
Options: dry-run (preview only), force (execute deletions)
Task
Execute data retention cleanup according to the privacy policy.
Steps
-
Parse Arguments:
dry-runor empty: Preview deletions without executingforce: Execute actual deletions
-
Cleanup Paid Quiz Responses (24h after PDF delivery):
bashcd backend python scripts/cleanup_paid_quiz.py --dry-run # Expected: Delete quiz_responses where pdf_delivered_at < NOW() - 24h -
Cleanup Unpaid Quiz Responses (7 days after creation):
bashpython scripts/cleanup_unpaid_quiz.py --dry-run # Expected: Delete quiz_responses where created_at < NOW() - 7d AND payment_id IS NULL -
Cleanup Meal Plans (90 days after creation):
bashpython scripts/cleanup_meal_plans.py --dry-run # Expected: Delete meal_plans where created_at < NOW() - 90d -
Cleanup PDFs from Vercel Blob (91 days = 90d + 24h grace):
bashpython scripts/cleanup_pdfs.py --dry-run # Expected: Delete blobs where created_at < NOW() - 91d -
Cleanup Expired Magic Links (24h after creation):
bashpython scripts/cleanup_magic_links.py --dry-run # Expected: Delete magic_link_tokens where created_at < NOW() - 24h -
Cleanup Email Blacklist (90-day TTL):
bashpython scripts/cleanup_blacklist.py --dry-run # Expected: Delete email_blacklist where created_at < NOW() - 90d -
Generate Deletion Report:
✅ Data Retention Cleanup Report ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Mode: DRY RUN (no deletions executed) Quiz Responses (Paid): 📊 Found: 145 records eligible for deletion 📅 Oldest: 25 days since PDF delivery 🗑️ Would delete: 145 records Quiz Responses (Unpaid): 📊 Found: 23 records eligible for deletion 📅 Oldest: 15 days old 🗑️ Would delete: 23 records Meal Plans: 📊 Found: 8 records eligible for deletion 📅 Oldest: 95 days old 🗑️ Would delete: 8 records PDFs (Vercel Blob): 📊 Found: 8 blobs eligible for deletion 💾 Space to reclaim: 4.2 MB 🗑️ Would delete: 8 blobs Magic Links: 📊 Found: 67 expired tokens 🗑️ Would delete: 67 records Email Blacklist: 📊 Found: 3 expired entries 🗑️ Would delete: 3 records Total Deletions: 254 records + 8 blobs Space Reclaimed: 4.2 MB ⚠️ This was a DRY RUN. Use '/cleanup force' to execute. -
Execute Deletions (if --force):
- Run all cleanup scripts with --force flag
- Log all deletions to Sentry for audit trail
- Generate post-cleanup report
-
Audit Logging:
bash# Log to Sentry python -c " import sentry_sdk sentry_sdk.capture_message( 'Data cleanup executed', level='info', extra={ 'quiz_deleted': 168, 'meal_plans_deleted': 8, 'pdfs_deleted': 8, 'magic_links_deleted': 67, 'blacklist_deleted': 3 } ) "
Example Usage
/cleanup # Dry run - preview deletions
/cleanup dry-run # Same as above
/cleanup force # Execute actual deletions
Exit Criteria
- All cleanup scripts executed
- Deletion counts reported
- Audit logs created (for force mode)
- Storage space reclaimed calculated
Safety Notes
- Always run dry-run first to verify deletions
- Deletions are permanent - no undo
- Audit trail required - all deletions logged to Sentry
- Compliance - retention policy must be enforced
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?