VE

vercel-data-handling

Guidance on redacting PII, managing data retention, and ensuring regulatory compliance on Vercel deployments.

Install

mkdir -p .claude/skills/vercel-data-handling && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6004" && unzip -o skill.zip -d .claude/skills/vercel-data-handling && rm skill.zip

Installs to .claude/skills/vercel-data-handling

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Implement data handling, PII protection, and GDPR/CCPA compliance for
69 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Redact PII from application logs before logging
  • Implement API routes for GDPR Right to Access requests
  • Implement API routes for GDPR Right to Erasure (soft delete)
  • Manage secure and consent-aware cookies
  • Configure Vercel function execution regions for data residency
  • Implement audit logging for data access and modifications

How it works

The skill provides code examples and configurations for redacting PII from logs, creating API endpoints for GDPR compliance, managing secure cookies, and setting Vercel function regions. It also outlines an audit logging mechanism.

Inputs & outputs

You give it
Sensitive data, user requests for data access/erasure, cookie settings, Vercel project configuration
You get back
Redacted logs, GDPR-compliant API responses, secure cookies, region-specific function deployments, and audit records

When to use vercel-data-handling

  • Redact PII from serverless function logs
  • Configure data retention policies
  • Implement GDPR-compliant data processing
  • Secure cookie management

About this skill

Vercel Data Handling

Overview

Handle sensitive data correctly on Vercel: PII redaction in logs, GDPR-compliant data processing in serverless functions, secure cookie management, and data residency configuration. Covers both what Vercel stores and what your application should protect.

Prerequisites

  • Understanding of GDPR/CCPA requirements
  • Vercel Pro or Enterprise (for data residency options)
  • Logging infrastructure with PII awareness

Instructions

Step 1: Understand What Vercel Stores

Data TypeWhereRetentionControl
Runtime logsVercel servers1hr (free), 30d (Plus)Log drains
Build logsVercel servers30 daysAutomatic
Analytics dataVercelAggregated, no PIIDisable in dashboard
Deployment sourceVercelUntil deletedManual deletion
Environment variablesVercel (encrypted)Until deletedScoped access

Step 2: PII Redaction in Logs

// lib/redact.ts — redact PII before logging
const PII_PATTERNS: [RegExp, string][] = [
  [/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g, '[EMAIL]'],
  [/\b\d{3}[-.]?\d{3}[-.]?\d{4}\b/g, '[PHONE]'],
  [/\b\d{3}-\d{2}-\d{4}\b/g, '[SSN]'],
  [/\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/g, '[CARD]'],
  [/\b(?:Bearer|token|key|secret|password)\s*[:=]\s*\S+/gi, '[CREDENTIAL]'],
];

export function redact(text: string): string {
  let result = text;
  for (const [pattern, replacement] of PII_PATTERNS) {
    result = result.replace(pattern, replacement);
  }
  return result;
}

// Usage — always redact before console.log
import { redact } from '@/lib/redact';

export async function POST(request: Request) {
  const body = await request.json();
  console.log('Request received:', redact(JSON.stringify(body)));
  // Process safely...
}

Step 3: GDPR-Compliant API Routes

// api/users/[id]/route.ts — data subject request handlers
import { NextRequest, NextResponse } from 'next/server';
import { db } from '@/lib/db';

// Right to Access (GDPR Art. 15)
export async function GET(
  request: NextRequest,
  { params }: { params: { id: string } }
) {
  const user = await db.user.findUnique({
    where: { id: params.id },
    include: { posts: true, preferences: true },
  });

  if (!user) return NextResponse.json({ error: 'Not found' }, { status: 404 });

  return NextResponse.json({
    personalData: {
      name: user.name,
      email: user.email,
      createdAt: user.createdAt,
      posts: user.posts,
      preferences: user.preferences,
    },
    exportedAt: new Date().toISOString(),
  });
}

// Right to Erasure (GDPR Art. 17)
export async function DELETE(
  request: NextRequest,
  { params }: { params: { id: string } }
) {
  // Soft delete — anonymize instead of hard delete for audit trail
  await db.user.update({
    where: { id: params.id },
    data: {
      email: `deleted-${params.id}@redacted.local`,
      name: '[DELETED]',
      deletedAt: new Date(),
    },
  });

  // Also delete from log drain provider if applicable
  console.log(`GDPR deletion completed for user ${params.id}`);
  return NextResponse.json({ deleted: true });
}

Step 4: Secure Cookie Management

// lib/cookies.ts — GDPR-aware cookie handling
import { cookies } from 'next/headers';

export function setSessionCookie(token: string): void {
  cookies().set('session', token, {
    httpOnly: true,       // Not accessible via JavaScript
    secure: true,         // HTTPS only
    sameSite: 'lax',      // CSRF protection
    maxAge: 60 * 60 * 24, // 24 hours
    path: '/',
  });
}

export function setConsentCookie(consent: Record<string, boolean>): void {
  cookies().set('consent', JSON.stringify(consent), {
    httpOnly: false,  // Needs client-side access
    secure: true,
    sameSite: 'lax',
    maxAge: 60 * 60 * 24 * 365, // 1 year
    path: '/',
  });
}

// Middleware — block analytics if consent not given
export function middleware(request: Request) {
  const consent = request.headers.get('cookie')?.includes('consent');
  if (!consent) {
    // Strip analytics query params, skip tracking middleware
  }
}

Step 5: Data Residency Configuration

Vercel allows configuring where your serverless functions execute:

// vercel.json — restrict function execution to EU regions
{
  "regions": ["cdg1", "lhr1"],
  "functions": {
    "api/**/*.ts": {
      "regions": ["cdg1"]
    }
  }
}

EU regions for GDPR data residency:

RegionLocationCode
ParisFrancecdg1
LondonUKlhr1
FrankfurtGermanyfra1

Step 6: Audit Logging

// lib/audit-log.ts — track data access for compliance
interface AuditEntry {
  action: 'read' | 'create' | 'update' | 'delete' | 'export';
  resource: string;
  resourceId: string;
  userId: string;
  ip: string;
  timestamp: string;
}

export async function auditLog(entry: Omit<AuditEntry, 'timestamp'>): Promise<void> {
  const record: AuditEntry = {
    ...entry,
    timestamp: new Date().toISOString(),
  };

  // Write to database audit table
  await db.auditLog.create({ data: record });

  // Also log for log drain capture (structured JSON)
  console.log(JSON.stringify({ type: 'audit', ...record }));
}

// Usage in API route:
export async function GET(request: NextRequest) {
  await auditLog({
    action: 'read',
    resource: 'user',
    resourceId: params.id,
    userId: session.userId,
    ip: request.headers.get('x-forwarded-for') ?? 'unknown',
  });
}

Data Classification Guide

CategoryExamplesHandling on Vercel
PIIEmail, name, phone, IPRedact from logs, encrypt at rest
SecretsAPI keys, tokens, passwordsUse type: sensitive env vars, never log
FinancialCard numbers, bank infoNever process in functions — use Stripe/payment provider
HealthMedical recordsRequires BAA — contact Vercel Enterprise
BusinessMetrics, usage statsAggregate before logging

Output

  • PII redaction applied to all log output
  • GDPR data subject request endpoints implemented
  • Secure cookie handling with consent management
  • Data residency configured via function regions
  • Audit logging for compliance trail

Error Handling

ErrorCauseSolution
PII in Vercel logsNot redacting before console.logUse redact() wrapper on all log calls
GDPR data request timeoutLarge data export in functionPaginate or use background processing
Cookies not secureMissing secure: true flagAlways set httpOnly and secure flags
Function running in wrong regionRegion not set in vercel.jsonSpecify regions per function

Resources

Next Steps

For enterprise RBAC, see vercel-enterprise-rbac.

Prerequisites

Understanding of GDPR/CCPA requirementsVercel Pro or Enterprise (for data residency options)Logging infrastructure with PII awareness

Limitations

  • PII in Vercel logs occurs if not redacting before console.log
  • GDPR data request timeout can happen with large data exports in a single function
  • Cookies may not be secure if `secure: true` flag is missing

How it compares

This skill provides concrete code patterns and Vercel configurations for data handling and privacy compliance, offering a structured approach compared to implementing these requirements manually.

Compared to similar skills

vercel-data-handling side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
vercel-data-handling (this skill)127dNo flagsIntermediate
skills06moNo flagsIntermediate
security-header-generator59moCautionIntermediate
backend-security-coder244moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

Search skills

Search the agent skills registry