langchain-data-handling

LangChain Data Handling

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "langchain-data-handling" with this command: npx skills add jeremylongshore/claude-code-plugins-plus-skills/jeremylongshore-claude-code-plugins-plus-skills-langchain-data-handling

LangChain Data Handling

Contents

  • Overview

  • Prerequisites

  • Instructions

  • Output

  • Error Handling

  • Examples

  • Resources

Overview

Best practices for handling sensitive data, PII protection, and compliance in LangChain applications including detection, masking, retention, consent, and audit logging.

Prerequisites

  • Understanding of data privacy regulations (GDPR, CCPA)

  • LangChain application processing user data

  • Data classification framework

Instructions

Step 1: Detect and Mask PII

Build a PIIDetector class with regex patterns for email, phone, SSN, credit card, IP address, and date of birth. Implement detect() , mask() , and redact() methods.

Step 2: Build Privacy Pipeline

Wrap chains with PII protection using RunnableLambda preprocessing that redacts PII before sending to the LLM.

Step 3: Enforce Data Retention

Implement DataRetentionManager with configurable retention periods, auto-cleanup of expired interactions, and GDPR right-to-erasure support.

Step 4: Manage Consent

Build ConsentManager with consent types (LLM processing, retention, analytics, training) and decorator-based consent enforcement.

Step 5: Enable Audit Logging

Create AuditLogger and AuditCallback to log all LLM calls with user ID, model, token count, and PII detection status.

See detailed implementation for complete PII detector, privacy pipeline, and compliance code.

Output

  • PII detection and masking

  • Privacy-wrapped chain pipeline

  • Data retention management

  • Consent management system

  • Audit logging

Error Handling

Issue Cause Solution

PII not detected Missing pattern Add regex to PIIPattern list

Retention not enforced Cleanup not scheduled Add cron job for cleanup

Consent check failed User not registered Create consent record first

Examples

Basic usage: Apply langchain data handling to a standard project setup with default configuration options.

Advanced scenario: Customize langchain data handling for production environments with multiple constraints and team-specific requirements.

Resources

  • GDPR Overview

  • CCPA Compliance

  • OpenAI Data Usage Policy

Next Steps

Use langchain-security-basics for additional security measures.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Web3

tracking-crypto-prices

No summary provided by upstream source.

Repository SourceNeeds Review
Web3

aggregating-crypto-news

No summary provided by upstream source.

Repository SourceNeeds Review
Web3

tracking-crypto-derivatives

No summary provided by upstream source.

Repository SourceNeeds Review
Web3

tracking-crypto-portfolio

No summary provided by upstream source.

Repository SourceNeeds Review