agentleFS
Codeminer42Codeminer42/skills/privacy-review-rails/SKILL.md

privacy-review-rails

Skill32 starsChanged 8 months agoMITView on GitHub

Review uncommitted or recently changed files for privacy-by-design rule violations (based on privacy laws like GDPR and LGPD) before committing.

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. About 0 are common, 5 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the dependency path above is NOT_FOUND, stop and tell the user:

    line 17
  2. Distinctive:

    Do not proceed until the dependency is installed.

    line 23
  3. Very specific:

    If ruby is not found when running the command below, ask the user how to run Ruby in their environment instead of trying to resolve it …

    line 27
  4. Very specific:

    Run the scanner in --changed-only mode.

    line 29
  5. Very specific:

    If changed_files is empty, tell the user there are no privacy-relevant changes and stop.

    line 41
  6. Very specific:

    PII classification: Read the model and its schema columns.

    line 48
  7. Very specific:

    ransackable_attributes: If the model defines ransackable_attributes, are sensitive fields (encrypted_password, reset_password_token) or PII …

    line 51
  8. Very specific:

    Read the corresponding model (from related_files) to check if encrypts declarations exist for new PII columns.

    line 54
  9. Very specific:

    Check if config/initializers/filter_parameter_logging.rb (from related_files) includes the new PII field names.

    line 55
  10. Very specific:

    Check from: addresses for PII (user emails as sender).

    line 58
  11. Distinctive:

    Check subject lines for PII (names, emails visible in inbox previews).

    line 59
  12. Distinctive:

    Check template bodies: distinguish emails sent to OTHER users (violation) vs emails sent to the data subject themselves (acceptable — note …

    line 60
  13. Very specific:

    Do perform parameters pass PII data instead of record IDs?

    line 64
  14. Very specific:

    Do render json: responses include PII that shouldn't be exposed?

    line 68
  15. Very specific:

    If it configures an error reporter (Rollbar, Sentry, Bugsnag): are scrub_fields configured?

    line 71
  16. Distinctive:

    If no violations, tell the user their changes look privacy-compliant.

    line 86
  17. Distinctive:

    Ask the user if they want fixes applied.

    line 90

≈ “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

Check Privacy — Review Changed Files

Prerequisite

Dependency path: !test -d "${CLAUDE_SKILL_DIR}/../privacy-by-design-rails" && echo "${CLAUDE_SKILL_DIR}/../privacy-by-design-rails" || echo "NOT_FOUND"

If the dependency path above is NOT_FOUND, stop and tell the user:

This skill depends on privacy-by-design-rails, which is not installed. Install it with: npx skills add codeminer42/skills --skill privacy-by-design-rails (add -g for global installation)

Do not proceed until the dependency is installed.

Step 1: Scan Changed Files + Related Files

If ruby is not found when running the command below, ask the user how to run Ruby in their environment instead of trying to resolve it yourself.

Run the scanner in --changed-only mode. This scans the changed files AND automatically pulls in related files (e.g., a changed migration pulls in its model and filter_parameter_logging.rb; a changed mailer template pulls in its mailer class):

ruby ${CLAUDE_SKILL_DIR}/../privacy-by-design-rails/scripts/scanner.rb --changed-only

Parse the JSON output. It includes:

  • changed_files — files the developer actually modified
  • related_files — files pulled in for context (not changed, but affected by the changes)
  • findings — scanner findings across both changed and related files
  • checklist — privacy checklist status

If changed_files is empty, tell the user there are no privacy-relevant changes and stop.

Step 2: Deep-Dive on Changed Files

The scanner catches mechanical violations. Now verify the findings and check for things the scanner can't detect. For each changed file, apply the relevant checks from ${CLAUDE_SKILL_DIR}/../privacy-by-design-rails/references/pii-definition.md and the rules in ${CLAUDE_SKILL_DIR}/../privacy-by-design-rails/rules/:

For changed models:

  • PII classification: Read the model and its schema columns. Apply the Mandatory Classification Rules (Rules 1-4) from references/pii-definition.md to classify every column. Don't just rely on the scanner's pattern matching — check for domain-specific fields with non-standard names.
  • Encryption: Does every PII column have encrypts?
  • filter_attributes: Does the model declare self.filter_attributes listing all its PII fields?
  • ransackable_attributes: If the model defines ransackable_attributes, are sensitive fields (encrypted_password, reset_password_token) or PII fields exposed?

For changed migrations:

  • Read the corresponding model (from related_files) to check if encrypts declarations exist for new PII columns.
  • Check if config/initializers/filter_parameter_logging.rb (from related_files) includes the new PII field names.

For changed mailers/templates:

  • Check from: addresses for PII (user emails as sender).
  • Check subject lines for PII (names, emails visible in inbox previews).
  • Check template bodies: distinguish emails sent to OTHER users (violation) vs emails sent to the data subject themselves (acceptable — note with justification).

For changed jobs/workers:

  • Does the base class (ApplicationJob) set self.log_arguments = false?
  • Do perform parameters pass PII data instead of record IDs?

For changed controllers:

  • Is session[...] assigned a full ActiveRecord object instead of just an ID?
  • Do render json: responses include PII that shouldn't be exposed?

For changed initializers:

  • If it configures an error reporter (Rollbar, Sentry, Bugsnag): are scrub_fields configured? Is anonymize_user_ip enabled? Are person_*_method settings restricted to ID only?

For changed services:

  • Does the service send data to an external API? If so, does the payload include PII?

Step 3: Report

Group verified violations by severity (CRITICAL > HIGH > MEDIUM). For each violation:

  • Location: file:line
  • What's wrong: clear description
  • Correct pattern: code example from the relevant rule in ${CLAUDE_SKILL_DIR}/../privacy-by-design-rails/rules/
  • Changed vs related: note whether the violation is in a changed file (developer should fix) or a related file (pre-existing issue exposed by the change)

For scanner findings you verified as false positives, briefly explain why you dismissed them.

If no violations, tell the user their changes look privacy-compliant.

Step 4: Offer to Fix

Ask the user if they want fixes applied. Apply unambiguous fixes directly; ask about ambiguous ones (e.g., deterministic vs non-deterministic encryption, whether a field is genuinely PII).

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.