/engineering:saas-tenant-data-portability-and-erasurefrom engineering
Designs verified tenant data export, retention, erasure, and backup workflows for SaaS platforms, with audit evidence and privacy-law compliance.
Ships in engineering. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.
| Input | Required | Use |
|---|---|---|
| Tenant, product, and lifecycle scope | yes | Bound the SaaS decision |
| Current architecture, plans, policies, and constraints | yes | Preserve enforceable behaviour |
| Production data or verified evidence | conditional | Validate thresholds and migrations |
Skill-specific inputs:
saas-architecture-strategy).Default to read-only analysis. Change configuration, billing, identity, tenant data, infrastructure, or customer communications only with explicit authority, least-privilege credentials, tenant scope, rollback, and auditable approval. Never expose secrets or cross tenant boundaries.
If production access, policy, telemetry, or authoritative records are unavailable, produce a labelled design or dry-run plan. Do not claim deployment, reconciliation, deletion, delivery, or measured outcomes; list missing evidence and verification.
| Condition | Action | Stop condition |
|---|---|---|
| Tenant isolation, money, identity, or deletion is affected | Require approval and rollback evidence | Scope or authority is ambiguous |
| Evidence supports a reversible change | Stage, test, and record it | Acceptance checks fail |
| Only partial context is available | Return assumptions and validation | A production claim cannot be verified |
vibe-security-skill / web-app-security-audit.saas-architecture-strategy.dpia-generator for Ugandan specifics.SKILL.md.SET deleted_at = NOW() (soft delete) — fails the regulatory test.| Category | Artifact | Format | Example |
|---|---|---|---|
| Data safety | Data store + erasure capability matrix | Markdown table | docs/compliance/data-store-erasure-matrix.md |
| Release evidence | Export workflow spec | Markdown doc + sample export | docs/compliance/export-workflow.md |
| Release evidence | Erasure workflow spec | Markdown doc | docs/compliance/erasure-workflow.md |
| Data safety | Retention exceptions document | Markdown doc | docs/compliance/retention-exceptions.md |
references/erasure-cascade.md — the per-store cascade including backups + warehouse.references/export-format-spec.md — JSON-LD / CSV export package contents.references/requester-verification.md — verification strength per request type.saas-architecture-strategy, saas-admin-backoffice-tooling, multi-tenant-saas-architecture, dpia-generator, vibe-security-skill.| Request type | Initiator | Scope |
|---|---|---|
| User export / erasure | Individual user | That user's personal data across tenants where they appear |
| Tenant export / erasure | Tenant primary admin | All data for that tenant (organisation-wide) |
A user-level request inside a tenant context (a tenant admin asks for a specific user's data) is a third variant: scope is one user within one tenant.
For every SaaS, enumerate stores:
| Store | Examples | Erasure mechanic |
|---|---|---|
| Primary OLTP DB | MySQL/Postgres tenant data | DELETE with cascade or per-tenant TRUNCATE / drop schema |
| Search index | Elasticsearch / Meilisearch / Algolia | Delete by tenant prefix or index |
| Object storage | S3 / R2 / GCS / Azure Blob | Delete by per-tenant prefix |
| Caches | Redis / Memcached | Flush by tenant key namespace |
| Message queues | SQS / Kafka / RabbitMQ | Drain + per-tenant filter; usually short retention |
| Warehouse | BigQuery / Snowflake / Redshift | Per-tenant partition delete or pseudonymise |
| Analytics | Mixpanel / Amplitude / PostHog / Heap | Vendor delete API; per-distinct-id or per-tenant property |
| CRM | Salesforce / HubSpot | API-driven delete; verify cascade |
| ESP / suppression | Postmark / SendGrid / Customer.io | API + central suppression-list update |
| Logs | CloudWatch / Datadog / Loki | Time-based purge; redact PII; document window |
| Backups | RDS snapshots / S3 backups | Retention window; redaction policy on rotation |
| Audit log | Internal | Kept (regulatory) but PII fields redacted |
| Third-party processors | Stripe / Twilio / OpenAI / etc. | Per-vendor delete API; document each |
Every store gets a column: "Per-user delete?" "Per-tenant delete?" "Retention window after request?"
Example:
| Store | Per-user delete | Per-tenant delete | Backup retention |
|---|---|---|---|
| MySQL primary | Yes (cascade by user_id) | Yes (cascade by tenant_id) | 30 days |
| Elasticsearch | Yes (delete-by-query) | Yes (drop tenant index) | 7 days |
| S3 documents | Yes (per-key) | Yes (per-tenant prefix) | 30 days (S3 versioning) |
| Redis | Yes (per-user key namespace) | Yes (per-tenant namespace) | None (TTL) |
| Snowflake warehouse | Yes (DELETE on event tables) | Yes (per-tenant partition) | 7 days (Time Travel) |
| Postmark suppression | Yes (per-email API) | n/a | Permanent |
| Stripe Customer | Yes (delete API; PII redacted in retained financial records) | n/a | 7 years (financial) |
| Audit log | PII pseudonymise (email → hash) | n/a | 7 years |
Trigger: Customer initiates via in-product "Export my data" or tenant admin's "Export tenant data".
Steps:
exports table; status queued).status = ready; audit-log the event.Format guidance:
README.md inside the bundle.Time: GDPR allows 30 days. Aim for hours-to-days; queue for big tenants.
Trigger: customer-initiated OR admin-initiated GDPR erasure request.
Pre-conditions:
Cascade order (top to bottom; failures retried):
pending_erasure — no new data accepted; UI blocks; sessions invalidated.status = deleted, deleted_at = NOW(), identifiers retained as opaque hashes only.TENANT_ERASURE_COMPLETED with the cascade outcome JSON.Failure handling:
erasure_runs.step_status).| Request type | Verification |
|---|---|
| User export (their own data) | Authenticated session + email confirmation link |
| User erasure | Authenticated session + email confirmation link + 7-day cool-down |
| Tenant export | Primary-admin authenticated + MFA + email confirmation |
| Tenant erasure | Primary-admin authenticated + MFA + email confirmation + 7-day cool-down + cannot have active subscription unless cancelled first |
| Admin-initiated (back-office, e.g., regulatory request) | Super-admin + co-sign + justification + ticket reference |
Reject any request that fails the bar. Audit every successful and failed attempt.
Some data must be retained even after erasure for legal/financial reasons:
| Data | Retention | Why |
|---|---|---|
| Financial records (invoices, payments) | 7 years (typical), check jurisdiction | Tax law, accounting standards |
| Audit log entries (PII pseudonymised) | 7 years | SOC2, internal control |
| Tax ID, VAT number on invoice | 7 years | Tax law |
| Backup snapshots | 30-90 days (then erased data is also erased from backups) | Operational recovery |
| Court / legal-hold data | As required | Litigation |
| Anti-fraud / abuse signals | 1-2 years pseudonymised | Platform safety |
Document this in the Data Processing Agreement (DPA) annex. Customers signing the DPA accept these retention exceptions. POPIA / GDPR / DPPA all permit these for "legitimate interest" and "legal obligation".
The back-office console (saas-admin-backoffice-tooling) exposes:
All require super-admin + audit log + co-sign for tenant-level erasure.
deleted_at = NOW() does not constitute erasure; PII still in DB.email_suppressions — these are personal data too.dpia-generator. NITA-U registration; 30-day response.For an African-focused agency: ensure POPIA + Uganda DPPA + Kenya DPA + GDPR are all simultaneously satisfiable. They're broadly compatible; the engineering is the same; the legal text in the DPA changes per region.
saas-architecture-strategy — the tenant lifecycle this skill integrates with.saas-admin-backoffice-tooling — the staff workflow.multi-tenant-saas-architecture — tenant isolation that underpins cascading deletes.dpia-generator — Ugandan specifics.vibe-security-skill — security review baseline.subscription-billing — financial-record retention vs erasure tension.The erasure cascade must include all AI-side stores in addition to the transactional and analytic ones:
| AI store | Erasure operation |
|---|---|
| Vector store namespace / partition | drop namespace / delete per-tenant collection |
| Embeddings (raw vectors) | drop with namespace |
| KB source documents | delete from object storage |
| KB chunk metadata rows | DELETE FROM kb_chunks WHERE tenant_id = ? |
| Conversation / chat history | DELETE per-tenant rows; purge S3 transcripts |
AI audit log rows (ai_requests) | per retention; payload S3 keys deleted; envelope-encrypted with tenant KEK — revoke KEK |
| AI request payloads in S3 | delete prefix ai-audit/<tenant_id>/... |
| Fine-tunes / adapters | delete tenant-specific adapters; do NOT delete shared base |
| Eval datasets (per-tenant goldens) | delete per-tenant rows |
| Retrieval cache | SCAN MATCH t<tenant_id>:* and delete |
| Prompt pins / overrides | DELETE from tenant_prompt_pins |
| AI consents | DELETE from tenant_ai_consents |
| AI cost / usage rows | retained per finance policy; anonymise tenant_id after legal retention |
Per-tenant KEK revocation is the strongest erasure for encrypted at-rest data — without the key, the data is unreadable.
Cross-references:
ai-tenant-isolation-patterns — BYOK / KEK strategy.ai-rag-multi-tenant — KB erasure cascade.ai-on-saas-architecture — AI audit log retention.ai-observability-and-debugging — trace retention.For tenants whose erasure includes agent-derived memory (working, episodic, semantic, vectors, fine-tune corpora, uploads, derivatives), the agent-memory leg is delegated to ai-agent-compliance-controls/references/ai-agent-memory-erasure-proof. That skill runs the 9-step cascade, then runs independent verification probes (separate code path) to assert residue=0 across every tier, then emits a signed proof-of-erasure pack (manifest + step records + verification + subprocessor receipts + audit-log redaction record + DPO signature).
This skill's orchestrator invokes the agent-memory leg as one of its tier coordinators; the produced pack is referenced from the tenant erasure response and retained as compliance evidence for ≥6 years.
Audit-log entries about the tenant / subject are redacted, not deleted — see ai-agent-audit-log-integrity. Deleting log rows destroys the evidence that the erasure happened.
Cross-links: ai-agent-compliance-controls/references/ai-agent-memory-erasure-proof, ai-agent-audit-log-integrity, ai-agent-soc2-controls (C1.2, P5), ai-agent-hipaa-security-controls, dpia-generator.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub peterbamuhigire/chwezi-dev-engine --plugin engineering169 skills in this plugin
/accounting-engineUse when designing or implementing double-entry accounting policy and an embedded ledger engine for invoices, payments, stock, balanced postings, mapped accounts, idempotency, reversals, period locks, audit trails, and financial statements./accounting-finance-controllerUse when coordinating accounting and finance implementation reviews, doctrine routing, control evidence, remediation priorities, and release decisions across a software system./advanced-testing-strategyUse when designing or reviewing test strategy for production systems, APIs, mobile apps, SaaS platforms, ERP workflows, and AI-enabled systems. Covers unit, integration, contract, end-to-end, regression, release-gate, and risk-based testing decisions.Other plugins' skills for the same job