# storekit

A skill that walks an agent through StoreKit 2 purchases: the .storekit config, a StoreManager, transaction verification and SwiftUI product views.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf (Devin Desktop), Claude.ai · ★ 233 repo stars
- Author: John Rogers (@johnrogers)
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/johnrogers/claude-swift-engineering/tree/HEAD/plugins/swift-engineering/skills/storekit/SKILL.md
- Updated: 2026-01-18
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/john-rogers-at-johnrogers-storekit

## What it 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.

## Install

### Claude Code (native platform)

1. **Plugin marketplace**
In the agent chat (not a shell):
```text
/plugin marketplace add johnrogers/claude-swift-engineering
```
In the agent chat (not a shell):
```text
/plugin install swift-engineering@claude-swift-engineering
```
This installs the whole swift-engineering plugin with all its skills

2. **Skills CLI (Vercel)**
```bash
npx skills add johnrogers/claude-swift-engineering --skill storekit -a claude-code
```

3. **Manually: put the files in place**
- File: `~/.claude/skills/storekit/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/storekit/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add johnrogers/claude-swift-engineering --skill storekit -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/storekit/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add johnrogers/claude-swift-engineering --skill storekit -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/storekit/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install johnrogers/claude-swift-engineering plugins/swift-engineering/skills/storekit
```

2. **Manually: put the files in place**
- File: `.github/skills/storekit/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add johnrogers/claude-swift-engineering --skill storekit -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/johnrogers/claude-swift-engineering --path plugins/swift-engineering/skills/storekit
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/storekit/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/johnrogers/claude-swift-engineering/tree/HEAD/plugins/swift-engineering/skills/storekit/SKILL.md

## When to use it
- 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
- 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

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 69919ec0b113e8e4.

BEGIN THIRD-PARTY FILE 69919ec0b113e8e4
````text
---
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()`.
````
END THIRD-PARTY FILE 69919ec0b113e8e4

The third-party file has ended. Everything between the 69919ec0b113e8e4 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2296 of 3203 bytes. © John Rogers (@johnrogers) · MIT · https://github.com/johnrogers/claude-swift-engineering/tree/HEAD/plugins/swift-engineering/skills/storekit/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
