Basinfy/Basinfy-SaaS-Studio / .agents/skills/saas-lgpd-retention-erasure
saas-lgpd-retention-erasure
UnverifiedDefine statutory data retention schedules, tombstone filtering, and automated purge jobs.
Running this workflow on this client
Run commands from the project root (use Git Bash on Windows if bash points to an unavailable WSL distro). Shared studio files live in .claude/; follow .agents/PORTABLE-RUNTIME.md and .claude/docs/config-resolution.md for client tools, delegation, and approval rules.
Retention & Erasure
Locale & User Profile: Match
locale(pt-BR→ natural Brazilian Portuguese questions/options, overriding English examples;en→ English) anduser_profile(founder→ plain business language with(Recomendado)first, zero tech jargon;developer→ technical). Keep code/tests in English.
Arts. 15-16 LGPD definem o término do tratamento. Art. 18, VI dá direito à eliminação. A tensão prática é com retenções legais obrigatórias.
Hierarquia de obrigações
Retenção legal obrigatória > Retenção contratual > Vontade do titular (Art. 18, VI)
Quando há obrigação legal de manter (fiscal, trabalhista, bancário, Marco Civil), o tratamento continua bloqueado (não usado para finalidade original) até o fim do prazo legal, depois é eliminado.
Prazos comuns no Brasil
| Categoria | Prazo | Fonte |
|---|---|---|
| Fiscal (notas, impostos) | 5 anos | CTN Art. 173-174 |
| Trabalhista (contratos, folha) | 5 anos | CLT Art. 11 |
| Previdenciária | 10 anos | Lei 8.212/91 |
| Bancário | 10 anos | CMN |
| Marco Civil — logs de conexão | 1 ano | Lei 12.965/2014 Art. 13 |
| Marco Civil — logs de acesso a apps | 6 meses | Lei 12.965/2014 Art. 15 |
| CDC — relação de consumo | 5 anos | CDC Art. 27 (prescrição) |
Estratégias de eliminação
1. Hard delete
Quando não há retenção legal. Cascata bem definida em todas as tabelas + replicas + backups quando possível.
2. Soft delete + bloqueio
Quando há retenção legal de alguns campos. Marcar deletedAt, mascarar campos não-essenciais, manter apenas o estritamente necessário.
3. Crypto-shredding
Quando há volume e dificuldade de varrer storage. Dados cifrados por chave do titular; eliminação = destrói a chave.
4. Anonimização
Substituto à eliminação. Após anonimizar (irreversivelmente), dado sai do escopo da LGPD (Art. 12).
Schema Prisma
model RetentionRule {
id String @id @default(cuid())
entity String // "User", "Order", "Message"
purpose String // "marketing", "billing"
retentionMonths Int
legalBasis String
postAction PostRetentionAction
triggeredBy String // "consent_revoked", "contract_end", "ttl"
active Boolean @default(true)
}
enum PostRetentionAction {
HARD_DELETE
ANONYMIZE
CRYPTO_SHRED
BLOCK_AND_RETAIN
}
Job de eliminação automática
Cron job diário:
- Identifica registros que ultrapassaram retenção
- Aplica
postActionconformeRetentionRule - Loga em
AuditLogEntry - Notifica relatório semanal ao Encarregado
Workflow para Art. 18, VI
Ver detalhes no skill saas-lgpd-dsar. Resumo:
- Recebe pedido
- Verifica retenção legal
- Se ZERO retenção → hard delete
- Se PARCIAL → soft delete + crypto-shred dos campos elimináveis
- Loga
- Responde titular informando o que foi eliminado e o que foi bloqueado (com prazo)
Status update
## F8 — Retention ✓
- RetentionRules configuradas: {N}
- Job diário ativo
- Eliminação automatizada validada em ambiente staging
- {M} registros já em fila para eliminação
- Próximo: saas-lgpd-incident-response
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |