agentleFS
alvarofppalvarofpp/lgpd-skill/skills/lgpd-compliance/SKILL.md

lgpd-compliance

Skill4 starsChanged 4 months agoMITView on GitHub

Brazilian LGPD (Lei Geral de Proteção de Dados) compliance for web applications. Use when handling personal data, implementing consent, data retention, anonymization, or reviewing privacy practices — trigger for any Brazil privacy question even if LGPD is not named. For generating documents (privacy policy, ROPA) use lgpd-document-generator; for minors' data use digital-eca-compliance; for fine/enforcement risk use lgpd-sanctions.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. cookieMonsterDev/agents-skills★ 7same name
    2. Falkzera/falcao-skills-open★ 1same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository5 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 10 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈10

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    All data processing must observe good faith and these principles:

    line 49
  2. Distinctive:

    Must be written or demonstrable by other means

    line 83
  3. Distinctive:

    Must be for specific purposes (blanket consent is void)

    line 84
  4. Distinctive:

    Must be separate from other contractual clauses

    line 85
  5. Distinctive:

    If consent changes scope, user must be notified and can revoke

    line 87
  6. Distinctive:

    When using legitimate interest as legal base:

    line 92
  7. Distinctive:

    Only use strictly necessary data

    line 94
  8. Distinctive:

    Must be in the child's best interest

    line 130
  9. Distinctive:

    After processing ends, data must be deleted, except for:

    line 244
  10. Distinctive:

    When reviewing code that handles personal data:

    line 307

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

LGPD Compliance (Lei 13.709/2018)

Last verified against official sources: 2026-07-10

When to Use

  • Handling personal data (CPF, email, address, phone, IP)
  • Processing sensitive data (health, biometrics, race/ethnicity, religion, political opinion)
  • Processing children's or adolescents' data
  • Implementing consent management
  • Designing data retention and deletion policies
  • Building user data export or portability features
  • Reviewing code for privacy compliance
  • Responding to data subject rights requests
  • Handling data breach incidents

How to Respond

TaskRespond with
Code/feature reviewChecklist-style findings, each with the LGPD article reference and a concrete fix
"Which legal base applies?"Recommended base + justification, and why the alternatives were discarded
Implementation request (consent, deletion, export, retention)Pattern/pseudocode + the legal rules it must satisfy
Retention questionRetention table per data type with legal basis and post-expiry action
Incident questionNotifiability test + deadlines; use lgpd-document-generator for the notification documents
Anonymization questionAnonymization vs. pseudonymization verdict + technique recommendation + re-identification tests

Key Definitions (Art. 5)

TermDefinition
Dado pessoalAny information related to an identified or identifiable natural person
Dado pessoal sensívelData on race/ethnicity, religion, political opinion, union membership, health, sex life, genetics, biometrics
Dado anonimizadoData that cannot be associated with an individual using reasonable technical means
TitularNatural person to whom the personal data refers
ControladorPerson/entity that makes decisions about personal data processing
OperadorPerson/entity that processes data on behalf of the controller
Encarregado (DPO)Person appointed by controller/operator as communication channel with data subjects and ANPD
TratamentoAny operation with personal data: collection, storage, use, access, sharing, deletion, etc.
ConsentimentoFree, informed, unambiguous expression of will by which the data subject agrees to processing

Principles (Art. 6)

All data processing must observe good faith and these principles:

PrincipleWhat it meansWhat to implement
FinalidadeSpecific, legitimate, explicit purposesDocument purpose for each data field collected
AdequaçãoProcessing compatible with stated purposesDon't reuse data beyond original purpose
NecessidadeCollect only what's strictly neededMinimize fields; avoid "nice to have" data
Livre acessoUsers can query their data freely and for freeProvide data access/export endpoint
QualidadeKeep data accurate and up-to-dateAllow profile editing, validate input
TransparênciaClear information about processingPrivacy policy, consent banners
SegurançaProtect from unauthorized accessEncryption, access control, audit logs
PrevençãoPrevent damage from processingImpact assessments, security by design
Não discriminaçãoNo discriminatory processingAudit algorithms for bias
ResponsabilizaçãoDemonstrate complianceLogs, policies, DPO appointment

Legal Bases for Processing (Art. 7)

Personal data may ONLY be processed under one of these 10 legal bases:

#Legal BaseTypical Use
IConsentMarketing, analytics, optional features
IILegal/regulatory obligationTax records, labor law, financial regulations
IIIPublic administrationPublic policy execution
IVResearchStudies by research organizations (anonymize when possible)
VContract executionProviding the contracted service
VIExercise of rightsLegal proceedings, arbitration
VIILife/safety protectionEmergency situations
VIIIHealth protectionMedical procedures by health professionals
IXLegitimate interestSecurity, fraud prevention, analytics (requires balancing test)
XCredit protectionCredit scoring, financial analysis

Consent Requirements (Art. 8)

  • Must be written or demonstrable by other means
  • Must be for specific purposes (blanket consent is void)
  • Must be separate from other contractual clauses
  • Can be revoked at any time via simple, free procedure
  • If consent changes scope, user must be notified and can revoke
  • Burden of proof is on the controller

Legitimate Interest (Art. 10)

When using legitimate interest as legal base:

  • Processing only for legitimate purposes based on concrete situations
  • Only use strictly necessary data
  • Controller must adopt transparency safeguards (data subject rights remain)
  • ANPD may request a Data Protection Impact Assessment (DPIA)

Sensitive Data (Art. 11)

Sensitive data requires stricter legal basis:

  • Explicit consent from the data subject, for specific purposes; OR
  • Without consent only when indispensable for:
    • Legal/regulatory obligation
    • Public administration policies
    • Research (anonymize when possible)
    • Life/safety protection
    • Health protection
    • Fraud prevention

Implementation Rules for Sensitive Data

DO:
- Encrypt sensitive columns at rest (health, biometrics, race/ethnicity)
- Use field-level encryption, not just disk encryption
- Restrict access with RBAC — principle of least privilege
- Log all access to sensitive data for audit
- Get explicit, specific consent before processing

DON'T:
- Store sensitive data in logs, error messages, or URLs
- Use sensitive data for automated decisions without human review
- Share sensitive data with third parties without specific consent
- Store sensitive data longer than necessary

Children's Data (Art. 14)

Processing children's data requires:

  • Must be in the child's best interest
  • Requires specific, prominent consent from at least one parent/guardian
  • Controller must publish information about: types of data collected, how they're used, and how to exercise rights
  • Cannot condition participation in games/apps on providing data beyond what's strictly necessary
  • Collection without parental consent only to contact parents (single use, no storage) or for child protection

Note: For comprehensive children's data protection, also apply the ECA Digital (Lei 15.211/2025) skill which has additional requirements.

Data Subject Rights (Art. 18)

Data subjects have the right to obtain from the controller, at any time:

RightDescriptionImplementation
ConfirmationWhether their data is being processedGET /api/privacy/status
AccessView all their personal dataGET /api/privacy/data-export
CorrectionFix incomplete, inaccurate, or outdated dataPATCH /api/profile
Anonymization/Blocking/DeletionOf unnecessary, excessive, or non-compliant dataDELETE /api/privacy/data
PortabilityTransfer data to another providerExport in machine-readable format (JSON/CSV)
DeletionOf data processed with consentAccount deletion flow
InformationKnow which entities received their dataDisclose in privacy policy
Consent infoKnow consequences of denying consentClear opt-in/opt-out explanation
RevocationWithdraw consent at any timeSimple, free procedure

Response Deadlines (Art. 19)

RequestDeadlineSource
Confirmation of processing / access — simplified formatImmediatelyArt. 19, I
Confirmation of processing / access — complete declaration15 days from the requestArt. 19, II
All deadlines for small-porte agents (startups, micro/small companies)Doubled (e.g., 30 days for complete declaration)Res. CD/ANPD nº 2/2022
Other rights (correction, deletion, portability, revocation)No statutory deadline — respond without undue delay; adopt an internal SLA (15 days is the market reference) and document itArt. 18, §5

Implementation: track every request with received-at timestamp, deadline, and resolution; alert before the deadline expires. Denials must be justified in writing with the legal basis (Art. 18, §4).

Implementation Pattern

# Pseudocode — Data Subject Rights Controller

# Right of Access (Art. 18, II)
def export_user_data(user_id):
    """Return ALL personal data for this user in structured format."""
    return {
        "profile": get_profile(user_id),
        "activity": get_activity_log(user_id),
        "consents": get_consent_records(user_id),
        "third_party_sharing": get_sharing_log(user_id),
        "exported_at": now(),
    }

# Right of Deletion (Art. 18, IV and VI)
def delete_user_data(user_id):
    """
    Soft-delete immediately, hard-delete/anonymize after retention period.
    Keep only what's required by legal obligation (Art. 16, I).
    """
    soft_delete_account(user_id)
    schedule_anonymization(user_id, days=RETENTION_DAYS)
    revoke_all_consents(user_id)
    notify_third_parties_of_deletion(user_id)

Security Requirements (Arts. 46-49)

Technical and Administrative Measures (Art. 46)

Controllers and operators must adopt security measures to protect data from:

  • Unauthorized access
  • Accidental or unlawful destruction, loss, alteration
  • Unauthorized communication or dissemination

These measures apply from the design phase through execution (privacy by design — Art. 46, §2).

Incident Response (Art. 48)

The controller must notify ANPD and affected data subjects when a security incident may cause relevant risk or damage.

Notification must include:

  1. Description of the nature of affected personal data
  2. Information about affected data subjects
  3. Technical and security measures used
  4. Risks related to the incident
  5. Reasons for any delay (if not immediate)
  6. Measures adopted to reverse or mitigate the effects

Deadline: Resolução CD/ANPD nº 15/2024 requires notification within 3 business days of becoming aware of the incident.

Sanctions (Art. 52)

SanctionDetail
WarningWith deadline for corrective measures
Simple fineUp to 2% of revenue in Brazil, capped at R$ 50 million per infraction
Daily fineSame cap as simple fine
PublicizationPublic disclosure of the infraction
BlockingSuspension of processing of related data
DeletionMandatory deletion of related data
Partial suspensionOf database operations, up to 6 months (renewable)
Total suspensionOf processing activity, up to 6 months (renewable)
ProhibitionOf processing activities, partial or total

Criteria for Sanctions (Art. 52, §1)

ANPD considers: severity, good faith, advantage obtained, economic condition, recidivism, damage, cooperation, adoption of good practices, adoption of governance policies, prompt adoption of corrective measures, proportionality.

Data Retention (Art. 15-16)

Processing ends when:

  • Purpose achieved or data no longer necessary
  • End of processing period
  • Data subject request (including consent revocation)
  • ANPD order

After processing ends, data must be deleted, except for:

  • Legal/regulatory obligation to retain
  • Research (anonymized)
  • Transfer to third party (respecting legal requirements)
  • Exclusive use by the controller (anonymized, no third-party access)

Recommended Retention Policy

Data TypeRetentionAfter Expiry
Account dataWhile active + 6 monthsAnonymize
Transaction records5 years (tax/commercial law)Delete
Health dataWhile activeDelete on account deletion
Consent recordsDuration of consent + 5 yearsArchive for proof
Audit/access logs2 yearsDelete
Backups30-90 days rollingAutomatic expiry

Anonymization vs. Pseudonymization (Arts. 5, 12, 13)

AnonymizationPseudonymization
DefinitionData can no longer be associated with an individual using reasonable technical means (Art. 5, XI)Association with an individual is only possible via additional information kept separately (Art. 13, §4)
LGPD statusOutside LGPD scope (Art. 12, caput) — no legal base neededStill personal data — all LGPD obligations apply
ReversibilityIrreversible by reasonable meansReversible with the key/mapping table

"Reasonable means" test (Art. 12, §1): consider cost, time, and available technology required for re-identification. If re-identification is cheap and fast, the data is NOT anonymized. Data used for behavioral profiling of an identifiable person is personal data regardless (Art. 12, §2).

Techniques

TechniqueWhat it doesWatch out
SuppressionRemove identifier columns entirelyQuasi-identifiers (ZIP + birth date + gender) can still single out individuals
GeneralizationReduce precision (birth date → age range, address → city)Verify group sizes after generalizing
k-anonymityEvery quasi-identifier combination matches at least k records (use k ≥ 5)Vulnerable to homogeneity attacks — combine with l-diversity for sensitive attributes
Noise / differential privacyAdd statistical noise to aggregatesOnly for analytics outputs, not record-level release
Consistent date-shiftingShift all dates per subject by a fixed random offsetPreserves intervals; keep the offset secret and discard it

Anti-Patterns

DON'T:
- Hash CPF (or any low-entropy identifier) without salt/secret — the full CPF
  space can be brute-forced in minutes; the "anonymized" column is reversible
- Call pseudonymized data "anonymous" in the privacy policy — it is still
  personal data under the LGPD
- Store the pseudonymization key/mapping alongside the pseudonymized data
- Release record-level datasets with unique quasi-identifier combinations

DO:
- Use HMAC with a secret key (kept in a separate vault) when you need
  consistent pseudonyms
- Run re-identification tests BEFORE calling any dataset anonymized:
  singling out (can one record be isolated?), linkability (can records be
  linked to another dataset?), inference (can an attribute be deduced?)
- Re-assess anonymization when new external datasets or techniques emerge

Crypto-Shredding Pattern

To fulfill deletion requests (Art. 18) when data lives in immutable stores or backups: encrypt each data subject's data with a per-subject key; deletion = destroying the key. The remaining ciphertext becomes unrecoverable — effectively anonymized without rewriting backups. Document this approach in the retention policy.

Code Review Checklist

When reviewing code that handles personal data:

  • No PII in logs — mask CPF, email, names in log messages
  • No PII in error responses — generic messages to users, details server-side only
  • No PII in URLs — use POST body, not query params for sensitive data
  • Legal base documented — each data collection point has a documented legal base
  • Consent recorded — timestamp, scope, and method of consent stored
  • Consent revocable — simple mechanism to withdraw consent
  • Data minimization — only collecting what's needed for the stated purpose
  • Access control — users see only their own data; admins have audit trails
  • Encryption at rest — sensitive columns encrypted (not just disk-level)
  • Encryption in transit — TLS 1.2+ for all connections
  • Retention enforced — automated deletion/anonymization when retention expires
  • Deletion cascade — account deletion removes data from all systems including backups
  • Third-party disclosure — data sharing with third parties documented and consented
  • International transfers — cross-border data transfers comply with Art. 33-36

International Data Transfer (Art. 33)

Transfer to other countries or international organizations is only allowed when:

  • Country/organization provides adequate protection (recognized by ANPD)
  • Controller provides safeguards (standard contractual clauses, binding corporate rules, certifications)
  • Specific consent from data subject
  • Required for international legal cooperation
  • Required to protect life/safety
  • Authorized by ANPD
  • Required by treaty/convention
  • Required for contract execution (at data subject's request)

EU adequacy: Resolução CD/ANPD nº 32/2026 recognizes the EU as providing adequate data protection for international transfers.

References

See Also

  • digital-eca-compliance — Use when processing children's or adolescents' data. ECA Digital (Lei 15.211/2025) adds requirements beyond LGPD Art. 14: age verification, anti-compulsive design, content moderation, penalties up to 10% of revenue.
  • lgpd-document-generator — Use when you need to generate compliance documents: privacy policies, terms of use, consent forms, ROPA, cookie policies.
  • lgpd-sanctions — Use for risk assessment and understanding ANPD enforcement: dosimetry criteria, fine calculation, real precedent cases, aggravating/mitigating factors.
  • marco-civil-compliance — Use when building internet platforms. Marco Civil complements LGPD with data retention obligations (1 year connection logs, 6 months application logs), net neutrality, and provider liability rules.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.