$npx -y skills add rshankras/claude-code-apple-skills --skill consent-flowGenerates GDPR/CCPA/DPDP privacy consent flows with granular category preferences, consent state persistence, audit logging, and ATT (App Tracking Transparency) integration. Use when user needs privacy consent UI, cookie/tracking consent, or compliance management.
| 1 | # Consent Flow Generator |
| 2 | |
| 3 | Generate a production privacy consent system with granular category-based consent, persistent state management, a consent banner and preferences UI, audit logging for compliance, and App Tracking Transparency integration. |
| 4 | |
| 5 | ## When This Skill Activates |
| 6 | |
| 7 | Use this skill when the user: |
| 8 | - Asks about "privacy consent" or "consent management" |
| 9 | - Mentions "GDPR consent" or "GDPR compliance" |
| 10 | - Wants "cookie consent" or "tracking consent" |
| 11 | - Mentions "ATT prompt" or "App Tracking Transparency" |
| 12 | - Asks for "privacy preferences" or "consent preferences" |
| 13 | - Mentions "CCPA compliance" or "DPDP compliance" |
| 14 | - Wants to "manage user consent" or "consent banner" |
| 15 | - Asks about "consent audit log" or "consent records" |
| 16 | |
| 17 | ## Pre-Generation Checks |
| 18 | |
| 19 | ### 1. Project Context Detection |
| 20 | - [ ] Check Swift version (requires Swift 5.9+) |
| 21 | - [ ] Check deployment target (iOS 16+ / macOS 13+) |
| 22 | - [ ] Check for @Observable support (iOS 17+ / macOS 14+) |
| 23 | - [ ] Identify source file locations |
| 24 | |
| 25 | ### 2. Conflict Detection |
| 26 | Search for existing consent or privacy code: |
| 27 | ``` |
| 28 | Glob: **/*Consent*.swift, **/*Privacy*.swift, **/*Tracking*.swift, **/*GDPR*.swift |
| 29 | Grep: "ATTrackingManager" or "ConsentManager" or "trackingAuthorizationStatus" |
| 30 | ``` |
| 31 | |
| 32 | If third-party library found (OneTrust, Usercentrics, CookieBot): |
| 33 | - Ask if user wants to replace or keep it |
| 34 | - If keeping, don't generate — advise on integration best practices instead |
| 35 | |
| 36 | ### 3. ATT Framework Availability |
| 37 | Check for App Tracking Transparency framework: |
| 38 | ``` |
| 39 | Grep: "AppTrackingTransparency" in project files |
| 40 | Grep: "NSUserTrackingUsageDescription" in Info.plist |
| 41 | ``` |
| 42 | |
| 43 | If `NSUserTrackingUsageDescription` is missing from Info.plist, warn the user that ATT requires this key and offer to add it. |
| 44 | |
| 45 | ### 4. Platform Detection |
| 46 | Determine if generating for iOS (primary ATT target) or macOS (ATT not applicable) or both. |
| 47 | |
| 48 | ## Configuration Questions |
| 49 | |
| 50 | Ask user via AskUserQuestion: |
| 51 | |
| 52 | 1. **Target regulations?** |
| 53 | - GDPR only (EU — opt-in model) |
| 54 | - CCPA only (California — opt-out model) |
| 55 | - DPDP only (India — consent-based) |
| 56 | - All regulations (recommended for global apps) |
| 57 | |
| 58 | 2. **Consent categories?** (multi-select) |
| 59 | - Essential (always on, cannot be disabled) |
| 60 | - Analytics (usage tracking, crash reporting) |
| 61 | - Marketing (advertising, attribution) |
| 62 | - Personalization (recommendations, content tailoring) |
| 63 | - Functional (preferences, saved settings beyond essential) |
| 64 | |
| 65 | 3. **Include ATT integration?** |
| 66 | - Yes — request ATT permission before any tracking (recommended for iOS) |
| 67 | - No — handle consent without ATT (macOS, or no IDFA usage) |
| 68 | |
| 69 | 4. **Consent UI style?** |
| 70 | - Bottom banner with manage preferences (recommended) |
| 71 | - Full-screen consent view (for first launch) |
| 72 | - Settings-embedded (preferences in app settings, no banner) |
| 73 | - Banner + Settings (banner on first launch, preferences in settings) |
| 74 | |
| 75 | ## Generation Process |
| 76 | |
| 77 | ### Step 1: Read Templates |
| 78 | Read `templates.md` for production Swift code. |
| 79 | Read `patterns.md` for compliance rules, regulation differences, and UX guidance. |
| 80 | |
| 81 | ### Step 2: Create Core Files |
| 82 | Generate these files: |
| 83 | 1. `ConsentCategory.swift` — Enum of consent categories with metadata |
| 84 | 2. `ConsentDecision.swift` — Per-category consent state with timestamp |
| 85 | 3. `ConsentManager.swift` — @Observable manager with persistence and ATT integration |
| 86 | 4. `ConsentAuditLog.swift` — Compliance audit trail with JSON export |
| 87 | |
| 88 | ### Step 3: Create UI Files |
| 89 | 5. `ConsentBannerView.swift` — Animated slide-up consent banner |
| 90 | 6. `ConsentPreferencesView.swift` — Detailed toggle list for each category |
| 91 | |
| 92 | ### Step 4: Create Optional Files |
| 93 | Based on configuration: |
| 94 | - `ConsentRegulationConfig.swift` — If multiple regulations selected |
| 95 | - `ConsentATTBridge.swift` — If ATT integration selected (extracted for testability) |
| 96 | |
| 97 | ### Step 5: Determine File Location |
| 98 | Check project structure: |
| 99 | - If `Sources/` exists → `Sources/Consent/` |
| 100 | - If `App/` exists → `App/Consent/` |
| 101 | - Otherwise → `Consent/` |
| 102 | |
| 103 | ## Output Format |
| 104 | |
| 105 | After generation, provide: |
| 106 | |
| 107 | ### Files Created |
| 108 | ``` |
| 109 | Consent/ |
| 110 | ├── ConsentCategory.swift # Consent category enum with metadata |
| 111 | ├── ConsentDecision.swift # Per-category decision with timestamp |
| 112 | ├── ConsentManager.swift # @Observable manager with persistence |
| 113 | ├── ConsentAuditLog.swift # Compliance audit trail |
| 114 | ├── ConsentBannerView.swift # Animated consent banner |
| 115 | ├── ConsentPreferencesView.swift # Granular preferences UI |
| 116 | ├── ConsentRegulationConfig.swift # Multi-regulation rules (optional) |
| 117 | └── ConsentATTBridge.swift # ATT integration bridge (optional) |
| 118 | ``` |
| 119 | |
| 120 | ### |