data-retention-policies
БесплатноБез исполняемых скриптовНе проверенAutomate the lifecycle of order and customer data — archive old records, anonymize personal data on request, and purge expired data on schedule
от finsilabs★ 69 звёзд на GitHubОб этом скилле
Data Retention Policies
Overview
Data retention policies define how long each category of data is kept, when it is archived, and when it is purged. E-commerce stores must balance legal obligations (tax records must typically be kept 5–7 years) against privacy regulations (GDPR's data minimization principle requires deleting data that is no longer needed). The right approach depends on your platform — Shopify handles some retention automatically, while WooCommerce/custom stores require explicit implementation.
When to Use This Skill
- When implementing GDPR data minimization requirements for a new or existing e-commerce platform
- When legal or compliance teams request a documented data retention policy
- When preparing for a data protection audit or SOC 2 Type II assessment
- When storage costs are growing due to uncontrolled data accumulation
- When a customer submits a Subject Access Request and you need to know exactly where their data lives
Core Instructions
Step 1: Document your retention schedule first
Before configuring any tool, document a retention schedule. Legal, compliance, and engineering must agree before implementation. This Register of Processing Activities (RoPA) is required under GDPR Article 30 for large processors and recommended for all:
| Data Category | Retention Period | Action After Period | Legal Basis |
|---|---|---|---|
| Orders (financial records) | 7 years | Anonymize PII; keep financial data | Tax law (US IRS, EU VAT) |
| Invoices | 7 years | Archive to cold storage | Tax compliance |
| Customer accounts | 3 years after last activity | Delete | Legitimate interest |
| Sessions / login logs | 90 days | Delete | Legitimate interest |
| Marketing email consent | Until unsubscribe | Delete on unsubscribe | GDPR consent |
| Abandoned cart data | 30 days | Delete | Legitimate interest |
| Fraud/security logs | 90 days | Anonymize | Legitimate interest |
| Analytics events | 13 months | Aggregate then delete | Legitimate interest |
Key principle: Never delete what the law requires you to keep. For orders, anonymize the customer's PII (name, email, address) while preserving the financial record (amounts, tax, payment method brand/last 4).
Step 2: Platform-specific retention configuration
Shopify
Shopify stores order data indefinitely by default and handles platform-level data retention for infrastructure components.
Customer data export and deletion (GDPR compliance): Shopify provides built-in GDPR webhooks:
- Go to Settings → Customers → Customer privacy
- Shopify automatically sends
customers/data_requestandcustomers/redactwebhooks to any installed apps when a customer requests their data or deletion - For your own app or custom code, register webhook handlers for these events
Manual customer anonymization:
- Open a customer record → More actions → Anonymize this customer
- Shopify replaces PII with anonymized placeholders while keeping order records
- This is irreversible — confirm before proceeding
Automated email list cleanup: Use Klaviyo (or your email provider) to automatically suppress or delete contacts who haven't opened an email in 12+ months. Most email providers have "sunset" automation features built in.
Data export for archiving:
- Go to Customers → Export to download customer data as CSV for archival
- For orders: Orders → Export
- Store exports in encrypted cold storage (e.g., AWS S3 with Glacier lifecycle policy)
WooCommerce
WooCommerce does not enforce data retention automatically. You need to configure it via plugins and scheduled tasks.
WooCommerce's built-in cleanup:
- Go to WooCommerce → Status → Tools
- Use Clean up WooCommerce sessions to delete expired session data
- Use WooCommerce tracker cleanup to clear tracking data
GDPR / data retention plugin: Install WP GDPR Compliance or GDPR Cookie Consent (by WebToffee):
- Go to WP GDPR Compliance → Settings → Data Retention
- Configure retention periods per data type
- The plugin creates scheduled cleanups via WP-Cron
Manual scheduled cleanup (WP-Cron):
// Add to your theme's functions.php or a custom plugin
// Schedule a daily cleanup job
if (!wp_next_scheduled('wc_data_retention_cleanup')) {
wp_schedule_event(time(), 'daily', 'wc_data_retention_cleanup');
}
add_action('wc_data_retention_cleanup', 'run_data_retention');
function run_data_retention() {
// Delete WooCommerce sessions older than 90 days
global $wpdb;
$wpdb->query(
$wpdb->prepare(
"DELETE FROM {$wpdb->prefix}woocommerce_sessions WHERE session_expiry < %d",
time() - (90 * DAY_IN_SECONDS)
)
);
// Log the cleanup
error_log('WC data retention: cleaned sessions older than 90 days');
}
Order PII anonymization for tax compliance: Do not delete orders (required for tax r
Установить data-retention-policies в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
claude-codecursorgemini-clicopilotcodex-clikiroopencodeВложенные файлы
FAQ
Что делает скилл data-retention-policies?
Automate the lifecycle of order and customer data — archive old records, anonymize personal data on request, and purge expired data on schedule
Как установить скилл data-retention-policies?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл data-retention-policies запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic