pii-redaction

Redact PII from logs, error messages, and debug output.

2|Updated Nov 13, 2025
One-click install
npx skills add https://github.com/ricardoroche/ricardos-claude-code --skill pii-redaction
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pii-redaction
Source: https://github.com/ricardoroche/ricardos-claude-code/tree/main/.claude/skills/pii-redaction
Command: npx skills add https://github.com/ricardoroche/ricardos-claude-code --skill pii-redaction

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires structlog, pytest.

What problem does it solve?

This Skill automates the critical task of redacting Personally Identifiable Information (PII) from logs, error messages, and debug outputs. It helps prevent accidental data leaks, ensures compliance with regulations like GDPR, CCPA, and PCI-DSS, and maintains user privacy without sacrificing debuggability.

Core Features & Use Cases

  • Comprehensive Redaction: Provides helper functions to redact common PII types like phone numbers, emails, credit card numbers, SSNs, and addresses.
  • Context-Aware Redaction: Guides on when and where to redact (always in logs, never in actual API calls) to maintain data integrity for operations while protecting privacy.
  • Structured Logging Integration: Shows how to integrate redaction with structured logging libraries like structlog for automatic PII masking.
  • Compliance & Testing: Highlights compliance considerations for GDPR, CCPA, PCI-DSS, and HIPAA, along with patterns for testing redaction effectiveness.
  • Use Case: A developer is logging user activity that includes email addresses and phone numbers. This skill helps them implement PIIRedactor functions to automatically mask this information in logs, ensuring privacy and compliance while still allowing for debugging with partial identifiers.

Quick Start

Redact phone numbers and email addresses in my application's log statements.

Frequently Asked Questions about pii-redaction

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent sensitive data like email addresses and phone numbers from appearing in application logs?

Redact PII from logs by applying masking functions to sensitive fields before logging. This Skill provides helper utilities to automatically redact common PII types—emails, phone numbers, credit card numbers, SSNs, and addresses—ensuring compliance with GDPR, CCPA, and PCI-DSS while preserving debuggability with partial identifiers.

Can I integrate PII redaction with structured logging libraries like structlog?

Yes. This Skill shows how to integrate redaction directly into structured logging frameworks like structlog for automatic PII masking. Configure redaction patterns within your logging pipeline to consistently mask sensitive information across all log statements without manual intervention per log call.

What PII types can be redacted to meet compliance requirements?

Redaction covers phone numbers, email addresses, credit card numbers, SSNs, addresses, and other sensitive fields. The Skill provides generic redaction utilities and structured patterns to consistently mask these PII types, supporting compliance with GDPR, CCPA, PCI-DSS, and HIPAA regulations.

How do I test that PII redaction is working correctly in my application?

Use pytest patterns included in this Skill to verify redaction effectiveness. Test that sensitive information is masked in logs while partial identifiers remain visible for debugging, ensuring both privacy protection and operational diagnostics are maintained.

When should I redact PII, and are there cases where I shouldn't?

Always redact in logs, error messages, and debug output to prevent accidental data leaks. Never redact in actual API calls or database operations where the full data is needed for functionality. This context-aware approach maintains data integrity for operations while protecting privacy in outputs.

Does this Skill help prevent accidental data exposure in error messages and debug output?

Yes. The Skill automates redaction across logs, error messages, and debug outputs to prevent accidental data leaks. It ensures sensitive information is masked consistently, reducing the risk of exposing PII through unexpected error handling or development-time debugging.