variable-rewards
Generates a variable reward system with randomized rewards, daily bonuses, mystery box mechanics, and ethical engagement caps. Use when user wants daily spins, mystery boxes, random rewards, or gamification reward systems.
What this skill does
# Variable Rewards Generator
Generate a variable reward system — randomized rewards (daily spins, mystery boxes, bonus points) that leverage variable-ratio reinforcement to increase engagement. Implements ethical engagement patterns with daily/weekly caps, transparent probability disclosure, and no pay-to-play mechanics.
## When This Skill Activates
Use this skill when the user:
- Asks to "add daily rewards" or "daily spin" mechanic
- Wants a "reward system" or "random rewards"
- Mentions "mystery box" or "loot box" (non-paid)
- Asks about "bonus system" or "daily bonus"
- Wants "gamification rewards" or "engagement rewards"
- Mentions "reward wheel" or "spin to win"
- Asks about "variable rewards" or "intermittent reinforcement"
## Pre-Generation Checks
### 1. Project Context Detection
- [ ] Check Swift version (requires Swift 5.9+)
- [ ] Check deployment target (iOS 17+ / macOS 14+ for @Observable and SwiftData)
- [ ] Check for SwiftData availability and existing model container setup
- [ ] Identify source file locations
### 2. Conflict Detection
Search for existing reward or points systems:
```
Glob: **/*Reward*.swift, **/*Points*.swift, **/*DailySpin*.swift, **/*MysteryBox*.swift
Grep: "reward" or "dailySpin" or "mysteryBox" or "rewardPool" or "lootBox"
```
If existing reward system found:
- Ask if user wants to replace or extend it
- If extending, generate only the missing components
### 3. Platform Detection
Determine if generating for iOS or macOS or both (cross-platform). The templates use SwiftUI and are cross-platform by default.
## Configuration Questions
Ask user via AskUserQuestion:
1. **Reward types?** (multi-select)
- Points (numeric currency the user accumulates)
- Items (unlockable content: themes, stickers, avatars)
- Features (time-limited feature unlocks)
- Badges (collectible achievement badges)
- Mixed (all of the above) -- recommended
2. **Reward mechanism?**
- Daily spin (wheel animation, one spin per day)
- Mystery box (card-flip or chest-open, one per day)
- Random bonus (surprise toast notification on qualifying action)
- Multiple (daily spin + random bonus) -- recommended
3. **Include daily/weekly caps and cooldowns?**
- Yes — enforce max rewards per day and per week with cooldown timers (recommended, ethical design)
- No — unlimited claims (not recommended)
4. **Visual presentation?**
- Wheel spin (rotating wheel with segments)
- Card flip (card turns over to reveal reward)
- Chest open (chest lid opens with glow effect)
- All of the above -- recommended
## Generation Process
### Step 1: Read Templates
Read `templates.md` for production Swift code.
### Step 2: Create Core Files
Generate these files:
1. `Reward.swift` — Model for reward type, value, rarity, display metadata
2. `RewardPool.swift` — Weighted probability distribution with seeded random for testability
3. `RewardManager.swift` — @Observable class managing claims, daily resets, caps, history via SwiftData
### Step 3: Create UI Files
4. `DailySpinView.swift` — Animated spin wheel with disabled state when already claimed
5. `MysteryBoxView.swift` — Card-flip / chest-open animation with matchedGeometryEffect
6. `RewardHistoryView.swift` — List of past rewards grouped by day
7. `RewardNotificationView.swift` — Toast/banner overlay for reward availability
### Step 4: Determine File Location
Check project structure:
- If `Sources/` exists -> `Sources/VariableRewards/`
- If `App/` exists -> `App/VariableRewards/`
- Otherwise -> `VariableRewards/`
## Output Format
After generation, provide:
### Files Created
```
VariableRewards/
├── Reward.swift # Reward model with type, rarity, value
├── RewardPool.swift # Weighted random selection engine
├── RewardManager.swift # Core manager: claims, caps, history
├── DailySpinView.swift # Animated spin wheel
├── MysteryBoxView.swift # Card-flip / chest-open reveal
├── RewardHistoryView.swift # Past rewards grouped by day
└── RewardNotificationView.swift # Toast overlay for available rewards
```
### Integration Steps
**Set up the model container (SwiftData):**
```swift
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
.modelContainer(for: [RewardClaim.self])
}
}
```
**Add the daily spin to your home screen:**
```swift
struct HomeView: View {
@Environment(\.modelContext) private var modelContext
@State private var rewardManager: RewardManager?
var body: some View {
VStack {
if let manager = rewardManager {
DailySpinView(manager: manager)
}
}
.onAppear {
rewardManager = RewardManager(modelContext: modelContext)
}
}
}
```
**Trigger a mystery box reveal:**
```swift
struct MilestoneView: View {
@Environment(\.modelContext) private var modelContext
@State private var rewardManager: RewardManager?
@State private var showMysteryBox = false
var body: some View {
VStack {
Button("Open Mystery Box") {
showMysteryBox = true
}
.disabled(rewardManager?.canClaimToday == false)
}
.sheet(isPresented: $showMysteryBox) {
if let manager = rewardManager {
MysteryBoxView(manager: manager)
}
}
.onAppear {
rewardManager = RewardManager(modelContext: modelContext)
}
}
}
```
**Show a reward notification toast:**
```swift
struct ContentView: View {
@Environment(\.modelContext) private var modelContext
@State private var rewardManager: RewardManager?
var body: some View {
ZStack {
MainTabView()
if let manager = rewardManager {
RewardNotificationView(manager: manager)
}
}
.onAppear {
rewardManager = RewardManager(modelContext: modelContext)
}
}
}
```
**View reward history:**
```swift
struct ProfileView: View {
@Environment(\.modelContext) private var modelContext
@State private var rewardManager: RewardManager?
var body: some View {
NavigationStack {
if let manager = rewardManager {
RewardHistoryView(manager: manager)
}
}
.onAppear {
rewardManager = RewardManager(modelContext: modelContext)
}
}
}
```
### Testing
```swift
import Testing
import SwiftData
@Test
func dailySpinGrantsReward() async throws {
let container = try ModelContainer(
for: RewardClaim.self,
configurations: ModelConfiguration(isStoredInMemoryOnly: true)
)
let context = ModelContext(container)
let pool = RewardPool(seed: 42) // Deterministic for testing
let manager = RewardManager(modelContext: context, rewardPool: pool)
let reward = try await manager.claimDailySpin()
#expect(reward != nil)
#expect(manager.canClaimToday == false) // Already claimed
}
@Test
func dailyCapEnforced() async throws {
let container = try ModelContainer(
for: RewardClaim.self,
configurations: ModelConfiguration(isStoredInMemoryOnly: true)
)
let context = ModelContext(container)
let pool = RewardPool(seed: 42)
let manager = RewardManager(modelContext: context, rewardPool: pool, dailyCap: 1)
_ = try await manager.claimDailySpin()
let second = try await manager.claimDailySpin()
#expect(second == nil) // Cap reached
}
@Test
func deterministicSeedProducesSameReward() {
let pool1 = RewardPool(seed: 123)
let pool2 = RewardPool(seed: 123)
let reward1 = pool1.drawReward()
let reward2 = pool2.drawReward()
#expect(reward1.type == reward2.type)
#expect(reward1.rarity == reward2.rarity)
}
@Test
func weeklyCapResetsAfterWeek() async throws {
let container = try ModelContainer(
for: RewardClaim.self,
Related 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.