[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M793JFSSJ56Q60897H824MA1":3,"skill-same:01M793JFSSJ56Q60897H824MA1":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":33,"commitSha":34,"skillDirectory":35,"forksCount":36,"repositoryHtmlUrl":37,"repositoryHomepageUrl":6,"ownerHtmlUrl":38,"ownerBlogUrl":39,"ownerDescription":40,"updatedAt":41,"install":42,"resources":55},"01M793JFSSJ56Q60897H824MA1","notion-data-handling",null,"Implement data handling, PII protection, and GDPR\u002FCCPA compliance for Notion integrations.\nUse when handling sensitive data from Notion pages, implementing data redaction,\nor ensuring compliance with privacy regulations.\nTrigger with phrases like \"notion data\", \"notion PII\",\n\"notion GDPR\", \"notion data retention\", \"notion privacy\", \"notion CCPA\".","jukeyman\u002Fjukeyman-skills","jukeyman","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142960420?v=4","01M78FR4Y3DHMMCBCC0GXXNB3F","RICK JEFFERSON","01M78FR4Z8RVQRAD31Y5J7V6EB",1,"MIT","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsaas-packs--notion-pack--notion-data-handling\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: notion-data-handling\ndescription: |\n  Implement data handling, PII protection, and GDPR\u002FCCPA compliance for Notion integrations.\n  Use when handling sensitive data from Notion pages, implementing data redaction,\n  or ensuring compliance with privacy regulations.\n  Trigger with phrases like \"notion data\", \"notion PII\",\n  \"notion GDPR\", \"notion data retention\", \"notion privacy\", \"notion CCPA\".\nallowed-tools: Read, Write, Edit\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\ntags: [saas, productivity, notion]\ncompatible-with: claude-code\n---\n\n# Notion Data Handling\n\n## Overview\n\nHandle sensitive data correctly when integrating with Notion: detect PII in page properties and block content, redact sensitive fields before logging or exporting, minimize data exposure with `filter_properties`, and implement GDPR\u002FCCPA compliance patterns including right-of-access exports, right-of-deletion (archive or field clearing), and retention-based archival with audit logging.\n\n## Prerequisites\n\n- `@notionhq\u002Fclient` v2+ installed (`npm install @notionhq\u002Fclient`)\n- Python alternative: `notion-client` (`pip install notion-client`)\n- Understanding of which Notion databases contain personal data\n- Audit logging infrastructure (structured logs, SIEM, or Notion audit database)\n- Legal guidance on applicable regulations (GDPR, CCPA, HIPAA, etc.)\n\n## Instructions\n\n### Step 1: PII Detection in Notion Content\n\nNotion pages can contain PII in any property type. Scan systematically:\n\n```typescript\nimport { Client } from '@notionhq\u002Fclient';\nimport type { PageObjectResponse } from '@notionhq\u002Fclient\u002Fbuild\u002Fsrc\u002Fapi-endpoints';\n\nconst notion = new Client({ auth: process.env.NOTION_TOKEN });\n\n\u002F\u002F PII pattern matchers\nconst PII_PATTERNS = [\n  { type: 'email',      pattern: \u002F[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\u002Fg },\n  { type: 'phone_us',   pattern: \u002F\\b\\d{3}[-.]?\\d{3}[-.]?\\d{4}\\b\u002Fg },\n  { type: 'phone_intl', pattern: \u002F\\+\\d{1,3}[-.\\s]?\\d{4,14}\u002Fg },\n  { type: 'ssn',        pattern: \u002F\\b\\d{3}-\\d{2}-\\d{4}\\b\u002Fg },\n  { type: 'credit_card', pattern: \u002F\\b\\d{4}[-\\s]?\\d{4}[-\\s]?\\d{4}[-\\s]?\\d{4}\\b\u002Fg },\n  { type: 'ip_address', pattern: \u002F\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b\u002Fg },\n];\n\ninterface PIIFinding {\n  propertyName: string;\n  piiType: string;\n  location: 'property' | 'content';\n}\n\nfunction scanPageForPII(page: PageObjectResponse): PIIFinding[] {\n  const findings: PIIFinding[] = [];\n\n  for (const [name, prop] of Object.entries(page.properties)) {\n    \u002F\u002F Direct PII property types\n    if (prop.type === 'email' && prop.email) {\n      findings.push({ propertyName: name, piiType: 'email', location: 'property' });\n    }\n    if (prop.type === 'phone_number' && prop.phone_number) {\n      findings.push({ propertyName: name, piiType: 'phone', location: 'property' });\n    }\n    if (prop.type === 'people' && prop.people.length > 0) {\n      findings.push({ propertyName: name, piiType: 'user_reference', location: 'property' });\n    }\n\n    \u002F\u002F Text properties may contain embedded PII\n    if (prop.type === 'rich_text' || prop.type === 'title') {\n      const textParts = prop.type === 'title' ? prop.title : prop.rich_text;\n      const text = textParts.map(t => t.plain_text).join('');\n\n      for (const { type, pattern } of PII_PATTERNS) {\n        \u002F\u002F Reset regex lastIndex for each check\n        pattern.lastIndex = 0;\n        if (pattern.test(text)) {\n          findings.push({ propertyName: name, piiType: type, location: 'property' });\n        }\n      }\n    }\n  }\n\n  return findings;\n}\n\n\u002F\u002F Scan an entire database for PII\nasync function auditDatabaseForPII(dbId: string) {\n  const findings: { pageId: string; pageTitle: string; pii: PIIFinding[] }[] = [];\n  let cursor: string | undefined;\n\n  do {\n    const response = await notion.databases.query({\n      database_id: dbId,\n      page_size: 100,\n      start_cursor: cursor,\n    });\n\n    for (const page of response.results) {\n      if (!('properties' in page)) continue;\n      const pii = scanPageForPII(page as PageObjectResponse);\n      if (pii.length > 0) {\n        const titleProp = Object.values(page.properties)\n          .find(p => p.type === 'title');\n        const title = titleProp?.type === 'title'\n          ? titleProp.title.map(t => t.plain_text).join('')\n          : 'Untitled';\n        findings.push({ pageId: page.id, pageTitle: title, pii });\n      }\n    }\n\n    cursor = response.has_more ? response.next_cursor ?? undefined : undefined;\n  } while (cursor);\n\n  return findings;\n}\n```\n\n**Python — PII scanner:**\n\n```python\nimport re\nfrom notion_client import Client\n\nclient = Client(auth=os.environ[\"NOTION_TOKEN\"])\n\nPII_PATTERNS = [\n    (\"email\", re.compile(r\"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\")),\n    (\"phone\", re.compile(r\"\\b\\d{3}[-.]?\\d{3}[-.]?\\d{4}\\b\")),\n    (\"ssn\", re.compile(r\"\\b\\d{3}-\\d{2}-\\d{4}\\b\")),\n]\n\ndef scan_page_for_pii(page: dict) -> list[dict]:\n    findings = []\n    for name, prop in page[\"properties\"].items():\n        if prop[\"type\"] == \"email\" and prop.get(\"email\"):\n            findings.append({\"property\": name, \"type\": \"email\"})\n        if prop[\"type\"] == \"phone_number\" and prop.get(\"phone_number\"):\n            findings.append({\"property\": name, \"type\": \"phone\"})\n        if prop[\"type\"] in (\"rich_text\", \"title\"):\n            parts = prop.get(\"title\" if prop[\"type\"] == \"title\" else \"rich_text\", [])\n            text = \"\".join(t[\"plain_text\"] for t in parts)\n            for pii_type, pattern in PII_PATTERNS:\n                if pattern.search(text):\n                    findings.append({\"property\": name, \"type\": pii_type})\n    return findings\n```\n\n### Step 2: Redaction and Data Minimization\n\n**Redact PII before logging or exporting:**\n\n```typescript\nfunction redactPageProperties(\n  page: PageObjectResponse,\n  sensitiveFields: string[] = ['Email', 'Phone', 'SSN']\n): Record\u003Cstring, unknown> {\n  const redacted: Record\u003Cstring, unknown> = { id: page.id };\n\n  for (const [name, prop] of Object.entries(page.properties)) {\n    \u002F\u002F Always redact known sensitive property types\n    if (prop.type === 'email') {\n      redacted[name] = prop.email ? '[REDACTED_EMAIL]' : null;\n      continue;\n    }\n    if (prop.type === 'phone_number') {\n      redacted[name] = prop.phone_number ? '[REDACTED_PHONE]' : null;\n      continue;\n    }\n    if (prop.type === 'people') {\n      redacted[name] = `[${prop.people.length} users]`;\n      continue;\n    }\n\n    \u002F\u002F Redact explicitly marked sensitive fields\n    if (sensitiveFields.includes(name)) {\n      redacted[name] = '[REDACTED]';\n      continue;\n    }\n\n    \u002F\u002F Safe property types pass through\n    switch (prop.type) {\n      case 'title':\n        redacted[name] = prop.title.map(t => t.plain_text).join('');\n        break;\n      case 'select':\n        redacted[name] = prop.select?.name ?? null;\n        break;\n      case 'multi_select':\n        redacted[name] = prop.multi_select.map(s => s.name);\n        break;\n      case 'number':\n        redacted[name] = prop.number;\n        break;\n      case 'checkbox':\n        redacted[name] = prop.checkbox;\n        break;\n      case 'date':\n        redacted[name] = prop.date?.start ?? null;\n        break;\n      default:\n        redacted[name] = `[${prop.type}]`;\n    }\n  }\n\n  return redacted;\n}\n\n\u002F\u002F Safe logging — never log raw page objects\nconsole.log('Processing page:', JSON.stringify(redactPageProperties(page)));\n\u002F\u002F NEVER: console.log('Page:', JSON.stringify(page)); \u002F\u002F LEAKS PII\n```\n\n**Data minimization — only request properties you need:**\n\n```typescript\n\u002F\u002F filter_properties limits which properties are returned by the API\nasync function getTaskStatuses(dbId: string) {\n  const response = await notion.databases.query({\n    database_id: dbId,\n    filter_properties: ['Status', 'Name', 'Due Date'],\n    page_size: 100,\n  });\n  \u002F\u002F Response only contains Status, Name, Due Date — no email, phone, etc.\n  return response;\n}\n```\n\n### Step 3: GDPR\u002FCCPA Compliance Patterns\n\n**Right of Access — export all data for a user:**\n\n```typescript\nasync function exportUserData(userId: string, databaseIds: string[]) {\n  const exportData: Record\u003Cstring, unknown> = {\n    exportedAt: new Date().toISOString(),\n    requestType: 'GDPR Article 15 — Right of Access',\n    source: 'Notion Integration',\n    databases: {} as Record\u003Cstring, unknown>,\n  };\n\n  for (const dbId of databaseIds) {\n    const response = await notion.databases.query({\n      database_id: dbId,\n      filter: {\n        property: 'Assignee',\n        people: { contains: userId },\n      },\n    });\n\n    (exportData.databases as Record\u003Cstring, unknown>)[dbId] = response.results\n      .filter((p): p is PageObjectResponse => 'properties' in p)\n      .map(page => ({\n        id: page.id,\n        url: page.url,\n        created: page.created_time,\n        lastEdited: page.last_edited_time,\n        properties: page.properties,\n      }));\n  }\n\n  \u002F\u002F Audit log the export\n  console.log(JSON.stringify({\n    event: 'gdpr_data_export',\n    userId,\n    databaseCount: databaseIds.length,\n    timestamp: new Date().toISOString(),\n  }));\n\n  return exportData;\n}\n```\n\n**Right of Deletion — archive pages or clear PII fields:**\n\n```typescript\nasync function deleteUserData(\n  userId: string,\n  databaseIds: string[],\n  strategy: 'archive' | 'clear_pii' = 'archive'\n) {\n  const deletionLog: { pageId: string; action: string; database: string }[] = [];\n\n  for (const dbId of databaseIds) {\n    const pages = await notion.databases.query({\n      database_id: dbId,\n      filter: {\n        property: 'Assignee',\n        people: { contains: userId },\n      },\n    });\n\n    for (const page of pages.results) {\n      if (strategy === 'archive') {\n        \u002F\u002F Soft delete — page moved to trash (recoverable for 30 days)\n        await notion.pages.update({\n          page_id: page.id,\n          archived: true,\n        });\n        deletionLog.push({ pageId: page.id, action: 'archived', database: dbId });\n      } else {\n        \u002F\u002F Clear PII fields but keep the record\n        await notion.pages.update({\n          page_id: page.id,\n          properties: {\n            Email: { email: null },\n            Phone: { phone_number: null },\n            Assignee: { people: [] },\n            Notes: { rich_text: [{ text: { content: '[Data deleted per GDPR request]' } }] },\n          },\n        });\n        deletionLog.push({ pageId: page.id, action: 'pii_cleared', database: dbId });\n      }\n\n      \u002F\u002F Rate limit: 3 requests\u002Fsecond\n      if (deletionLog.length % 3 === 0) {\n        await new Promise(r => setTimeout(r, 1100));\n      }\n    }\n  }\n\n  \u002F\u002F Audit log (REQUIRED for compliance — keep for minimum retention period)\n  console.log(JSON.stringify({\n    event: 'gdpr_data_deletion',\n    userId,\n    strategy,\n    pagesAffected: deletionLog.length,\n    timestamp: new Date().toISOString(),\n    log: deletionLog,\n  }));\n\n  return deletionLog;\n}\n```\n\n**Data retention — archive pages past retention window:**\n\n```typescript\nasync function enforceRetention(dbId: string, retentionDays: number) {\n  const cutoff = new Date();\n  cutoff.setDate(cutoff.getDate() - retentionDays);\n\n  let cursor: string | undefined;\n  let archived = 0;\n\n  do {\n    const response = await notion.databases.query({\n      database_id: dbId,\n      filter: {\n        timestamp: 'last_edited_time',\n        last_edited_time: { before: cutoff.toISOString() },\n      },\n      page_size: 100,\n      start_cursor: cursor,\n    });\n\n    for (const page of response.results) {\n      await notion.pages.update({ page_id: page.id, archived: true });\n      archived++;\n      \u002F\u002F Respect rate limits\n      if (archived % 3 === 0) await new Promise(r => setTimeout(r, 1100));\n    }\n\n    cursor = response.has_more ? response.next_cursor ?? undefined : undefined;\n  } while (cursor);\n\n  console.log(JSON.stringify({\n    event: 'retention_enforcement',\n    database_id: dbId,\n    retention_days: retentionDays,\n    pages_archived: archived,\n    cutoff_date: cutoff.toISOString(),\n    timestamp: new Date().toISOString(),\n  }));\n\n  return { archived, cutoffDate: cutoff.toISOString() };\n}\n```\n\n## Output\n\n- PII detection scanning all property types and text content (TS + Python)\n- Redaction layer preventing PII leakage in logs and exports\n- Data minimization via `filter_properties` in API queries\n- GDPR Article 15 data export with audit logging\n- GDPR Article 17 deletion (archive or field clearing) with rate limiting\n- Retention-based archival with structured compliance logging\n- Audit trail for all data access, export, and deletion events\n\n## Error Handling\n\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| PII in application logs | Missing redaction layer | Use `redactPageProperties` for all logging |\n| Deletion fails on pages | Integration lacks Update capability | Edit integration at notion.so\u002Fmy-integrations |\n| Export missing pages | Pagination not handled | Use `start_cursor` loop until `has_more` is false |\n| Rate limit during bulk deletion | Too many update calls | Throttle to 3 requests\u002Fsecond with delays |\n| Regex false positives | Overly broad patterns | Tune patterns for your data; consider allowlists |\n| Audit log gaps | Async logging dropped events | Use synchronous logging for compliance events |\n\n## Examples\n\n### Quick PII Audit for a Database\n\n```typescript\nconst findings = await auditDatabaseForPII(process.env.NOTION_DB_ID!);\nconsole.log(`PII audit: ${findings.length} pages with PII detected`);\nfor (const f of findings) {\n  console.log(`  Page \"${f.pageTitle}\": ${f.pii.map(p => p.piiType).join(', ')}`);\n}\n```\n\n### Python Data Export\n\n```python\ndef export_user_data(user_id: str, db_ids: list[str]) -> dict:\n    export = {\"exported_at\": datetime.utcnow().isoformat(), \"databases\": {}}\n    for db_id in db_ids:\n        results = client.databases.query(\n            database_id=db_id,\n            filter={\"property\": \"Assignee\", \"people\": {\"contains\": user_id}},\n        )\n        export[\"databases\"][db_id] = [\n            {\"id\": p[\"id\"], \"properties\": p[\"properties\"]}\n            for p in results[\"results\"]\n        ]\n    return export\n```\n\n## Resources\n\n- [GDPR Developer Guide](https:\u002F\u002Fgdpr.eu\u002Fdevelopers\u002F) — key articles for data processors\n- [Notion Page Properties Reference](https:\u002F\u002Fdevelopers.notion.com\u002Freference\u002Fpage-property-values) — all property types\n- [Database Query with filter_properties](https:\u002F\u002Fdevelopers.notion.com\u002Freference\u002Fpost-database-query) — data minimization\n- [CCPA Overview](https:\u002F\u002Foag.ca.gov\u002Fprivacy\u002Fccpa) — California Consumer Privacy Act requirements\n- [Notion API Update Page](https:\u002F\u002Fdevelopers.notion.com\u002Freference\u002Fpatch-page) — archive and property updates\n\n## Next Steps\n\nFor enterprise access control and multi-workspace permissions, see `notion-enterprise-rbac`.\n","# Notion Data Handling\n\n## Overview\n\nHandle sensitive data correctly when integrating with Notion: detect PII in page properties and block content, redact sensitive fields before logging or exporting, minimize data exposure with `filter_properties`, and implement GDPR\u002FCCPA compliance patterns including right-of-access exports, right-of-deletion (archive or field clearing), and retention-based archival with audit logging.\n\n## Prerequisites\n\n- `@notionhq\u002Fclient` v2+ installed (`npm install @notionhq\u002Fclient`)\n- Python alternative: `notion-client` (`pip install notion-client`)\n- Understanding of which Notion databases contain personal data\n- Audit logging infrastructure (structured logs, SIEM, or Notion audit database)\n- Legal guidance on applicable regulations (GDPR, CCPA, HIPAA, etc.)\n\n## Instructions\n\n### Step 1: PII Detection in Notion Content\n\nNotion pages can contain PII in any property type. Scan systematically:\n\n```typescript\nimport { Client } from '@notionhq\u002Fclient';\nimport type { PageObjectResponse } from '@notionhq\u002Fclient\u002Fbuild\u002Fsrc\u002Fapi-endpoints';\n\nconst notion = new Client({ auth: process.env.NOTION_TOKEN });\n\n\u002F\u002F PII pattern matchers\nconst PII_PATTERNS = [\n  { type: 'email',      pattern: \u002F[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\u002Fg },\n  { type: 'phone_us',   pattern: \u002F\\b\\d{3}[-.]?\\d{3}[-.]?\\d{4}\\b\u002Fg },\n  { type: 'phone_intl', pattern: \u002F\\+\\d{1,3}[-.\\s]?\\d{4,14}\u002Fg },\n  { type: 'ssn',        pattern: \u002F\\b\\d{3}-\\d{2}-\\d{4}\\b\u002Fg },\n  { type: 'credit_card', pattern: \u002F\\b\\d{4}[-\\s]?\\d{4}[-\\s]?\\d{4}[-\\s]?\\d{4}\\b\u002Fg },\n  { type: 'ip_address', pattern: \u002F\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b\u002Fg },\n];\n\ninterface PIIFinding {\n  propertyName: string;\n  piiType: string;\n  location: 'property' | 'content';\n}\n\nfunction scanPageForPII(page: PageObjectResponse): PIIFinding[] {\n  const findings: PIIFinding[] = [];\n\n  for (const [name, prop] of Object.entries(page.properties)) {\n    \u002F\u002F Direct PII property types\n    if (prop.type === 'email' && prop.email) {\n      findings.push({ propertyName: name, piiType: 'email', location: 'property' });\n    }\n    if (prop.type === 'phone_number' && prop.phone_number) {\n      findings.push({ propertyName: name, piiType: 'phone', location: 'property' });\n    }\n    if (prop.type === 'people' && prop.people.length > 0) {\n      findings.push({ propertyName: name, piiType: 'user_reference', location: 'property' });\n    }\n\n    \u002F\u002F Text properties may contain embedded PII\n    if (prop.type === 'rich_text' || prop.type === 'title') {\n      const textParts = prop.type === 'title' ? prop.title : prop.rich_text;\n      const text = textParts.map(t => t.plain_text).join('');\n\n      for (const { type, pattern } of PII_PATTERNS) {\n        \u002F\u002F Reset regex lastIndex for each check\n        pattern.lastIndex = 0;\n        if (pattern.test(text)) {\n          findings.push({ propertyName: name, piiType: type, location: 'property' });\n        }\n      }\n    }\n  }\n\n  return findings;\n}\n\n\u002F\u002F Scan an entire database for PII\nasync function auditDatabaseForPII(dbId: string) {\n  const findings: { pageId: string; pageTitle: string; pii: PIIFinding[] }[] = [];\n  let cursor: string | undefined;\n\n  do {\n    const response = await notion.databases.query({\n      database_id: dbId,\n      page_size: 100,\n      start_cursor: cursor,\n    });\n\n    for (const page of response.results) {\n      if (!('properties' in page)) continue;\n      const pii = scanPageForPII(page as PageObjectResponse);\n      if (pii.length > 0) {\n        const titleProp = Object.values(page.properties)\n          .find(p => p.type === 'title');\n        const title = titleProp?.type === 'title'\n          ? titleProp.title.map(t => t.plain_text).join('')\n          : 'Untitled';\n        findings.push({ pageId: page.id, pageTitle: title, pii });\n      }\n    }\n\n    cursor = response.has_more ? response.next_cursor ?? undefined : undefined;\n  } while (cursor);\n\n  return findings;\n}\n```\n\n**Python — PII scanner:**\n\n```python\nimport re\nfrom notion_client import Client\n\nclient = Client(auth=os.environ[\"NOTION_TOKEN\"])\n\nPII_PATTERNS = [\n    (\"email\", re.compile(r\"[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\")),\n    (\"phone\", re.compile(r\"\\b\\d{3}[-.]?\\d{3}[-.]?\\d{4}\\b\")),\n    (\"ssn\", re.compile(r\"\\b\\d{3}-\\d{2}-\\d{4}\\b\")),\n]\n\ndef scan_page_for_pii(page: dict) -> list[dict]:\n    findings = []\n    for name, prop in page[\"properties\"].items():\n        if prop[\"type\"] == \"email\" and prop.get(\"email\"):\n            findings.append({\"property\": name, \"type\": \"email\"})\n        if prop[\"type\"] == \"phone_number\" and prop.get(\"phone_number\"):\n            findings.append({\"property\": name, \"type\": \"phone\"})\n        if prop[\"type\"] in (\"rich_text\", \"title\"):\n            parts = prop.get(\"title\" if prop[\"type\"] == \"title\" else \"rich_text\", [])\n            text = \"\".join(t[\"plain_text\"] for t in parts)\n            for pii_type, pattern in PII_PATTERNS:\n                if pattern.search(text):\n                    findings.append({\"property\": name, \"type\": pii_type})\n    return findings\n```\n\n### Step 2: Redaction and Data Minimization\n\n**Redact PII before logging or exporting:**\n\n```typescript\nfunction redactPageProperties(\n  page: PageObjectResponse,\n  sensitiveFields: string[] = ['Email', 'Phone', 'SSN']\n): Record\u003Cstring, unknown> {\n  const redacted: Record\u003Cstring, unknown> = { id: page.id };\n\n  for (const [name, prop] of Object.entries(page.properties)) {\n    \u002F\u002F Always redact known sensitive property types\n    if (prop.type === 'email') {\n      redacted[name] = prop.email ? '[REDACTED_EMAIL]' : null;\n      continue;\n    }\n    if (prop.type === 'phone_number') {\n      redacted[name] = prop.phone_number ? '[REDACTED_PHONE]' : null;\n      continue;\n    }\n    if (prop.type === 'people') {\n      redacted[name] = `[${prop.people.length} users]`;\n      continue;\n    }\n\n    \u002F\u002F Redact explicitly marked sensitive fields\n    if (sensitiveFields.includes(name)) {\n      redacted[name] = '[REDACTED]';\n      continue;\n    }\n\n    \u002F\u002F Safe property types pass through\n    switch (prop.type) {\n      case 'title':\n        redacted[name] = prop.title.map(t => t.plain_text).join('');\n        break;\n      case 'select':\n        redacted[name] = prop.select?.name ?? null;\n        break;\n      case 'multi_select':\n        redacted[name] = prop.multi_select.map(s => s.name);\n        break;\n      case 'number':\n        redacted[name] = prop.number;\n        break;\n      case 'checkbox':\n        redacted[name] = prop.checkbox;\n        break;\n      case 'date':\n        redacted[name] = prop.date?.start ?? null;\n        break;\n      default:\n        redacted[name] = `[${prop.type}]`;\n    }\n  }\n\n  return redacted;\n}\n\n\u002F\u002F Safe logging — never log raw page objects\nconsole.log('Processing page:', JSON.stringify(redactPageProperties(page)));\n\u002F\u002F NEVER: console.log('Page:', JSON.stringify(page)); \u002F\u002F LEAKS PII\n```\n\n**Data minimization — only request properties you need:**\n\n```typescript\n\u002F\u002F filter_properties limits which properties are returned by the API\nasync function getTaskStatuses(dbId: string) {\n  const response = await notion.databases.query({\n    database_id: dbId,\n    filter_properties: ['Status', 'Name', 'Due Date'],\n    page_size: 100,\n  });\n  \u002F\u002F Response only contains Status, Name, Due Date — no email, phone, etc.\n  return response;\n}\n```\n\n### Step 3: GDPR\u002FCCPA Compliance Patterns\n\n**Right of Access — export all data for a user:**\n\n```typescript\nasync function exportUserData(userId: string, databaseIds: string[]) {\n  const exportData: Record\u003Cstring, unknown> = {\n    exportedAt: new Date().toISOString(),\n    requestType: 'GDPR Article 15 — Right of Access',\n    source: 'Notion Integration',\n    databases: {} as Record\u003Cstring, unknown>,\n  };\n\n  for (const dbId of databaseIds) {\n    const response = await notion.databases.query({\n      database_id: dbId,\n      filter: {\n        property: 'Assignee',\n        people: { contains: userId },\n      },\n    });\n\n    (exportData.databases as Record\u003Cstring, unknown>)[dbId] = response.results\n      .filter((p): p is PageObjectResponse => 'properties' in p)\n      .map(page => ({\n        id: page.id,\n        url: page.url,\n        created: page.created_time,\n        lastEdited: page.last_edited_time,\n        properties: page.properties,\n      }));\n  }\n\n  \u002F\u002F Audit log the export\n  console.log(JSON.stringify({\n    event: 'gdpr_data_export',\n    userId,\n    databaseCount: databaseIds.length,\n    timestamp: new Date().toISOString(),\n  }));\n\n  return exportData;\n}\n```\n\n**Right of Deletion — archive pages or clear PII fields:**\n\n```typescript\nasync function deleteUserData(\n  userId: string,\n  databaseIds: string[],\n  strategy: 'archive' | 'clear_pii' = 'archive'\n) {\n  const deletionLog: { pageId: string; action: string; database: string }[] = [];\n\n  for (const dbId of databaseIds) {\n    const pages = await notion.databases.query({\n      database_id: dbId,\n      filter: {\n        property: 'Assignee',\n        people: { contains: userId },\n      },\n    });\n\n    for (const page of pages.results) {\n      if (strategy === 'archive') {\n        \u002F\u002F Soft delete — page moved to trash (recoverable for 30 days)\n        await notion.pages.update({\n          page_id: page.id,\n          archived: true,\n        });\n        deletionLog.push({ pageId: page.id, action: 'archived', database: dbId });\n      } else {\n        \u002F\u002F Clear PII fields but keep the record\n        await notion.pages.update({\n          page_id: page.id,\n          properties: {\n            Email: { email: null },\n            Phone: { phone_number: null },\n            Assignee: { people: [] },\n            Notes: { rich_text: [{ text: { content: '[Data deleted per GDPR request]' } }] },\n          },\n        });\n        deletionLog.push({ pageId: page.id, action: 'pii_cleared', database: dbId });\n      }\n\n      \u002F\u002F Rate limit: 3 requests\u002Fsecond\n      if (deletionLog.length % 3 === 0) {\n        await new Promise(r => setTimeout(r, 1100));\n      }\n    }\n  }\n\n  \u002F\u002F Audit log (REQUIRED for compliance — keep for minimum retention period)\n  console.log(JSON.stringify({\n    event: 'gdpr_data_deletion',\n    userId,\n    strategy,\n    pagesAffected: deletionLog.length,\n    timestamp: new Date().toISOString(),\n    log: deletionLog,\n  }));\n\n  return deletionLog;\n}\n```\n\n**Data retention — archive pages past retention window:**\n\n```typescript\nasync function enforceRetention(dbId: string, retentionDays: number) {\n  const cutoff = new Date();\n  cutoff.setDate(cutoff.getDate() - retentionDays);\n\n  let cursor: string | undefined;\n  let archived = 0;\n\n  do {\n    const response = await notion.databases.query({\n      database_id: dbId,\n      filter: {\n        timestamp: 'last_edited_time',\n        last_edited_time: { before: cutoff.toISOString() },\n      },\n      page_size: 100,\n      start_cursor: cursor,\n    });\n\n    for (const page of response.results) {\n      await notion.pages.update({ page_id: page.id, archived: true });\n      archived++;\n      \u002F\u002F Respect rate limits\n      if (archived % 3 === 0) await new Promise(r => setTimeout(r, 1100));\n    }\n\n    cursor = response.has_more ? response.next_cursor ?? undefined : undefined;\n  } while (cursor);\n\n  console.log(JSON.stringify({\n    event: 'retention_enforcement',\n    database_id: dbId,\n    retention_days: retentionDays,\n    pages_archived: archived,\n    cutoff_date: cutoff.toISOString(),\n    timestamp: new Date().toISOString(),\n  }));\n\n  return { archived, cutoffDate: cutoff.toISOString() };\n}\n```\n\n## Output\n\n- PII detection scanning all property types and text content (TS + Python)\n- Redaction layer preventing PII leakage in logs and exports\n- Data minimization via `filter_properties` in API queries\n- GDPR Article 15 data export with audit logging\n- GDPR Article 17 deletion (archive or field clearing) with rate limiting\n- Retention-based archival with structured compliance logging\n- Audit trail for all data access, export, and deletion events\n\n## Error Handling\n\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| PII in application logs | Missing redaction layer | Use `redactPageProperties` for all logging |\n| Deletion fails on pages | Integration lacks Update capability | Edit integration at notion.so\u002Fmy-integrations |\n| Export missing pages | Pagination not handled | Use `start_cursor` loop until `has_more` is false |\n| Rate limit during bulk deletion | Too many update calls | Throttle to 3 requests\u002Fsecond with delays |\n| Regex false positives | Overly broad patterns | Tune patterns for your data; consider allowlists |\n| Audit log gaps | Async logging dropped events | Use synchronous logging for compliance events |\n\n## Examples\n\n### Quick PII Audit for a Database\n\n```typescript\nconst findings = await auditDatabaseForPII(process.env.NOTION_DB_ID!);\nconsole.log(`PII audit: ${findings.length} pages with PII detected`);\nfor (const f of findings) {\n  console.log(`  Page \"${f.pageTitle}\": ${f.pii.map(p => p.piiType).join(', ')}`);\n}\n```\n\n### Python Data Export\n\n```python\ndef export_user_data(user_id: str, db_ids: list[str]) -> dict:\n    export = {\"exported_at\": datetime.utcnow().isoformat(), \"databases\": {}}\n    for db_id in db_ids:\n        results = client.databases.query(\n            database_id=db_id,\n            filter={\"property\": \"Assignee\", \"people\": {\"contains\": user_id}},\n        )\n        export[\"databases\"][db_id] = [\n            {\"id\": p[\"id\"], \"properties\": p[\"properties\"]}\n            for p in results[\"results\"]\n        ]\n    return export\n```\n\n## Resources\n\n- [GDPR Developer Guide](https:\u002F\u002Fgdpr.eu\u002Fdevelopers\u002F) — key articles for data processors\n- [Notion Page Properties Reference](https:\u002F\u002Fdevelopers.notion.com\u002Freference\u002Fpage-property-values) — all property types\n- [Database Query with filter_properties](https:\u002F\u002Fdevelopers.notion.com\u002Freference\u002Fpost-database-query) — data minimization\n- [CCPA Overview](https:\u002F\u002Foag.ca.gov\u002Fprivacy\u002Fccpa) — California Consumer Privacy Act requirements\n- [Notion API Update Page](https:\u002F\u002Fdevelopers.notion.com\u002Freference\u002Fpatch-page) — archive and property updates\n\n## Next Steps\n\nFor enterprise access control and multi-workspace permissions, see `notion-enterprise-rbac`.\n",{"name":5,"tags":24,"author":28,"license":15,"version":29,"description":30,"allowed-tools":31,"compatible-with":32},[25,26,27],"saas","productivity","notion","Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Implement data handling, PII protection, and GDPR\u002FCCPA compliance for Notion integrations.\nUse when handling sensitive data from Notion pages, implementing data redaction,\nor ensuring compliance with privacy regulations.\nTrigger with phrases like \"notion data\", \"notion PII\",\n\"notion GDPR\", \"notion data retention\", \"notion privacy\", \"notion CCPA\".\n","Read, Write, Edit","claude-code","main","99825ad3f3bcc6597ddcc7294a14e6e922f2b67b","skills\u002Fsaas-packs--notion-pack--notion-data-handling",0,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills","https:\u002F\u002Fgithub.com\u002Fjukeyman","https:\u002F\u002FRJBUSINESSSOLUTIONS.ORG","Credit and Finance Expert | Developer\r\n\r\nI'm Rick Jefferson, a seasoned credit and finance expert with over a decade of experience in financial literacy,","2026-07-13 07:03:29",{"source":8,"skillName":5,"commands":43,"prompt":53,"zipAvailable":54},[44,47,50],{"tool":45,"command":46},"npx","npx skills add jukeyman\u002Fjukeyman-skills --skill notion-data-handling",{"tool":48,"command":49},"bunx","bunx skills add jukeyman\u002Fjukeyman-skills --skill notion-data-handling",{"tool":51,"command":52},"pnpm","pnpm dlx skills add jukeyman\u002Fjukeyman-skills --skill notion-data-handling","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsaas-packs--notion-pack--notion-data-handling\u002FSKILL.md",true,[],[57,64,71,78,85,93],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M79ANS2SM329NEP5ZCX106RR","zustand-store-creator","Create zustand store creator operations. Auto-activating skill for Frontend Development.\nTriggers on: zustand store creator, zustand store creator\nPart of the Frontend Development skill category. Use when working with zustand store creator functionality. Trigger with phrases like \"zustand store creator\", \"zustand creator\", \"zustand\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzustand-store-creator\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M79AMZKP4YDEZ7EHG1Y7PP74","zero-trust-config-helper","Configure with zero trust config helper operations. Auto-activating skill for Security Advanced.\nTriggers on: zero trust config helper, zero trust config helper\nPart of the Security Advanced skill category. Use when configuring systems or services. Trigger with phrases like \"zero trust config helper\", \"zero helper\", \"zero\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzero-trust-config-helper\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M79AMJSBCEJQNBTYNAHYN5HM","zapier-integration-helper","Assist with zapier integration helper operations. Auto-activating skill for Business Automation.\nTriggers on: zapier integration helper, zapier integration helper\nPart of the Business Automation skill category. Use when working with APIs or building integrations. Trigger with phrases like \"zapier integration helper\", \"zapier helper\", \"zapier\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzapier-integration-helper\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M79AHJZGVMARS13VFQYRR1MP","yaml-config-validator","Validate yaml config validator operations. Auto-activating skill for DevOps Basics.\nTriggers on: yaml config validator, yaml config validator\nPart of the DevOps Basics skill category. Use when configuring systems or services. Trigger with phrases like \"yaml config validator\", \"yaml validator\", \"yaml\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fyaml-config-validator\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":89,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M79AHGDZRN0020RDQSQDPAM8","xvary-stock-research","Thesis-driven equity analysis from public SEC EDGAR and market data; \u002Fanalyze, \u002Fscore, \u002Fcompare workflows with bundled Python tools (Claude Code, Cursor, Codex).","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M79AHCYJ9FV9RMHQ24HDRN33","xss-vulnerability-scanner","Scan xss vulnerability scanner operations. Auto-activating skill for Security Fundamentals.\nTriggers on: xss vulnerability scanner, xss vulnerability scanner\nPart of the Security Fundamentals skill category. Use when working with xss vulnerability scanner functionality. Trigger with phrases like \"xss vulnerability scanner\", \"xss scanner\", \"xss\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxss-vulnerability-scanner\u002FSKILL.md",[],[]]