skills/generators/account-deletion/SKILL.md
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.
npx skillsauth add rshankras/claude-code-apple-skills account-deletionInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
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.
Use this skill when the user:
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:
Grep: "SecItemAdd" or "SecItemDelete" or "SecItemCopyMatching" or "KeychainWrapper" or "keychain"
If Keychain usage found, ensure cleanup covers all stored items.
Grep: "CKContainer" or "CloudKit" or "CKRecord" or "NSPersistentCloudKitContainer"
Glob: **/*CloudKit*.swift, **/*Sync*.swift
If CloudKit or server sync found, include remote data cleanup steps.
Ask user via AskUserQuestion:
Deletion type?
Grace period duration? (if grace period selected)
Include data export before deletion?
Server-side API call needed?
Read templates.md for production Swift code.
Generate these files:
AccountDeletionManager.swift — @Observable orchestrator for the full deletion lifecycleDeletionConfirmationView.swift — Multi-step confirmation UI with NavigationStackKeychainCleanup.swift — Utility to remove all app Keychain itemsBased on configuration:
DataExportService.swift — If data export selectedDeletionGracePeriodView.swift — If grace period selectedSignInWithAppleRevocation.swift — If SIWA detected in projectCheck project structure:
Sources/ exists -> Sources/AccountDeletion/App/ exists -> App/AccountDeletion/AccountDeletion/After generation, provide:
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)
Add to Settings or Account screen:
// 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):
@main
struct MyApp: App {
@State private var deletionManager = AccountDeletionManager()
var body: some Scene {
WindowGroup {
ContentView()
.environment(deletionManager)
.task {
await deletionManager.checkPendingDeletion()
}
}
}
}
With data export:
// User can export before deleting
DeletionConfirmationView()
.environment(DataExportService())
@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)
}
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.
Re-authenticate the user before deletion to prevent accidental or unauthorized account removal. Use LocalAuthentication for biometric or prompt for password.
Offer users the ability to download their data before the account is removed. This is a privacy best practice and builds user trust.
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.
SecItemDelete for all item classes (generic password, internet password, certificate, key, identity) during account deletion.https://appleid.apple.com/auth/revoke). Failure to do so means Apple still considers the account linked.UserDefaults.standard and any shared app group containers (UserDefaults(suiteName:)).generators/auth-flow — Authentication flow generationgenerators/persistence-setup — Data persistence that needs cleanupgenerators/settings-screen — Settings screen where deletion is placedgenerators/cloudkit-sync — CloudKit data that needs cleanup considerationdevelopment
Build, install, and launch an iOS app on a physical iPhone or iPad entirely from the command line (no Xcode GUI), using xcodebuild + devicectl. Use when the user wants to run, test, or screenshot their app on a real device without opening Xcode.
development
Comprehensive iOS development guidance including Swift best practices, SwiftUI patterns, UI/UX review against HIG, and app planning. Use for iOS code review, best practices, accessibility audits, or planning new iOS apps.
development
Build, install, launch, and screenshot an iOS app in the Simulator to verify a change visually. Use when the user wants to run the app, see a change live, screenshot the running app, or confirm a UI fix actually works (not just that it compiles).
development
Audits skills in this repo for consistency, API drift, and structural gaps. Produces a prioritized report grouped by severity (Critical/High/Medium/Low). Use when asked to "audit skills", "check the skill repo for drift", or when planning bulk skill cleanup. Read-only — does not apply fixes.