Lgpd Consent Schema logo

Lgpd Consent Schema

Community
goul4rt
lgpd-consent-schema

Design the database schema for a versioned, append-only consent ledger that satisfies LGPD Art. 8 (free, informed, unambiguous consent for a specific purpose) and Art. 9 (information rights). Use when user asks for "consent schema", "consent ledger", "schema de consentimento", "Prisma consentimento", "consent management", or is integrating consent capture with Better Auth, NextAuth, Clerk, or any auth library. Outputs a Prisma schema + integration spec. Also produces the structure needed to support DSAR revocation (Art. 18, IX).

Overview

Publishergoul4rt
Repositorylgpd-skills
Skill namelgpd-consent-schema
Stars
107
Forks
15
Bundled files
1
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by goul4rt on GitHub. Read the source before you install it.

Installation

Install the Lgpd Consent Schema AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/goul4rt/lgpd-skills/tree/main/skills/lgpd-consent-schema
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/goul4rt/lgpd-skills.git /tmp/lgpd-skills
mkdir -p .claude/skills
cp -r /tmp/lgpd-skills/skills/lgpd-consent-schema .claude/skills/lgpd-consent-schema
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Lgpd Consent Schema in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Lgpd Consent Schema on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Lgpd Consent Schema is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Consent Schema (Prisma + Better Auth)

Implementação técnica do consentimento como base legal (Art. 7º, I e Art. 11, I), versionado, auditável e revogável.

Princípios

  1. Append-only — nunca update destrutivo. Revogar = inserir novo registro com status=REVOKED.
  2. Versionado pela política — todo consentimento aponta para uma versão específica do texto consentido.
  3. Específico por finalidade — uma entrada por (titular, finalidade, versão da política).
  4. Evidência forte — hash do payload (timestamp, IP, user-agent, UI snapshot).
  5. Revogação fácil — Art. 8º, § 5º: "O consentimento pode ser revogado a qualquer momento mediante manifestação expressa do titular, por procedimento gratuito e facilitado."

Schema Prisma de referência

Ver assets/consent-schema.prisma.

Integração com Better Auth

Better Auth permite adicionar campos custom e hooks beforeCreate. Use para:

ts
// auth.ts
export const auth = betterAuth({
  database: prismaAdapter(db, { provider: "postgresql" }),
  user: {
    additionalFields: {
      dateOfBirth: { type: "date", required: true }, // ECA Digital
      parentalConsentRef: { type: "string", required: false },
    }
  },
  hooks: {
    user: {
      create: {
        before: async (user, ctx) => {
          // 1. Validar idade (ECA Digital se aplicável)
          // 2. Não criar registro de consentimento aqui — fazer em /api/consent/grant
          //    porque consentimento exige UX dedicada (não pode ser "enterrado" no signup)
          return user;
        }
      }
    }
  }
});

Captura de consentimento na UI

Princípios:

  • Não pré-marcar caixas (Art. 8º, § 4º — manifestação livre).
  • Granular por finalidade — uma caixa por finalidade, não "concordo com tudo".
  • Linguagem clara — leiga, sem juridiquês.
  • Link para política — versão exata do texto consentido.
  • Idade — se < 18, fluxo ECA Digital (ver lgpd-eca-digital-minors).

Exemplo de payload do endpoint /api/consent/grant:

json
{
  "userId": "usr_abc123",
  "policyVersionId": "policy_v3.2",
  "purposes": [
    { "purpose": "marketing_email", "granted": true },
    { "purpose": "personalization", "granted": false },
    { "purpose": "analytics", "granted": true }
  ],
  "evidence": {
    "ip": "192.0.2.1",
    "userAgent": "...",
    "locale": "pt-BR",
    "channel": "web",
    "uiSnapshotHash": "sha256:..."
  }
}

Revogação

Endpoint /api/consent/revoke:

ts
async function revokeConsent(userId: string, purpose: string) {
  // 1. Cria registro com status=REVOKED, revokedAt=now
  await prisma.consentRecord.create({
    data: {
      subjectId: userId,
      purpose,
      status: "REVOKED",
      revokedAt: new Date(),
      // ... mesma policyVersionId do consentimento ativo
    }
  });

  // 2. Propaga para operadores (Datadog, Mixpanel, etc.)
  await propagateRevocation(userId, purpose);

  // 3. Bloqueia tratamentos futuros
  await blockFuturePurpose(userId, purpose);
}

Helper de query

ts
// Verificar se titular consentiu uma finalidade específica
export async function hasActiveConsent(
  subjectId: string,
  purpose: string
): Promise<boolean> {
  const latest = await prisma.consentRecord.findFirst({
    where: { subjectId, purpose },
    orderBy: { grantedAt: "desc" }
  });
  return latest?.status === "GRANTED";
}

Sempre use este helper antes de tratar dados em finalidade baseada em consentimento.

Versionamento de política

Toda mudança material no texto da política de privacidade = nova PolicyVersion. Consentimentos antigos não migram automaticamente — você precisa re-coletar para a nova versão se a mudança afetar finalidades existentes (Art. 8º, § 6º).

Audit log

Cada operação (grant, revoke, propagate) deve gerar entrada em AuditLogEntry (skill lgpd-audit-logging).

Status update

markdown
## F3 — Consent schema ✓
- Schema implementado em `prisma/schema.prisma`
- Endpoints: POST /api/consent/grant, POST /api/consent/revoke, GET /api/consent
- Better Auth hooks configurados
- Propagação para operadores: {lista}
- Próximo: lgpd-privacy-policy

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Lgpd Consent Schema AI skill do?

Design the database schema for a versioned, append-only consent ledger that satisfies LGPD Art. 8 (free, informed, unambiguous consent for a specific purpose) and Art. 9 (information rights). Use when user asks for "consent schema", "consent ledger", "schema de consentimento", "Prisma consentimento", "consent management", or is integrating consent capture with Better Auth, NextAuth, Clerk, or any auth library. Outputs a Prisma schema + integration spec. Also produces the structure needed to support DSAR revocation (Art. 18, IX).

Why use Lgpd Consent Schema on TypingMind?

Because you install it once and use it with any model. Lgpd Consent Schema is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Lgpd Consent Schema in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/goul4rt/lgpd-skills/tree/main/skills/lgpd-consent-schema. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Lgpd Consent Schema?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Lgpd Consent Schema?

As many as you like. As long as a model supports skills, you can use Lgpd Consent Schema with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Lgpd Consent Schema AI skill free?

Yes. It is published on GitHub by goul4rt under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇