Basinfy/Basinfy-SaaS-Studio / .agents/skills/saas-lgpd-data-mapping
saas-lgpd-data-mapping
UnverifiedBuild and maintain a data inventory (mapa de dados) of all personal data processing activities in the project. Use when user asks "mapa de dados", "data mapping LGPD", "que dados pessoais coletamos", "inventário de tratamento", or as part of an LGPD audit pipeline. Produces `.lgpd/data-map.md`. Especially important for legacy systems where the inventory is built reverse-engineered from code (Prisma schemas, API endpoints, third-party SDKs, log statements).
Running this workflow on this client
Run shell commands from the project root. On Windows, use Git Bash for the bash commands if bash resolves to an unavailable WSL distribution. Shared studio files are under .claude/; run the local Studio installer for this project if those files are missing. Read .claude/docs/config-resolution.md and apply its defaults when configuration cannot be resolved. Use this client's tools for reads, edits, and structured questions. If structured questions are unavailable, ask in chat and wait when a decision requires approval. Use the client's delegation feature with the role brief in .claude/agents/ when available. Otherwise perform the specialist checks in sequence and disclose that they were done in one session. If a workflow requires independent sign-off, report it as pending until an independent reviewer can provide it. Treat Task* steps as local workflow tracking using the client's equivalent when available. Report missing tools and unexecuted checks explicitly.
Data Mapping LGPD
Interaction Localization Rule: When locale: pt-BR (or user speaks Portuguese), ALL questions (AskUserQuestion / ask_question), confirmation prompts, and selectable options MUST be translated and presented in Brazilian Portuguese (PT-BR). Any English question text or options in this skill are illustrative examples — NEVER display English questions or options to a Portuguese developer. Internal reasoning, code synthesis, tests, and technical documentation MUST remain in English (except Brazilian statutory compliance documents under .lgpd/).
Inventário canônico de todas as atividades de tratamento de dados pessoais no projeto. É o pré-requisito para ROPA (Art. 37), RIPD (Art. 38), retenção e DSAR.
Workflow
Para greenfield
Liste atividades por feature/módulo do produto antes de codar. Cada feature que toca dado pessoal = uma atividade.
Para legacy (reverse-engineering)
- Schemas de banco: leia
prisma/schema.prisma(ou equivalente). Toda tabela com referência a usuário = candidato. - APIs: leia rotas REST/tRPC/GraphQL. Endpoints recebendo PII = atividade.
- SDKs de terceiros: grep por nomes (Sentry, Datadog, Mixpanel, Amplitude, Segment, Stripe, Discord SDK, Firebase, OneSignal). Cada um é compartilhamento.
- Logs: cuidado — logs podem vazar PII inadvertidamente (audit também).
- Cookies e localStorage em frontends.
- Coletas mobile: device ID, geolocation, push tokens, biometria, contatos, fotos.
Por atividade, capture:
- Nome curto (slug)
- Descrição (1 linha)
- Finalidade específica (Art. 6º, I)
- Base legal (link para
.lgpd/legal-basis.md) - Categorias de titulares: usuários, prospects, funcionários, dependentes, terceiros. Flag: contém crianças? adolescentes? idosos?
- Categorias de dados:
- Comuns: nome, e-mail, CPF (atenção — alguns tratam como sensível operacional), telefone, endereço, IP, device ID
- Sensíveis (Art. 5º, II): saúde, biometria, raça, religião, política, sindicato, sexualidade, genético
- Fonte/origem: coletado do titular? observado? inferido? terceiro?
- Sistemas que armazenam: tabelas, caches, S3 buckets, BigQuery, planilhas
- Compartilhamentos:
- Internos: outros times/empresas do grupo
- Externos operadores: lista
- Transferência internacional: lista (link para
.lgpd/transfers/)
- Retenção: prazo + critério
- Medidas de segurança: criptografia, RBAC, audit log
- Alto risco?: Aplicar teste Res. 2/2022 Art. 4 → se sim, marca para RIPD
- Owner: pessoa/time responsável
Template — .lgpd/data-map.md
# Mapa de Dados — {projeto}
**Versão**: v{N}
**Data**: {data}
**Owner global**: Encarregado / DPO
## Atividades de Tratamento
### A001 — {nome}
| Campo | Valor |
|---|---|
| Slug | a001-{slug} |
| Finalidade | {específica} |
| Base legal | Art. {N}, {inciso} ([detalhes](./legal-basis.md#a001)) |
| Categorias de titulares | usuários adultos + adolescentes |
| Sensíveis? | Não / Sim ({quais}) |
| Dados | nome, e-mail, IP, user-agent |
| Fonte | coletado do titular no signup |
| Sistemas | `users` (Postgres), `auth_sessions` (Redis), Datadog logs |
| Operadores | AWS RDS (US-East-1), Datadog (US), Better Auth (lib local) |
| Transferência intl. | Sim — AWS US, Datadog US (ver `.lgpd/transfers/`) |
| Retenção | 5 anos após inatividade (obrig. legal — prescrição CDC) |
| Segurança | TLS 1.3, TDE, RBAC, audit log |
| Alto risco? | Não |
| RIPD | N/A |
| Owner | @aroldo |
### A002 — ...
Annotations no schema (greenfield)
Sugira ao usuário anotações em comentários do Prisma schema:
/// @lgpd:activity=a001
/// @lgpd:purpose="autenticação e gestão de conta"
/// @lgpd:legal_basis="art_7_v" // execução de contrato
/// @lgpd:retention="5y_after_inactivity"
/// @lgpd:sensitive=false
model User {
id String @id
email String @unique /// @lgpd:pii=high
cpf String? /// @lgpd:pii=high @lgpd:masked=true
// ...
}
Script auxiliar para extrair anotações: assets/extract-prisma-annotations.sh.
Checklist de qualidade
- Toda tabela com FK para
Userestá coberta - Toda integração de terceiro está listada como compartilhamento
- Toda atividade tem base legal explícita
- Atividades de alto risco estão flagadas
- Atividades com menores estão flagadas (ECA Digital aplicável)
- Retenção definida (sem "indefinido")
Ao terminar, atualize .lgpd/STATUS.md:
## F2 — Data mapping ✓
- {N} atividades inventariadas
- {N} envolvem dados sensíveis
- {N} envolvem menores
- {N} marcadas como alto risco → RIPD pendente: {lista}
- Próximo: saas-lgpd-consent-schema (greenfield) ou saas-lgpd-legal-basis (legacy)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |