privacy-by-design-rails
Use when building Rails features that handle personal data, adding encryption to models, implementing consent flows, building DSAR endpoints, or adding…
от Codeminer42★ 32 звезды на GitHub
Установить privacy-by-design-rails в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Privacy by Design with Rails 8
When generating or reviewing code that handles personal data, run the scanner first:ruby .claude/skills/privacy-by-design-rails/scripts/scanner.rb --files <relevant files>
For deeper context on any topic, read the relevant reference file from references/.
What counts as PII? Any data that can identify a person directly or indirectly (GDPR Art. 4, LGPD Art. 5, NIST SP 800-122). This includes data that isn't identifying alone but becomes PII when linked to a person — farm names, animal names with known owners, license plates, vehicle VINs, student IDs, property addresses, social media handles, company names of sole proprietors, device IDs linked to accounts, IP addresses. See references/pii-definition.md for the full definition and linkability test. When in doubt, treat it as PII.
Quick Reference
| Principle | Rails Feature | File |
|---|---|---|
| Log + inspect filtering | config.filter_parameters (covers both) |
references/log-and-output-protection.md |
| Per-model PII declaration | self.filter_attributes (self-documenting) |
references/log-and-output-protection.md |
| Job arg protection (ActiveJob) | self.log_arguments = false (set in ApplicationJob) |
references/log-and-output-protection.md |
| Job arg protection (Sidekiq) | Server middleware + pass IDs only | references/log-and-output-protection.md |
| PII redaction in logs | logstop gem |
references/log-and-output-protection.md |
| IP anonymization | ip_anonymizer middleware |
references/log-and-output-protection.md |
| Error reporter scrubbing | Scrub PII from Sentry/Rollbar/etc. | references/log-and-output-protection.md |
| APM/monitoring scrubbing | Scrub PII from AppSignal/NewRelic/etc. | references/log-and-output-protection.md |
| Data minimization | Strong parameters + serializers | references/data-minimization.md |
| Searchable encryption | encrypts :field, deterministic: true |
references/encryption.md |
| Non-searchable encryption | encrypts :field |
references/encryption.md |
| Password hashing | has_secure_password |
references/encryption.md |
| Key rotation | encrypts :field, previous: [...] |
references/encryption.md |
| Secrets management | bin/rails credentials:edit |
references/secrets-management.md |
| Security auditing | bundler-audit, Brakeman, pdscan | references/secrets-management.md |
| HTTPS enforcement | config.force_ssl = true + HSTS |
references/session-security.md |
| Session security | Signed cookies / Bearer tokens | references/session-security.md |
| Consent management | Immutable append-only audit trail | references/consent-management.md |
| Consent enforcement | Controller concern gating actions | references/consent-management.md |
| Consent-gated exports | ConsentGatedExportSerializer for processing |
references/consent-management.md |
| Anonymization | Replace PII with [ANONYMIZED] |
references/anonymization.md |
| Pseudonymization | HMAC hash preserving analytics links | references/pseudonymization.md |
| DSAR workflow | Access / Rectification / Erasure | references/dsar.md |
| Data retention | Solid Queue scheduled jobs | references/data-retention.md |
Putting It All Together — The User Model
class User < ApplicationRecord
has_secure_password
has_many :sessions, dependent: :destroy
has_many :addresses, dependent: :destroy
has_many :orders, dependent: :restrict_with_error
has_many :consents, dependent: :destroy
has_many :data_subject_requests, dependent: :destroy
include Anonymizable
include Pseudonymizable
include DataExportable
include HasConsent
encrypts :email_address, deterministic: true, downcase: true
encrypts :first_name
encrypts :last_name
encrypts :phone
encrypts :date_of_birth
self.filter_attributes = %i[
first_name last_name phone date_of_birth
email_address password_digest
]
enum :role, { customer: 0, admin: 1 }
anonymizable :first_name, :last_name, :phone, :date_of_birth
exportable :uuid, :email_address, :first_name, :last_name, :phone, :date_of_birth
normalizes :email_address, with: ->(e) { e.strip.downcase }
end
Common Mistakes (not caught by scanner)
| Mistake | Fix |
|---|---|
| Deleting records with dependents for right to erasure | Prefer anonymization when the record has dependents — preserves referential integrity. Some authorities prefer true deletion, so check local requirements |
| Storing consents as a boolean flag | Use immutable append-only records for audit trail |
| Exposing sequential IDs in APIs | Use UUIDs as public identifiers |
| Manual data retention | Automate with Solid Queue scheduled jobs |
External References
Consult these when you need the latest guidance or to verify patterns against official sources. Use WebFetch when needed — don't fetch all of them upfront.
Rails
- Active Record Encryption: https://guides.rubyonrails.org/active_record_encryption.html
- Active Record En
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/anonymization.md
- references/consent-management.md
- references/data-minimization.md
- references/data-retention.md
- references/dsar.md
- references/encryption.md
- references/log-and-output-protection.md
- references/pii-definition.md
- references/pseudonymization.md
- references/secrets-management.md
- references/session-security.md
- rules/consent-use-purposes-constant.md
- rules/email-no-pii-in-body.md
- rules/encrypt-filter-parameters.md
- rules/encrypt-pii-fields.md
- rules/export-dsar-vs-processing.md
- rules/export-no-pii-at-rest.md
- rules/log-no-job-arguments.md
- rules/log-no-pii-in-cache.md
- rules/log-pass-ids-not-data.md
- scripts/rules/base_rule.rb
- scripts/rules/consent_use_purposes_constant.rb
- scripts/rules/email_no_pii_in_body.rb
- scripts/rules/encrypt_filter_parameters.rb
- scripts/rules/encrypt_pii_fields.rb
- scripts/rules/error_reporter_scrubbing.rb
- scripts/rules/export_dsar_vs_processing.rb
- scripts/rules/export_no_pii_at_rest.rb
- scripts/rules/log_no_job_arguments.rb
- scripts/rules/log_no_pii_in_cache.rb
- scripts/rules/log_pass_ids_not_data.rb
- scripts/rules/minimize_ransackable_attributes.rb
- scripts/scanner.rb
- scripts/utils/changed_files.rb
- scripts/utils/pii_patterns.rb
- scripts/utils/schema_parser.rb
FAQ
Что делает скилл privacy-by-design-rails?
Use when building Rails features that handle personal data, adding encryption to models, implementing consent flows, building DSAR endpoints, or adding anonymization/pseudonymization. Also use when reviewing code for compliance with privacy laws like GDPR and LGPD, or when asked about privacy-by-design patterns in Rails.
Как установить скилл privacy-by-design-rails?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл privacy-by-design-rails запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…