Skip to content

goul4rt/lgpd-skills / skills/lgpd-consent-schema

lgpd-consent-schema

Verified

Design an event-sourced, database-enforced append-only consent ledger satisfying LGPD Art. 8 (free, informed, unambiguous consent, burden of proof, easy revocation, policy version supersession), Art. 14, and Art. 18, IX. Use when user asks for "consent schema", "consent ledger", "schema de consentimento", "Prisma consentimento", or integrates consent capture/revocation with Better Auth, NextAuth, or Clerk. Outputs Prisma schema, PostgreSQL append-only triggers, and TypeScript helpers.

FileKindSize
SKILL.mdskill md6.9 KB
assets/consent-append-only.sqlother1.1 KB
assets/consent-ledger.tsscript9.7 KB
assets/consent-schema.prismaother6.6 KB

assets/consent-append-only.sql

View on GitHub
-- Proteção real de append-only no PostgreSQL para o ledger de consentimento.
-- Adicione esta migration após criar a tabela "ConsentEvent" pelo Prisma Migrate.

CREATE OR REPLACE FUNCTION prevent_consent_event_mutation()
RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
  RAISE EXCEPTION 'Append-only violation: operation % is prohibited on table %', TG_OP, TG_TABLE_NAME
    USING ERRCODE = '55000';
END;
$$;

DROP TRIGGER IF EXISTS trg_consent_event_no_update_delete ON "ConsentEvent";
CREATE TRIGGER trg_consent_event_no_update_delete
BEFORE UPDATE OR DELETE ON "ConsentEvent"
FOR EACH ROW
EXECUTE FUNCTION prevent_consent_event_mutation();

DROP TRIGGER IF EXISTS trg_consent_event_no_truncate ON "ConsentEvent";
CREATE TRIGGER trg_consent_event_no_truncate
BEFORE TRUNCATE ON "ConsentEvent"
FOR EACH STATEMENT
EXECUTE FUNCTION prevent_consent_event_mutation();

-- Hardening recomendado para a role usada pela aplicação web (ajuste o nome da role):
-- REVOKE UPDATE, DELETE, TRUNCATE ON "ConsentEvent" FROM app_runtime;
-- GRANT SELECT, INSERT ON "ConsentEvent" TO app_runtime;
deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall