Skip to main content
skill CX Codex

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

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add johnrogers/claude-swift-engineering
/plugin install swift-engineering@claude-swift-engineering
Open on GitHub

What 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 .storekit config and test purchases in the simulator first
  • Catch refunds and cancellations with a Transaction.updates listener
  • Keep StoreManager state 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 .storekit config and a simulator test
  • Build a @MainActor StoreManager and start the Transaction.updates listener 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-engineering

This installs the whole swift-engineering plugin with all its skills

2Skills CLI (Vercel)

npx skills add johnrogers/claude-swift-engineering --skill storekit -a claude-code

3Manually: put the files in place

~/.claude/skills/storekit/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/storekit/

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.

storekit dpearson2699 Guides your agent through StoreKit 2 in-app purchases and subscriptions: paywalls, transactions, entitlement checks. CX Codex +1 4,300installs storekit Prisma-Labs-Dev Puts StoreKit 2 reference pages on disk so the agent reads Product, Transaction, subscriptions and StoreView docs without leaving the repo. CX Codex +1 598installs generators rshankras generators generates production-ready Swift code for iOS and macOS components, including StoreKit 2 paywalls, onboarding, logging, and SwiftData. CX Codex +1 525installs revenuecat-migrate RevenueCat revenuecat-migrate moves existing StoreKit or Google Play Billing purchases to RevenueCat and guides major SDK upgrades. It covers iOS, Android, Flutter, React Native, and Kotlin Multiplatform projects. CX Codex +1 832installs ShipSwift signerlabs ShipSwift connects coding agents to practical iOS implementations and backend code. Helpful when building SwiftUI screens, in-app purchases, or server infrastructure. CX Codex +1 1,574installs app-store-review dpearson2699 app-store-review is a Claude Code skill that checks an iOS app for App Store submission risks. Run it while preparing a release, handling a rejection, or reconciling privacy records. CX Codex +1 4,900installs app-store-optimization dpearson2699 app-store-optimization structures App Store Connect metadata to improve organic search ranking and download conversion. It balances keywords across titles, subtitles, and the indexed keyword field. CX Codex +1 3,200installs axiom-integration CharlesWiltgen axiom-integration — a skill for Claude Code routes iOS system-integration work to focused references. It covers Siri, widgets, in-app purchases, background tasks, and push. CX Codex +1 1,400installs

From the same set33

The whole set →
swift-diagnostics The swift-diagnostics skill guides investigations into navigation, build, and memory issues in iOS and macOS projects. Use it to follow diagnostic checks before changing code. CX Codex +1 ★ 233repo stars localization Walks the agent through iOS localization: String Catalogs, plural forms, locale-aware formats and right-to-left layout. CX Codex +1 ★ 233repo stars swiftui-advanced swiftui-advanced — a Claude Code skill providing advanced SwiftUI workflows for multi-gesture composition, layout adaptation, architecture choice, and profiling. CX Codex +1 ★ 233repo stars haptics Add tactile responses for confirmations, errors, and custom patterns in an iOS app. The skill helps choose between UIKit feedback generators and Core Haptics. CX Codex +1 ★ 233repo stars swift-code-reviewer swift-code-reviewer inspects Swift and iOS implementations for concurrency safety, HIG rules, TCA patterns, and security before testing. CX Codex ★ 233repo stars ios-26-platform The ios-26-platform skill guides iOS 26 feature work in SwiftUI and helps preserve support for iOS 17/18. Use it when updating an interface or handling backward compatibility. CX Codex +1 ★ 233repo stars swiftui-specialist swiftui-specialist builds SwiftUI screens that follow Apple HIG once the core logic and TCA layer are already in place. CX Codex ★ 233repo stars swift-ui-design swift-ui-design inspects mockups, screenshots, or UI descriptions to plan SwiftUI views and architecture before implementation begins. CX Codex ★ 233repo stars

Project sponsors

Companies that keep this analytics open