Account Deletion logo

Account Deletion

Community
rshankras
account-deletion

Generates an Apple-compliant account deletion flow with multi-step confirmation UI, optional data export, configurable grace period, Keychain cleanup, and server-side deletion request. Use when user needs account deletion, right-to-delete, or Apple App Review compliance for account removal.

Overview

Publisherrshankras
Repositoryclaude-code-apple-skills
Skill nameaccount-deletion
Stars
744
Forks
70
Bundled files
1
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.

  • 1 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 Account Deletion 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/account-deletion .claude/skills/account-deletion
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Account Deletion 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 Account Deletion 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 Account Deletion 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.

Account Deletion Generator

Generate a production account deletion flow compliant with Apple's App Store requirement (effective June 30, 2022) that any app offering account creation must also offer account deletion from within the app. Includes multi-step confirmation UI, optional data export, configurable grace period, Keychain cleanup, and Sign in with Apple token revocation.

When This Skill Activates

Use this skill when the user:

  • Asks to "add account deletion" or "delete account"
  • Wants to "remove account" or implement "account removal"
  • Mentions "right to delete" or "user data deletion"
  • Asks about "Apple account deletion requirement"
  • Needs App Store compliance for account management
  • Wants to implement GDPR/privacy right-to-erasure

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. Existing Auth/Account Code

Search for existing account management:

Glob: **/*Auth*.swift, **/*Account*.swift, **/*User*.swift, **/*Profile*.swift
Grep: "ASAuthorizationAppleIDProvider" or "SignInWithApple" or "Keychain" or "deleteAccount"

If existing deletion flow found:

  • Ask if user wants to replace or enhance it
  • If enhancing, integrate with existing auth architecture

3. Keychain Usage Detection

Grep: "SecItemAdd" or "SecItemDelete" or "SecItemCopyMatching" or "KeychainWrapper" or "keychain"

If Keychain usage found, ensure cleanup covers all stored items.

4. CloudKit / Server Sync Detection

Grep: "CKContainer" or "CloudKit" or "CKRecord" or "NSPersistentCloudKitContainer"
Glob: **/*CloudKit*.swift, **/*Sync*.swift

If CloudKit or server sync found, include remote data cleanup steps.

Configuration Questions

Ask user via AskUserQuestion:

  1. Deletion type?

    • Immediate — account deleted right away after confirmation
    • Grace period — account scheduled for deletion, user can cancel
  2. Grace period duration? (if grace period selected)

    • 7 days
    • 14 days — recommended
    • 30 days
  3. Include data export before deletion?

    • Yes — generate DataExportService with JSON/ZIP archive and ShareLink
    • No — skip data export
  4. Server-side API call needed?

    • Yes — generate server deletion request with configurable endpoint
    • No — local-only deletion (Keychain, UserDefaults, SwiftData/CoreData, files)

Generation Process

Step 1: Read Templates

Read templates.md for production Swift code.

Step 2: Create Core Files

Generate these files:

  1. AccountDeletionManager.swift — @Observable orchestrator for the full deletion lifecycle
  2. DeletionConfirmationView.swift — Multi-step confirmation UI with NavigationStack
  3. KeychainCleanup.swift — Utility to remove all app Keychain items

Step 3: Create Optional Files

Based on configuration:

  • DataExportService.swift — If data export selected
  • DeletionGracePeriodView.swift — If grace period selected
  • SignInWithAppleRevocation.swift — If SIWA detected in project

Step 4: Determine File Location

Check project structure:

  • If Sources/ exists -> Sources/AccountDeletion/
  • If App/ exists -> App/AccountDeletion/
  • Otherwise -> AccountDeletion/

Output Format

After generation, provide:

Files Created

AccountDeletion/
├── AccountDeletionManager.swift      # Orchestrator for deletion lifecycle
├── DeletionConfirmationView.swift    # Multi-step confirmation UI
├── KeychainCleanup.swift             # Keychain item cleanup
├── DataExportService.swift           # Data export before deletion (optional)
├── DeletionGracePeriodView.swift     # Grace period countdown UI (optional)
└── SignInWithAppleRevocation.swift    # SIWA token revocation (optional)

Integration Steps

Add to Settings or Account screen:

swift
// In your Settings or Account view
struct AccountSettingsView: View {
    @State private var showDeletionFlow = false

    var body: some View {
        Form {
            // ... other settings ...

            Section {
                Button(role: .destructive) {
                    showDeletionFlow = true
                } label: {
                    Label("Delete Account", systemImage: "person.crop.circle.badge.minus")
                }
            } footer: {
                Text("Permanently removes your account and all associated data.")
            }
        }
        .sheet(isPresented: $showDeletionFlow) {
            DeletionConfirmationView()
        }
    }
}

With grace period (check on app launch):

swift
@main
struct MyApp: App {
    @State private var deletionManager = AccountDeletionManager()

    var body: some Scene {
        WindowGroup {
            ContentView()
                .environment(deletionManager)
                .task {
                    await deletionManager.checkPendingDeletion()
                }
        }
    }
}

With data export:

swift
// User can export before deleting
DeletionConfirmationView()
    .environment(DataExportService())

Testing

swift
@Test
func deletionFlowCompletesSuccessfully() async throws {
    let manager = AccountDeletionManager(
        serverClient: MockDeletionClient(),
        keychainCleanup: MockKeychainCleanup()
    )

    try await manager.confirmWithReauthentication()
    try await manager.executeDeletion()

    #expect(manager.deletionState == .completed)
}

@Test
func gracePeriodCancellation() async throws {
    let manager = AccountDeletionManager()

    try await manager.scheduleDeletion(gracePeriodDays: 14)
    #expect(manager.scheduledDeletionDate != nil)

    try await manager.cancelScheduledDeletion()
    #expect(manager.deletionState == .none)
    #expect(manager.scheduledDeletionDate == nil)
}

@Test
func keychainItemsRemovedOnDeletion() async throws {
    let cleanup = KeychainCleanup()
    // Store a test item
    let query: [String: Any] = [
        kSecClass as String: kSecClassGenericPassword,
        kSecAttrAccount as String: "test-account",
        kSecValueData as String: Data("secret".utf8)
    ]
    SecItemAdd(query as CFDictionary, nil)

    // Delete all items
    try cleanup.removeAllItems()

    // Verify removal
    let searchQuery: [String: Any] = [
        kSecClass as String: kSecClassGenericPassword,
        kSecAttrAccount as String: "test-account",
        kSecReturnData as String: true
    ]
    let status = SecItemCopyMatching(searchQuery as CFDictionary, nil)
    #expect(status == errSecItemNotFound)
}

@Test
func dataExportGeneratesArchive() async throws {
    let exportService = DataExportService()
    let archiveURL = try await exportService.exportAllUserData()

    #expect(FileManager.default.fileExists(atPath: archiveURL.path))

    // Cleanup
    try FileManager.default.removeItem(at: archiveURL)
}

Common Patterns

Initiate Deletion from Settings

Account deletion must be accessible from within the app — typically in Settings > Account. Apple will reject apps that only offer deletion via website or email.

Confirm with Password or Biometric

Re-authenticate the user before deletion to prevent accidental or unauthorized account removal. Use LocalAuthentication for biometric or prompt for password.

Export Data Before Deletion

Offer users the ability to download their data before the account is removed. This is a privacy best practice and builds user trust.

Schedule Deletion with Grace Period

Instead of immediate deletion, schedule it for 7-30 days out. Allow users to cancel during this window. Many users delete accounts impulsively and appreciate the recovery option.

Gotchas

  • Apple requires in-app deletion — App Review will reject apps where account deletion is only available via website, email, or contacting support. The option must be accessible from within the app itself.
  • Keychain items persist after app uninstall — You must explicitly call SecItemDelete for all item classes (generic password, internet password, certificate, key, identity) during account deletion.
  • Sign in with Apple token revocation — If your app supports Sign in with Apple, you must revoke the user's token via Apple's REST API (https://appleid.apple.com/auth/revoke). Failure to do so means Apple still considers the account linked.
  • CloudKit data cleanup — CloudKit private database records are tied to the user's iCloud account, not your app. You cannot delete them on behalf of the user. Document this limitation and delete any shared/public records your app created.
  • Subscription cancellation guidance — Account deletion does not automatically cancel active subscriptions. Display a warning and link to Settings > Subscriptions so users can cancel before deletion.
  • UserDefaults and app group data — Remember to clean UserDefaults.standard and any shared app group containers (UserDefaults(suiteName:)).
  • SwiftData / CoreData cleanup — Delete all model containers and persistent stores, not just individual records.

References

  • templates.md — All production Swift templates
  • Related: generators/auth-flow — Authentication flow generation
  • Related: generators/persistence-setup — Data persistence that needs cleanup
  • Related: generators/settings-screen — Settings screen where deletion is placed
  • Related: generators/cloudkit-sync — CloudKit data that needs cleanup consideration

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 Account Deletion AI skill do?

Generates an Apple-compliant account deletion flow with multi-step confirmation UI, optional data export, configurable grace period, Keychain cleanup, and server-side deletion request. Use when user needs account deletion, right-to-delete, or Apple App Review compliance for account removal.

Why use Account Deletion on TypingMind?

Because you install it once and use it with any model. Account Deletion 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 Account Deletion in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/rshankras/claude-code-apple-skills/tree/main/skills/generators/account-deletion. 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 Account Deletion?

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 Account Deletion?

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

Is the Account Deletion 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 👇