Consent Flow logo

Consent Flow

Community
rshankras
consent-flow

Generates 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.

Overview

Publisherrshankras
Repositoryclaude-code-apple-skills
Skill nameconsent-flow
Stars
744
Forks
70
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by rshankras on GitHub. Read the source before you install it.

Installation

Install the Consent Flow AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/rshankras/claude-code-apple-skills.git /tmp/claude-code-apple-skills
mkdir -p .claude/skills
cp -r /tmp/claude-code-apple-skills/skills/generators/consent-flow .claude/skills/consent-flow
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Consent Flow in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Consent Flow on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Consent Flow is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Consent Flow Generator

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.

When This Skill Activates

Use this skill when the user:

  • Asks about "privacy consent" or "consent management"
  • Mentions "GDPR consent" or "GDPR compliance"
  • Wants "cookie consent" or "tracking consent"
  • Mentions "ATT prompt" or "App Tracking Transparency"
  • Asks for "privacy preferences" or "consent preferences"
  • Mentions "CCPA compliance" or "DPDP compliance"
  • Wants to "manage user consent" or "consent banner"
  • Asks about "consent audit log" or "consent records"

Pre-Generation Checks

1. Project Context Detection

  • Check Swift version (requires Swift 5.9+)
  • Check deployment target (iOS 16+ / macOS 13+)
  • Check for @Observable support (iOS 17+ / macOS 14+)
  • Identify source file locations

2. Conflict Detection

Search for existing consent or privacy code:

Glob: **/*Consent*.swift, **/*Privacy*.swift, **/*Tracking*.swift, **/*GDPR*.swift
Grep: "ATTrackingManager" or "ConsentManager" or "trackingAuthorizationStatus"

If third-party library found (OneTrust, Usercentrics, CookieBot):

  • Ask if user wants to replace or keep it
  • If keeping, don't generate — advise on integration best practices instead

3. ATT Framework Availability

Check for App Tracking Transparency framework:

Grep: "AppTrackingTransparency" in project files
Grep: "NSUserTrackingUsageDescription" in Info.plist

If NSUserTrackingUsageDescription is missing from Info.plist, warn the user that ATT requires this key and offer to add it.

4. Platform Detection

Determine if generating for iOS (primary ATT target) or macOS (ATT not applicable) or both.

Configuration Questions

Ask user via AskUserQuestion:

  1. Target regulations?

    • GDPR only (EU — opt-in model)
    • CCPA only (California — opt-out model)
    • DPDP only (India — consent-based)
    • All regulations (recommended for global apps)
  2. Consent categories? (multi-select)

    • Essential (always on, cannot be disabled)
    • Analytics (usage tracking, crash reporting)
    • Marketing (advertising, attribution)
    • Personalization (recommendations, content tailoring)
    • Functional (preferences, saved settings beyond essential)
  3. Include ATT integration?

    • Yes — request ATT permission before any tracking (recommended for iOS)
    • No — handle consent without ATT (macOS, or no IDFA usage)
  4. Consent UI style?

    • Bottom banner with manage preferences (recommended)
    • Full-screen consent view (for first launch)
    • Settings-embedded (preferences in app settings, no banner)
    • Banner + Settings (banner on first launch, preferences in settings)

Generation Process

Step 1: Read Templates

Read templates.md for production Swift code. Read patterns.md for compliance rules, regulation differences, and UX guidance.

Step 2: Create Core Files

Generate these files:

  1. ConsentCategory.swift — Enum of consent categories with metadata
  2. ConsentDecision.swift — Per-category consent state with timestamp
  3. ConsentManager.swift — @Observable manager with persistence and ATT integration
  4. ConsentAuditLog.swift — Compliance audit trail with JSON export

Step 3: Create UI Files

  1. ConsentBannerView.swift — Animated slide-up consent banner
  2. ConsentPreferencesView.swift — Detailed toggle list for each category

Step 4: Create Optional Files

Based on configuration:

  • ConsentRegulationConfig.swift — If multiple regulations selected
  • ConsentATTBridge.swift — If ATT integration selected (extracted for testability)

Step 5: Determine File Location

Check project structure:

  • If Sources/ exists → Sources/Consent/
  • If App/ exists → App/Consent/
  • Otherwise → Consent/

Output Format

After generation, provide:

Files Created

Consent/
├── ConsentCategory.swift        # Consent category enum with metadata
├── ConsentDecision.swift         # Per-category decision with timestamp
├── ConsentManager.swift          # @Observable manager with persistence
├── ConsentAuditLog.swift         # Compliance audit trail
├── ConsentBannerView.swift       # Animated consent banner
├── ConsentPreferencesView.swift  # Granular preferences UI
├── ConsentRegulationConfig.swift # Multi-regulation rules (optional)
└── ConsentATTBridge.swift        # ATT integration bridge (optional)

Integration Steps

Show consent on first launch:

swift
@main
struct MyApp: App {
    @State private var consentManager = ConsentManager()

    var body: some Scene {
        WindowGroup {
            ContentView()
                .environment(consentManager)
                .overlay(alignment: .bottom) {
                    if consentManager.needsConsent {
                        ConsentBannerView()
                            .environment(consentManager)
                            .transition(.move(edge: .bottom).combined(with: .opacity))
                    }
                }
                .animation(.easeInOut(duration: 0.3), value: consentManager.needsConsent)
        }
    }
}

Check consent before tracking:

swift
func trackEvent(_ event: AnalyticsEvent) {
    guard consentManager.hasConsent(for: .analytics) else { return }
    analyticsService.track(event)
}

func showPersonalizedAd() {
    guard consentManager.hasConsent(for: .marketing) else {
        showGenericAd()
        return
    }
    adService.showPersonalized()
}

Open preferences from settings:

swift
NavigationLink("Privacy Preferences") {
    ConsentPreferencesView()
        .environment(consentManager)
}

Export audit log for data requests:

swift
func handleDataRequest() async throws -> Data {
    let auditLog = ConsentAuditLog.shared
    return try auditLog.exportJSON()
}

Testing

swift
@Test
func consentGrantedPersistsAcrossLaunches() async {
    let defaults = UserDefaults(suiteName: "test")!
    defaults.removePersistentDomain(forName: "test")
    let manager = ConsentManager(defaults: defaults)

    manager.updateConsent(for: .analytics, granted: true)

    let manager2 = ConsentManager(defaults: defaults)
    #expect(manager2.hasConsent(for: .analytics) == true)
}

@Test
func essentialConsentCannotBeRevoked() {
    let manager = ConsentManager()
    manager.updateConsent(for: .essential, granted: false)
    #expect(manager.hasConsent(for: .essential) == true) // Always granted
}

@Test
func auditLogRecordsDecisions() {
    let log = ConsentAuditLog(directory: tempDirectory)
    log.record(category: .analytics, granted: true, regulation: .gdpr)

    let entries = log.allEntries()
    #expect(entries.count == 1)
    #expect(entries[0].category == .analytics)
    #expect(entries[0].granted == true)
}

@Test
func denyAllRevokesNonEssentialCategories() {
    let manager = ConsentManager()
    manager.grantAll()
    manager.denyAllNonEssential()

    #expect(manager.hasConsent(for: .essential) == true)
    #expect(manager.hasConsent(for: .analytics) == false)
    #expect(manager.hasConsent(for: .marketing) == false)
}

Common Patterns

Show Consent on First Launch

swift
.onAppear {
    if consentManager.needsConsent {
        // Banner auto-shows via overlay
    }
}

Update Preferences Later

swift
Button("Privacy Settings") {
    showPreferences = true
}
.sheet(isPresented: $showPreferences) {
    ConsentPreferencesView()
        .environment(consentManager)
}

Check Consent Before Any Tracking Call

swift
extension ConsentManager {
    func executeIfConsented(
        category: ConsentCategory,
        action: () -> Void
    ) {
        guard hasConsent(for: category) else { return }
        action()
    }
}

Export Audit Log for Data Subject Requests

swift
let jsonData = try consentManager.auditLog.exportJSON()
// Attach to email or upload to compliance endpoint

Gotchas

ATT Must Be Requested Before Any Tracking

Apple rejects apps that access IDFA before calling ATTrackingManager.requestTrackingAuthorization. Always request ATT first, then enable tracking SDKs based on the result.

GDPR Requires Opt-In (Not Opt-Out)

Under GDPR, all non-essential tracking requires explicit opt-in consent. Pre-checked boxes or implied consent are not valid. The default state for all non-essential categories must be .notDetermined, not .granted.

Consent Must Be As Easy to Withdraw As to Grant

GDPR Article 7(3): "It shall be as easy to withdraw as to give consent." If consent is granted with one tap on a banner, it must be revocable with equal ease — not buried 5 screens deep in settings.

Different Regulations Have Different Age Thresholds

  • GDPR: 16 years (member states can lower to 13)
  • CCPA: 16 years for sale of data, 13 for minors
  • DPDP: 18 years (parental consent required below)

If your app serves minors, you need age verification before consent collection.

Don't Block the UI on ATT

ATTrackingManager.requestTrackingAuthorization is async and shows a system dialog. Never call it during app launch or in a way that blocks the main UI. Show your own consent banner first, then request ATT as a secondary step.

Consent State Must Survive App Reinstall (GDPR)

For GDPR compliance, consider syncing consent state to a server. UserDefaults is deleted on app uninstall. If a user reinstalls, you must re-request consent — never assume prior consent.

References

  • templates.md — All production Swift templates for consent flow
  • patterns.md — Regulation comparison, ATT details, UX best practices, anti-patterns
  • Related: generators/permission-priming — Pre-permission UI patterns (ATT priming)
  • Related: generators/analytics-setup — Analytics that respects consent state
  • Related: generators/settings-screen — Embedding consent preferences in settings

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Consent Flow AI skill do?

Generates 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.

Why use Consent Flow on TypingMind?

Because you install it once and use it with any model. Consent Flow is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Consent Flow in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/rshankras/claude-code-apple-skills/tree/main/skills/generators/consent-flow. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Consent Flow?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Consent Flow?

As many as you like. As long as a model supports skills, you can use Consent Flow with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Consent Flow AI skill free?

Yes. It is published on GitHub by rshankras under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇