storekit · johnrogers — Claude Code skill: StoreKit 2 in-app purchases
A skill that walks an agent through StoreKit 2 purchases: the .storekit config, a StoreManager, transaction verification and SwiftUI product views.
MIT ★ 233 updated 2026-01-18
/plugin marketplace add johnrogers/claude-swift-engineering
/plugin install swift-engineering@claude-swift-engineeringWhat storekit does
Five reference files sit inside: setup with a .storekit file, products, subscriptions, transactions and the StoreKit views. The agent is told to load whichever one the task touches, even when the connection looks thin.
The workflow has an order. Configuration comes before code, purchases get tested in the Xcode simulator, then the logic lands in a single @MainActor StoreManager. A Transaction.updates listener goes up at launch, not when someone taps buy. Products render through ProductView or custom UI.
Granting an entitlement without transaction.finish() leaves the transaction open, and the buyer sees nothing for their money. A shared StoreManager without @MainActor lets concurrent tasks corrupt published state. Hardcoded product IDs and prices make testing and localization painful.
What it helps with
- Add an auto-renewable subscription with StoreKit 2
- Set up a
.storekitconfig and test purchases in the simulator first - Catch refunds and cancellations with a
Transaction.updateslistener - Keep
StoreManagerstate safe across async tasks - Move product IDs and prices out of hardcoded values
Example prompts for the agent
- Add an auto-renewable subscription with StoreKit 2, starting from the
.storekitconfig and a simulator test - Build a
@MainActorStoreManagerand start theTransaction.updateslistener at app launch - Check that
transaction.finish()runs after every entitlement is granted
How to install storekit
1Plugin marketplace
/plugin marketplace add johnrogers/claude-swift-engineering/plugin install swift-engineering@claude-swift-engineeringThis installs the whole swift-engineering plugin with all its skills
2Skills CLI (Vercel)
npx skills add johnrogers/claude-swift-engineering --skill storekit -a claude-code3Manually: put the files in place
~/.claude/skills/storekit/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/storekit/
1Skills CLI (Vercel)
npx skills add johnrogers/claude-swift-engineering --skill storekit -a codex2Manually: put the files in place
.agents/skills/storekit/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add johnrogers/claude-swift-engineering --skill storekit -a cursor2Manually: put the files in place
.cursor/skills/storekit/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install johnrogers/claude-swift-engineering plugins/swift-engineering/skills/storekit2Manually: put the files in place
.github/skills/storekit/SKILL.md1Skills CLI (Vercel)
npx skills add johnrogers/claude-swift-engineering --skill storekit -a gemini-cli2Platform CLI
gemini skills install https://github.com/johnrogers/claude-swift-engineering --path plugins/swift-engineering/skills/storekitManually: put the files in place
.devin/skills/storekit/SKILL.mdThe legacy .windsurf/skills/ path still works
Claude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about storekit
How do I install storekit in Claude Code?
From the marketplace: run /plugin marketplace add johnrogers/claude-swift-engineering, then /plugin install swift-engineering@claude-swift-engineering.
What does the storekit skill do?
It covers building in-app purchases on StoreKit 2: products, subscriptions, transaction verification and finishing, SwiftUI screens. The agent pulls the matching one of five reference files once the task reaches that part.
Why doesn't a purchase show up for the user?
Most likely transaction.finish() was never called after the entitlement was granted. The transaction stays open, so the app shows no purchase.
Source text
SKILL.md · MIT
---
name: storekit
description: Use when implementing in-app purchases, StoreKit 2 subscriptions, consumables, non-consumables, or transaction handling. Covers testing-first workflow with .storekit configuration, StoreManager architecture, and transaction verification.
---
# StoreKit
StoreKit 2 patterns for implementing in-app purchases with async/await APIs, automatic verification, and SwiftUI integration.
## Reference Loading Guide
**ALWAYS load reference files if there is even a small chance the content may be required.** It's better to have the context than to miss a pattern or make a mistake.
| Reference | Load When |
|-----------|-----------|
| **[Getting Started](references/getting-started.md)** | Setting up `.storekit` configuration file, testing-first workflow |
| **[Products](references/products.md)** | Loading products, product types, purchasing with `Product.purchase()` |
| **[Subscriptions](references/subscriptions.md)** | Auto-renewable subscriptions, subscription groups, offers, renewal tracking |
| **[Transactions](references/transactions.md)** | Transaction listener, verification, finishing transactions, restore purchases |
| **[StoreKit Views](references/storekit-views.md)** | ProductView, SubscriptionStoreView, SubscriptionOfferView in SwiftUI |
## Core Workflow
1. Create `.storekit` configuration file first (before any code)
2. Test purchases locally in Xcode simulator
3. Implement centralized `StoreManager` with `@MainActor`
4. Set up `Transaction.updates` listener at app launch
5. Display products with `ProductView` or custom UI
6. Always call `transaction.finish()` after granting entitlements
## Essential Architecture
```swift
@MainActor
final class StoreManager: ObservableObject {
@Published private(set) var products: [Product] = []
@Published private(set) var purchasedProductIDs: Set<String> = []
private var transactionListener: Task<Void, Never>?
init() {
transactionListener = listenForTransactions()
Task { await loadProducts() }
}
}
```
## Common Mistakes
1. **Missing `.finish()` calls on transactions** — Forgetting to call `transaction.finish()` after granting entitlements causes transactions to never complete. The user won't see their purchase reflected. Always call `finish()`.
2. **Unsafe StoreManager state** — Shared `StoreManager` without `@MainActor` can have race conditions. Multiple async tasks can update `@Published` properties concurrently, corrupting state. Use `@MainActor` for thread safety.
3. **No transaction listener at app launch** — Not setting up `Transaction.updates` listener means app crashes or misses refunded/canceled purchases. Listen for transactions immediately in `@main`, not when user taps purchase button.
4. **Hardcoded product IDs** — Hardcoded IDs make testing and localization hard. Use configuration files or environment variables for product IDs. Same applies to prices (fetch from App Store, don't hardcode).
5. **Ignoring verification failures** — App Store verification fails silently sometimes. Not checking verification status means accepting unverified transactions (security risk). Always verify before granting entitlements.
© John Rogers (@johnrogers) · MIT · johnrogers/claude-swift-engineering
Similar skills
All skills for Mobile →storekit by other authors comes first.