$npx -y skills add rshankras/claude-code-apple-skills --skill app-clipGenerates App Clip targets with invocation URL handling, lightweight experiences, and full app upgrade prompts. Use when user wants NFC/QR/Safari banner invocation, instant app experiences, or App Clip Card setup.
| 1 | # App Clip Generator |
| 2 | |
| 3 | Generate production App Clip infrastructure — a lightweight version of your app invoked from NFC tags, QR codes, Safari banners, or Messages. Includes App Clip target setup, invocation URL handling, experience routing, location confirmation, and full app upgrade flow. |
| 4 | |
| 5 | ## When This Skill Activates |
| 6 | |
| 7 | Use this skill when the user: |
| 8 | - Asks to "add an app clip" or "create an app clip target" |
| 9 | - Mentions "instant app" or "lightweight app experience" |
| 10 | - Wants to set up "App Clip Card" metadata |
| 11 | - Mentions "NFC tag" invocation or "QR code" launching an app |
| 12 | - Asks about "app clip invocation" or "invocation URL handling" |
| 13 | - Wants a "lightweight app experience" for a physical location |
| 14 | |
| 15 | ## Pre-Generation Checks |
| 16 | |
| 17 | ### 1. Project Context Detection |
| 18 | - [ ] Check deployment target (iOS 14+ required for App Clips, iOS 16+ recommended) |
| 19 | - [ ] Check Swift version (requires Swift 5.9+) |
| 20 | - [ ] Check for @Observable support (iOS 17+ / macOS 14+) |
| 21 | - [ ] Identify Xcode project structure (.xcodeproj or .xcworkspace) |
| 22 | |
| 23 | ### 2. Conflict Detection |
| 24 | Search for existing App Clip targets: |
| 25 | ``` |
| 26 | Glob: **/*AppClip*/*.swift, **/*Clip*/*.swift |
| 27 | Grep: "NSUserActivityTypeBrowsingWeb" or "AppClipExperience" or "SKOverlay" |
| 28 | ``` |
| 29 | |
| 30 | If existing App Clip target found: |
| 31 | - Ask if user wants to replace or extend it |
| 32 | - If extending, identify which components are missing |
| 33 | |
| 34 | ### 3. Project Structure |
| 35 | Identify where the main app target lives and where to place the App Clip target alongside it. |
| 36 | |
| 37 | ## Configuration Questions |
| 38 | |
| 39 | Ask user via AskUserQuestion: |
| 40 | |
| 41 | 1. **Invocation method?** |
| 42 | - NFC tag only |
| 43 | - QR code only |
| 44 | - Safari banner (Smart App Banner) |
| 45 | - Messages |
| 46 | - All of the above — recommended |
| 47 | |
| 48 | 2. **Primary experience?** |
| 49 | - Order food (restaurant/cafe) |
| 50 | - Reserve (booking/reservation) |
| 51 | - Check in (event/location) |
| 52 | - Preview content (article/product) |
| 53 | |
| 54 | 3. **Include location confirmation?** |
| 55 | - Yes — verifies user is physically at the expected location (recommended for physical-world invocations) |
| 56 | - No — skip location verification |
| 57 | |
| 58 | 4. **Include full app upgrade prompt?** |
| 59 | - Yes — show SKOverlay banner to download full app (recommended) |
| 60 | - No — App Clip only, no upgrade path |
| 61 | |
| 62 | ## Generation Process |
| 63 | |
| 64 | ### Step 1: Read Templates |
| 65 | Read `templates.md` for production Swift code. |
| 66 | Read `patterns.md` for constraints, testing, and best practices. |
| 67 | |
| 68 | ### Step 2: Create Core Files |
| 69 | Generate these files: |
| 70 | 1. `AppClipApp.swift` — @main App struct handling invocation via `.onContinueUserActivity` |
| 71 | 2. `InvocationHandler.swift` — Parses invocation URL, extracts parameters, validates against registered experiences |
| 72 | 3. `AppClipExperience.swift` — Protocol and concrete experience implementations |
| 73 | |
| 74 | ### Step 3: Create Location Files (if selected) |
| 75 | 4. `LocationConfirmationView.swift` — CLLocationManager-based location verification for physical invocations |
| 76 | |
| 77 | ### Step 4: Create Upgrade Files (if selected) |
| 78 | 5. `FullAppUpgradeView.swift` — SKOverlay-based banner prompting full app download |
| 79 | 6. `SharedDataManager.swift` — App Group data sharing between App Clip and full app |
| 80 | |
| 81 | ### Step 5: Determine File Location |
| 82 | Check project structure: |
| 83 | - If `Sources/` exists -> `Sources/AppClip/` |
| 84 | - If main app target folder exists -> `AppClip/` at the same level |
| 85 | - Otherwise -> `AppClip/` |
| 86 | |
| 87 | ## Output Format |
| 88 | |
| 89 | After generation, provide: |
| 90 | |
| 91 | ### Files Created |
| 92 | ``` |
| 93 | AppClip/ |
| 94 | ├── AppClipApp.swift # @main entry point with invocation handling |
| 95 | ├── InvocationHandler.swift # URL parsing and parameter extraction |
| 96 | ├── AppClipExperience.swift # Experience protocol and implementations |
| 97 | ├── LocationConfirmationView.swift # Location verification (optional) |
| 98 | ├── FullAppUpgradeView.swift # SKOverlay upgrade prompt (optional) |
| 99 | └── SharedDataManager.swift # App Group data sharing (optional) |
| 100 | ``` |
| 101 | |
| 102 | ### Xcode Target Setup Instructions |
| 103 | |
| 104 | 1. **Add App Clip Target:** |
| 105 | - File > New > Target > App Clip |
| 106 | - Set bundle ID to `{main-app-bundle-id}.Clip` |
| 107 | - Set deployment target to iOS 16.0 |
| 108 | |
| 109 | 2. **Configure Associated Domains:** |
| 110 | - Add `appclips:{your-domain.com}` to both main app and App Clip entitlements |
| 111 | |
| 112 | 3. **Set Up App Group:** |
| 113 | - Add `group.{your-bundle-id}` to both targets for shared data |
| 114 | |
| 115 | 4. **Apple-App-Site-Association (AASA) file:** |
| 116 | - Host at `https://{your-domain.com}/.well-known/apple-app-site-association` |
| 117 | |
| 118 | ### Integration |
| 119 | |
| 120 | **Handle invocation in the App Clip:** |
| 121 | ```swift |
| 122 | @main |
| 123 | struct MyAppClip: App { |
| 124 | @State private var handler = InvocationHandler() |
| 125 | |
| 126 | var body: some Scene { |
| 127 | WindowGroup { |
| 128 | ContentView(experience: handler.currentExperience) |
| 129 | .onContinueUserA |