Agent skill
subscription-offers
Generates StoreKit 2 code for all subscription offer types — introductory, promotional, offer codes, and win-back. Includes eligibility checks, offer presentation, and the preferredSubscriptionOffer modifier. Use when adding subscription offers, free trials, or promotional pricing.
Install this agent skill to your Project
npx add-skill https://github.com/rshankras/claude-code-apple-skills/tree/main/skills/generators/subscription-offers
SKILL.md
Subscription Offers Generator
Generate complete StoreKit 2 implementation for all four subscription offer types with eligibility verification, offer presentation, and transaction handling.
When This Skill Activates
Use this skill when the user:
- Asks to "add subscription offers" or "set up free trial"
- Mentions "introductory offer", "promotional offer", or "offer codes"
- Wants "StoreKit 2 offers" implementation
- Asks about "subscription pricing" or "discounted subscription"
- Mentions "preferredSubscriptionOffer" or "eligibility check"
Pre-Generation Checks
1. Project Context Detection
- Check for existing StoreKit implementations (
import StoreKit) - Check deployment target (iOS 16.4+ for
SubscriptionStoreViewoffers, iOS 15+ for manual) - Look for existing product/subscription group IDs
- Identify if
paywall-generatorwas already used
2. Conflict Detection
Glob: **/*Offer*.swift, **/*Eligibility*.swift
Grep: "introductoryOffer" or "promotionalOffers" or "winBackOffers"
If existing offer code found, ask:
- Extend with additional offer types?
- Replace existing implementation?
Offer Types Reference
1. Introductory Offers
- Who: New subscribers who haven't previously subscribed
- Types: Free trial, pay-as-you-go, pay-up-front
- Limit: One per subscription group per Apple ID
- StoreKit 2:
product.subscription?.introductoryOffer
2. Promotional Offers
- Who: Current or lapsed subscribers (you control eligibility)
- Types: Free, pay-as-you-go, pay-up-front
- Limit: Up to 10 per subscription group
- Requires: Server-side signature generation
- StoreKit 2:
product.subscription?.promotionalOffers
3. Offer Codes
- Who: Anyone with a valid code (you distribute)
- Types: Free or discounted period
- Limit: Configurable per campaign in App Store Connect
- StoreKit 2:
try await AppStore.presentOfferCodeRedeemSheet()
4. Win-Back Offers
- Who: Previously subscribed users who churned
- Types: Free or discounted period
- Eligibility: Automatic via App Store (iOS 18+)
- StoreKit 2:
product.subscription?.winBackOffers
Configuration Questions
Ask user via AskUserQuestion:
-
Which offer types? (multi-select)
- Introductory offer (free trial / discounted first period)
- Promotional offers (targeted discounts for eligible users)
- Offer codes (redeemable codes you distribute)
- Win-back offers (re-engage churned subscribers)
-
Introductory offer details (if selected)
- Free trial: 3 days / 7 days / 14 days / 30 days
- Pay-as-you-go: discounted rate for X periods
- Pay-up-front: discounted rate for full period
-
Deployment target
- iOS 15+ (manual offer UI)
- iOS 16.4+ (SubscriptionStoreView with offers)
- iOS 18+ (win-back offer support)
-
Server-side signature (if promotional offers selected)
- Will you generate signatures server-side?
- Use App Store Server Library?
Generation Process
Step 1: Read Templates
Read templates.md for all offer implementation code.
Step 2: Create Core Files
-
SubscriptionOfferManager.swift — Central offer management
- Offer eligibility checking for all types
- Offer presentation logic
- Transaction handling for offer purchases
-
OfferEligibility.swift — Eligibility verification
- Introductory offer eligibility (
isEligibleForIntroOffer) - Promotional offer eligibility (your business logic)
- Win-back offer eligibility (iOS 18+)
- Introductory offer eligibility (
-
OfferConfiguration.swift — Offer type definitions and configuration
Step 3: Create UI Files (conditional)
-
OfferBannerView.swift — Contextual offer banners
- Shows appropriate offer based on user state
- Introductory offer for new users
- Promotional offer for at-risk subscribers
- Win-back offer for churned subscribers
-
OfferCodeRedemptionView.swift — Offer code entry UI (if offer codes selected)
Step 4: Create Optional Files
- OfferSignatureProvider.swift — Server-side signature handling (if promotional offers)
- OfferAnalytics.swift — Track offer impression, tap, and conversion events
Step 5: Determine File Location
- If Sources/Store/ exists → Sources/Store/Offers/
- If Store/ exists → Store/Offers/
- If Subscriptions/ exists → Subscriptions/Offers/
- Otherwise → Offers/
Output Format
Files Created
Store/Offers/
├── SubscriptionOfferManager.swift # Central offer management
├── OfferEligibility.swift # Eligibility verification
├── OfferConfiguration.swift # Offer type definitions
├── OfferBannerView.swift # Contextual offer UI
├── OfferCodeRedemptionView.swift # Code entry (optional)
├── OfferSignatureProvider.swift # Server signatures (optional)
└── OfferAnalytics.swift # Offer tracking (optional)
Integration Steps
Check Introductory Offer Eligibility:
let manager = SubscriptionOfferManager()
let isEligible = await manager.isEligibleForIntroOffer(
productID: "com.app.subscription.monthly"
)
Present Best Available Offer:
// Automatically selects the best offer for the user's state
let offer = await manager.bestAvailableOffer(
for: "com.app.subscription.monthly"
)
// Use with SubscriptionStoreView (iOS 16.4+)
SubscriptionStoreView(groupID: groupID)
.preferredSubscriptionOffer(offer)
Present Offer Code Sheet:
// iOS 16+
try await AppStore.presentOfferCodeRedeemSheet()
Win-Back Offer (iOS 18+):
let winBackOffers = await manager.availableWinBackOffers(
for: "com.app.subscription.monthly"
)
if let bestOffer = winBackOffers.first {
// Present win-back UI
}
Testing Instructions
- StoreKit Configuration file: Add offer configurations
- Test each offer type in Sandbox environment
- Verify eligibility logic: Test with new, current, and lapsed accounts
- Test edge cases: Expired trials, multiple subscription groups, family sharing
App Store Connect Setup
- Go to App Store Connect > Subscriptions > Your Group
- Introductory Offer: Set in subscription pricing section
- Promotional Offers: Create under "Subscription Prices" > "Promotional Offers"
- Offer Codes: Create under "Offer Codes" tab
- Win-Back Offers: Configure under "Win-Back Offers" (iOS 18+)
References
- templates.md — All production Swift templates
- Related:
generators/win-back-offers— Dedicated win-back flow skill - Related:
generators/paywall-generator— Full paywall with offer integration - Related:
app-store/marketing-strategy— Strategic offer planning
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
legal
Legal document generation and compliance guidance for indie Apple developers. Covers privacy policies, terms of service, EULAs, GDPR/CCPA/DPDP compliance, and Apple App Store legal requirements. Use when user needs legal documents or compliance guidance.
privacy-policy
Generate privacy policies, terms of service, and EULAs for Apple platform apps. Detects data collection patterns, third-party SDKs, and generates region-specific legal documents with Apple Privacy Nutrition Label mapping. Use when user needs legal documents or data collection disclosure for App Store submission.
ios-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.
assistive-access
Assistive Access implementation for cognitive accessibility including simplified scenes, navigation icons, runtime detection, and design principles. Use when optimizing apps for Assistive Access mode.
ui-review
Review SwiftUI code for iOS/watchOS Human Interface Guidelines compliance, font usage, Dynamic Type support, and accessibility. Use when user mentions UI review, HIG, accessibility audit, font checks, or wants to verify interface design against Apple standards.
navigation-patterns
SwiftUI navigation architecture patterns including NavigationStack, NavigationSplitView, TabView, programmatic navigation, and custom transitions. Use when reviewing or building navigation, fixing navigation bugs, or architecting app flow.
Didn't find tool you were looking for?