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.
Best use case
subscription-offers is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
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.
Teams using subscription-offers should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/subscription-offers/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How subscription-offers Compares
| Feature / Agent | subscription-offers | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
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.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# 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 `SubscriptionStoreView` offers, iOS 15+ for manual)
- [ ] Look for existing product/subscription group IDs
- [ ] Identify if `paywall-generator` was 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:
1. **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)
2. **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
3. **Deployment target**
- iOS 15+ (manual offer UI)
- iOS 16.4+ (SubscriptionStoreView with offers)
- iOS 18+ (win-back offer support)
4. **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
1. **SubscriptionOfferManager.swift** — Central offer management
- Offer eligibility checking for all types
- Offer presentation logic
- Transaction handling for offer purchases
2. **OfferEligibility.swift** — Eligibility verification
- Introductory offer eligibility (`isEligibleForIntroOffer`)
- Promotional offer eligibility (your business logic)
- Win-back offer eligibility (iOS 18+)
3. **OfferConfiguration.swift** — Offer type definitions and configuration
### Step 3: Create UI Files (conditional)
4. **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
5. **OfferCodeRedemptionView.swift** — Offer code entry UI (if offer codes selected)
### Step 4: Create Optional Files
6. **OfferSignatureProvider.swift** — Server-side signature handling (if promotional offers)
7. **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:**
```swift
let manager = SubscriptionOfferManager()
let isEligible = await manager.isEligibleForIntroOffer(
productID: "com.app.subscription.monthly"
)
```
**Present Best Available Offer:**
```swift
// 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:**
```swift
// iOS 16+
try await AppStore.presentOfferCodeRedeemSheet()
```
**Win-Back Offer (iOS 18+):**
```swift
let winBackOffers = await manager.availableWinBackOffers(
for: "com.app.subscription.monthly"
)
if let bestOffer = winBackOffers.first {
// Present win-back UI
}
```
### Testing Instructions
1. **StoreKit Configuration file**: Add offer configurations
2. **Test each offer type** in Sandbox environment
3. **Verify eligibility logic**: Test with new, current, and lapsed accounts
4. **Test edge cases**: Expired trials, multiple subscription groups, family sharing
### App Store Connect Setup
1. Go to App Store Connect > Subscriptions > Your Group
2. **Introductory Offer**: Set in subscription pricing section
3. **Promotional Offers**: Create under "Subscription Prices" > "Promotional Offers"
4. **Offer Codes**: Create under "Offer Codes" tab
5. **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 planningRelated Skills
win-back-offers
Generates the complete win-back offer flow for churned subscribers — StoreKit Message API handling, eligibility verification, offer sheet presentation, and analytics. Use when implementing win-back campaigns or re-engagement for lapsed subscribers.
subscription-lifecycle
Generates StoreKit 2 subscription lifecycle management — grace periods, billing retry, offer codes, win-back offers, upgrade/downgrade paths, and subscription status monitoring. Use when user needs post-purchase subscription state handling beyond the initial paywall.
swiftui-ui-patterns
Best practices and example-driven guidance for building SwiftUI views and components. Use when creating or refactoring SwiftUI UI, designing tab architecture with TabView, composing screens, or needing component-specific patterns and examples.
watchOS
watchOS development guidance including SwiftUI for Watch, Watch Connectivity, complications, and watch-specific UI patterns. Use for watchOS code review, best practices, or Watch app development.
visionos-widgets
visionOS widget patterns including mounting styles, glass/paper textures, proximity-aware layouts, and spatial widget families. Use when creating or adapting widgets for visionOS.
test-data-factory
Generate test fixture factories for your models. Builder pattern and static factories for zero-boilerplate test data. Use when tests need sample data setup.
test-contract
Generate protocol/interface test suites that any implementation must pass. Define the contract once, test every implementation. Use when designing protocols or swapping implementations.
tdd-refactor-guard
Pre-refactor safety checklist. Verifies test coverage exists before AI modifies existing code. Use before asking AI to refactor anything.
tdd-feature
Red-green-refactor scaffold for building new features with TDD. Write failing tests first, then implement to pass. Use when building new features test-first.
tdd-bug-fix
Fix bugs using red-green-refactor — reproduce the bug as a failing test first, then fix it. Use when fixing bugs to ensure they never regress.
snapshot-test-setup
Set up SwiftUI visual regression testing with swift-snapshot-testing. Generates snapshot test boilerplate and CI configuration. Use for UI regression prevention.
integration-test-scaffold
Generate cross-module test harness with mock servers, in-memory stores, and test configuration. Use when testing networking + persistence + business logic together.