$npx -y skills add rshankras/claude-code-apple-skills --skill force-updateGenerates a minimum version enforcement system with hard-block and soft-prompt update flows, App Store redirect, and remote config or App Store lookup for version checks. Use when user wants force update, mandatory update, or minimum version check.
| 1 | # Force Update Generator |
| 2 | |
| 3 | Generate a minimum version check system that blocks app usage when a critical update is required, or shows a dismissible prompt for recommended updates. Checks the current app version against a remote configuration endpoint or the App Store lookup API and presents the appropriate UI. |
| 4 | |
| 5 | ## When This Skill Activates |
| 6 | |
| 7 | Use this skill when the user: |
| 8 | - Asks to "add force update" or "force update screen" |
| 9 | - Wants "minimum version check" or "minimum version enforcement" |
| 10 | - Mentions "required update" or "mandatory update" |
| 11 | - Asks about "version check" or "app version check" |
| 12 | - Wants an "app update prompt" or "update dialog" |
| 13 | - Mentions "block old versions" or "deprecate old versions" |
| 14 | |
| 15 | ## Pre-Generation Checks |
| 16 | |
| 17 | ### 1. Project Context Detection |
| 18 | - [ ] Check Swift version (requires Swift 5.9+) |
| 19 | - [ ] Check deployment target (iOS 16+ / macOS 13+) |
| 20 | - [ ] Check for @Observable support (iOS 17+ / macOS 14+) |
| 21 | - [ ] Identify source file locations |
| 22 | |
| 23 | ### 2. Conflict Detection |
| 24 | Search for existing version check code: |
| 25 | ``` |
| 26 | Glob: **/*ForceUpdate*.swift, **/*VersionCheck*.swift, **/*UpdateManager*.swift, **/*AppVersion*.swift |
| 27 | Grep: "ForceUpdate" or "minimumVersion" or "mandatoryUpdate" or "CFBundleShortVersionString" |
| 28 | ``` |
| 29 | |
| 30 | If an existing update mechanism is found: |
| 31 | - Ask if user wants to replace or extend it |
| 32 | - If extending, integrate with the existing check flow |
| 33 | |
| 34 | ### 3. Network Layer Detection |
| 35 | Search for existing networking code: |
| 36 | ``` |
| 37 | Glob: **/*API*.swift, **/*Client*.swift, **/*Network*.swift |
| 38 | Grep: "APIClient" or "URLSession" or "NetworkService" |
| 39 | ``` |
| 40 | |
| 41 | If a networking layer exists, generate the version checker to use it rather than raw URLSession. |
| 42 | |
| 43 | ## Configuration Questions |
| 44 | |
| 45 | Ask user via AskUserQuestion: |
| 46 | |
| 47 | 1. **Update check source?** |
| 48 | - Remote JSON endpoint (your own server hosts a JSON config) — recommended |
| 49 | - App Store lookup API (uses iTunes Search API, no server needed) |
| 50 | - Firebase Remote Config (requires Firebase SDK) |
| 51 | |
| 52 | 2. **Update types to support?** |
| 53 | - Hard block only (always force update) |
| 54 | - Soft prompt only (always dismissible) |
| 55 | - Both hard block and soft prompt — recommended |
| 56 | |
| 57 | 3. **Check frequency?** |
| 58 | - Every app launch |
| 59 | - Once per day — recommended |
| 60 | - Once per week |
| 61 | |
| 62 | 4. **Include skip option for soft updates?** |
| 63 | - Yes — user can skip a specific version and won't be prompted again until a newer version is available |
| 64 | - No — prompt shows every time (respecting check frequency) |
| 65 | |
| 66 | ## Generation Process |
| 67 | |
| 68 | ### Step 1: Read Templates |
| 69 | Read `templates.md` for production Swift code. |
| 70 | |
| 71 | ### Step 2: Create Core Files |
| 72 | Generate these files: |
| 73 | 1. `AppVersion.swift` — Semantic version model (major.minor.patch) with Comparable |
| 74 | 2. `UpdateRequirement.swift` — Enum: none, softUpdate, hardUpdate with message and store URL |
| 75 | 3. `VersionChecker.swift` — Protocol + implementation based on chosen source |
| 76 | |
| 77 | ### Step 3: Create Manager |
| 78 | 4. `UpdateManager.swift` — @Observable manager that coordinates checks, caches timing, exposes state |
| 79 | |
| 80 | ### Step 4: Create UI Files |
| 81 | 5. `ForceUpdateView.swift` — Full-screen blocking view with App Store button |
| 82 | 6. `SoftUpdateBannerView.swift` — Dismissible banner with Update and Later buttons |
| 83 | |
| 84 | ### Step 5: Create Integration |
| 85 | 7. `UpdateCheckModifier.swift` — ViewModifier that auto-checks on appear and presents UI |
| 86 | |
| 87 | ### Step 6: Determine File Location |
| 88 | Check project structure: |
| 89 | - If `Sources/` exists → `Sources/ForceUpdate/` |
| 90 | - If `App/` exists → `App/ForceUpdate/` |
| 91 | - Otherwise → `ForceUpdate/` |
| 92 | |
| 93 | ## Output Format |
| 94 | |
| 95 | After generation, provide: |
| 96 | |
| 97 | ### Files Created |
| 98 | ``` |
| 99 | ForceUpdate/ |
| 100 | ├── AppVersion.swift # Semantic version model with Comparable |
| 101 | ├── UpdateRequirement.swift # none / softUpdate / hardUpdate enum |
| 102 | ├── VersionChecker.swift # Protocol + remote/App Store implementation |
| 103 | ├── UpdateManager.swift # @Observable coordinator |
| 104 | ├── ForceUpdateView.swift # Full-screen blocking UI |
| 105 | ├── SoftUpdateBannerView.swift # Dismissible banner UI |
| 106 | └── UpdateCheckModifier.swift # ViewModifier for auto-check |
| 107 | ``` |
| 108 | |
| 109 | ### Integration Steps |
| 110 | |
| 111 | **Add the modifier to your root view:** |
| 112 | ```swift |
| 113 | @main |
| 114 | struct MyApp: App { |
| 115 | var body: some Scene { |
| 116 | WindowGroup { |
| 117 | ContentView() |
| 118 | .checkForUpdates() |
| 119 | } |
| 120 | } |
| 121 | } |
| 122 | ``` |
| 123 | |
| 124 | **Custom configuration:** |
| 125 | ```swift |
| 126 | ContentView() |
| 127 | .checkForUpdates( |
| 128 | checker: RemoteJSONVersionChecker( |
| 129 | url: URL(string: "https://api.example.com/app-config")! |
| 130 | ), |
| 131 | frequency: .daily |
| 132 | ) |
| 133 | ``` |
| 134 | |
| 135 | **Manual check from a settings screen:** |
| 136 | ```swift |
| 137 | struct SettingsView: View { |
| 138 | @Environment(UpdateManager.self |