live-activity-generator
Generate ActivityKit Live Activity infrastructure with Dynamic Island layouts, Lock Screen presentation, and push-to-update support. Use when adding Live Activities to an iOS app.
What this skill does
# Live Activity Generator
Generate a complete ActivityKit Live Activity implementation with Dynamic Island layouts, Lock Screen presentation, activity lifecycle management, and push-to-update support.
## When This Skill Activates
Use this skill when the user:
- Asks to "add Live Activities" or "add a Live Activity"
- Mentions "Dynamic Island" layouts
- Wants real-time status updates on the Lock Screen
- Asks about "ActivityKit" or "ActivityAttributes"
- Mentions "push-to-update" for live activities
- Wants to show ongoing progress (delivery tracking, sports scores, timers, workouts)
## Pre-Generation Checks
### 1. Project Context Detection
- [ ] Check for existing ActivityKit implementations
- [ ] Check for an existing widget extension target
- [ ] Verify deployment target is iOS 16.1+
- [ ] Identify source file locations
### 2. Conflict Detection
Search for existing Live Activity code:
```
Glob: **/*Activity*.swift, **/*LiveActivity*.swift
Grep: "ActivityKit" or "ActivityAttributes" or "ActivityConfiguration"
```
If an existing widget extension is found:
- Ask if the Live Activity should be added to the existing widget bundle
- Check for existing `WidgetBundle` to extend
If Live Activity code already exists:
- Ask user whether to replace or extend
### 3. Required Capabilities
**Live Activities require:**
- iOS 16.1+ deployment target
- `NSSupportsLiveActivities` set to `YES` in Info.plist
- A widget extension target (can share with existing WidgetKit widgets)
- For push updates: `NSSupportsLiveActivitiesFrequentUpdates` (optional, iOS 16.2+)
## Configuration Questions
Ask user via AskUserQuestion:
1. **What is the Live Activity for?** (freeform)
- Examples: delivery tracking, sports score, workout timer, ride-sharing, food order
- This determines the attribute fields and content state
2. **What data should appear on the Lock Screen?** (freeform)
- Static data (set at start, does not change): e.g., restaurant name, order number
- Dynamic data (updated over time): e.g., ETA, driver location, score
3. **Dynamic Island layout needs?**
- Compact (leading + trailing) only
- Expanded (leading, trailing, center, bottom) only
- Both compact and expanded (recommended)
4. **Push-to-update support?**
- Yes -- server can update the activity remotely via APNs
- No -- updates only from the app process
5. **Alert configuration when ending?**
- Yes -- show a final alert on the Lock Screen when the activity ends
- No -- dismiss silently
## Generation Process
### Step 1: Determine File Locations
Check project structure:
- If a widget extension target exists, add files there
- Otherwise, instruct user to create a Widget Extension target first
For the activity manager (lives in the main app target):
- If `Sources/` exists --> `Sources/LiveActivity/`
- If `App/` exists --> `App/LiveActivity/`
- Otherwise --> `LiveActivity/`
For the widget extension views:
- Place inside the existing widget extension directory (e.g., `MyAppWidgets/`)
### Step 2: Create Core Files
Generate these files based on configuration answers:
1. **`{Name}ActivityAttributes.swift`** -- Shared between app and widget extension
- `ActivityAttributes` struct with static properties
- Nested `ContentState` with dynamic properties
2. **`{Name}LiveActivityView.swift`** -- Widget extension file
- `ActivityConfiguration` with Lock Screen, Dynamic Island layouts
3. **`{Name}ActivityManager.swift`** -- Main app target file
- Protocol-based manager for start, update, end, and push token handling
### Step 3: Generate Code from Templates
Use the templates in **templates.md** and customize based on user answers:
- Replace placeholder attribute names with real fields
- Configure Dynamic Island regions based on layout choice
- Include or exclude push-to-update code
- Include or exclude alert configuration
## Info.plist Required
### Main App Target
```xml
<key>NSSupportsLiveActivities</key>
<true/>
<!-- Optional: for frequent push updates (iOS 16.2+) -->
<key>NSSupportsLiveActivitiesFrequentUpdates</key>
<true/>
```
## Output Format
After generation, provide:
### Files Created
```
Sources/LiveActivity/
├── {Name}ActivityAttributes.swift # Shared: attributes + content state
└── {Name}ActivityManager.swift # Main app: lifecycle management
MyAppWidgets/
├── {Name}LiveActivityView.swift # Widget ext: all Live Activity UI
└── (update WidgetBundle if needed)
```
### Integration Steps
**1. Add the widget extension target (if not present):**
- File > New > Target > Widget Extension
- Ensure "Include Live Activity" is checked
**2. Share the attributes file between targets:**
The `{Name}ActivityAttributes.swift` file must be included in both the main app target and the widget extension target. Select the file in Xcode, open the File Inspector, and check both targets under "Target Membership".
**3. Add Info.plist entries in the main app target:**
```xml
<key>NSSupportsLiveActivities</key>
<true/>
```
**4. Register the Live Activity configuration in the widget bundle:**
```swift
@main
struct MyAppWidgets: WidgetBundle {
var body: some Widget {
// Existing widgets...
MyAppLiveActivity()
}
}
```
**5. Start a Live Activity from your app:**
```swift
let attributes = DeliveryActivityAttributes(
orderNumber: "1234",
restaurantName: "Pizza Place"
)
let initialState = DeliveryActivityAttributes.ContentState(
status: .preparing,
estimatedDelivery: Date().addingTimeInterval(30 * 60),
driverName: nil
)
let manager = LiveActivityManager()
try await manager.startActivity(attributes: attributes, state: initialState)
```
**6. Update the activity when state changes:**
```swift
let updatedState = DeliveryActivityAttributes.ContentState(
status: .enRoute,
estimatedDelivery: Date().addingTimeInterval(15 * 60),
driverName: "Alex"
)
await manager.updateActivity(state: updatedState)
```
**7. End the activity when complete:**
```swift
let finalState = DeliveryActivityAttributes.ContentState(
status: .delivered,
estimatedDelivery: Date(),
driverName: "Alex"
)
await manager.endActivity(state: finalState, dismissalPolicy: .default)
```
### Push-to-Update Setup (if enabled)
**1. Observe push tokens:**
The generated `{Name}ActivityManager` automatically observes push token updates. Send the token to your server when it changes.
**2. Server-side APNs request:**
```bash
curl -v \
--header "authorization: bearer $JWT_TOKEN" \
--header "apns-topic: com.yourcompany.yourapp.push-type.liveactivity" \
--header "apns-push-type: liveactivity" \
--http2 \
--data '{"aps":{"timestamp":1234567890,"event":"update","content-state":{"status":"enRoute","estimatedDelivery":1234568000,"driverName":"Alex"}}}' \
https://api.push.apple.com/3/device/$PUSH_TOKEN
```
Note: The `apns-topic` must be your app bundle ID with `.push-type.liveactivity` appended.
**3. Ending via push:**
```json
{
"aps": {
"timestamp": 1234567890,
"event": "end",
"dismissal-date": 1234568000,
"content-state": {
"status": "delivered",
"estimatedDelivery": 1234567890,
"driverName": "Alex"
}
}
}
```
### Testing Instructions
1. **Device required:** Live Activities and Dynamic Island cannot be tested in Simulator (as of Xcode 15). Use a physical device with iOS 16.1+.
2. **Dynamic Island:** Requires iPhone 14 Pro or later (devices with the Dynamic Island hardware).
3. **Push-to-update testing:** Use a tool like `apnspush` or `curl` with an APNs auth key (.p8 file) to send test payloads.
4. **Debug tips:**
- Use `Activity<Attributes>.activities` to list all running activities
- Check Console.app for ActivityKit logs filtered by your app bundle ID
- Activities are limited to a maximum of 5 concurrent per app
## Common Patterns
### Delivery Tracking
Static: order number, restaurant name
Dynamic: status enum, ETA, driver name
### Sports Score
Static: home team, away teRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.