rshankras/onboarding-generator
Generates value-moment-first onboarding flows for iOS/macOS apps — the default architecture races a new user to the first felt experience of the app's promised outcome, branching on whether they can experience it right now or need to plan for later. The classic paged welcome-carousel tour is an explicit fallback for genuinely explain-first apps. Use when user wants to add onboarding, welcome screens, first-launch experience, or improve activation/trial conversion.
npx skills add https://github.com/rshankras/claude-code-apple-skills --skill onboarding-generator
Generate onboarding whose job is to get a new user to the value moment — the first time they *experience* (never just read about) the outcome the app promises — as fast as their situation allows.
Default architecture: value-moment-first, branching on readiness. The user answers one question ("can you do this right now?"), and the path is either the shortest possible route to the value moment, or a captured plan to reach it later. Fallback architecture: the classic paged welcome carousel — generate it only when Step 0 below confirms the app is genuinely explain-first.
Read onboarding-patterns.md for the full philosophy, the nine implementation lessons (each with a code sketch), and a worked case study.
Use this skill when the user:
This is the question that decides every downstream choice — ask it before any configuration question. If the requester can't answer it, help them find it: it's the first specific instant a user *feels* the outcome, not a feature list. "Sees a demo of X" is not a value moment; "actually did X and saw the result" is.
Onboarding that ends before the user felt the value moment didn't finish — it just stopped.
@Observable needs iOS 17+/macOS 14+; fall back to ObservableObject below that)onboarding-patterns.md Lesson 3)Glob: /*Paywall*.swift, /*StoreKit*.swift, or an installed generators/paywall-generator output) — determines free-first vs paywalled-first in Configuration Question 2UNUserNotificationCenter usage already in the project — reuse the existing permission seam if one exists rather than creating a secondGlob: **/*Onboarding*.swift, **/*Welcome*.swift
Grep: "hasCompletedOnboarding" or "isFirstLaunch" or "onboardingCompleted"
If found, ask the user:
generators/quick-win-sessionIf the project already has a quick-win-session installation, don't generate a second guided-first-action system. Ask whether the existing quick-win session already *is* the ready-now path (often it is — fold this flow's branch question and later-path in around it) or whether the two should stay separate stages.
Ask user via AskUserQuestion:
Run this test:
> Would skipping straight to the value moment leave the user unable to understand what they're looking at, in a way no amount of contextual UI (tooltips, empty-state copy, a single explainer inline) could fix — because the domain itself requires orientation (e.g., a professional tool with domain-specific jargon, a multi-role enterprise workflow)?
Read templates/value-moment/ for production Swift code, then generate:
OnboardingPhase.swift — the phase/branch state model (one enum case per screen; every case maps to exactly one decision)OnboardingStore.swift — @Observable coordinator (plain object, not a View — see onboarding-patterns.md Lesson 1's testability point). Owns phase transitions, the branch, the captured "when," and calls into instrumentation. No navigation/routing types inside it — the app's existing router/state owns side effects, this store owns only business state.OnboardingRootView.swift — the phase switch. No NavigationStack of its own (this view *is* a root, never a pushed destination — see the global SwiftUI-patterns rule against nesting nav containers).OnboardingBranchView.swift — screen 1: value-moment framing + the ready-now/later fork. This is the only screen every user sees.OnboardingReadyNowBridgeView.swift — the ready-now hand-off into the real feature, with resume-callback wiring (Lesson 3 + Lesson 4)OnboardingIntentionView.swift — later path: capture the concrete "when" via chips, resolved through a pure, injectable-clock function (Lesson 7)OnboardingReminderView.swift + OnboardingReminderService.swift — later path: the contextual local-notification permission ask (Lesson 6)OnboardingInstrumentation.swift — value-moment reach-rate markers (Lesson 8)Onboarding replaces the app's root view; it is never a .fullScreenCover/.sheet over the real content. Show the requester this shape and adapt it to their app's actual root:
struct ContentView: View {
@State private var onboardingStore = OnboardingStore()
private var showOnboarding: Bool {
// Phase-first (Lesson 2): check the in-memory state machine FIRST;
// the durable flag is only the survives-relaunch fallback.
if appState.onboardingCompleted { return false }
return onboardingStore.phase != .completed && onboardingStore.phase != .awaitingHandoffReturn
}
var body: some View {
Group {
if showOnboarding {
OnboardingRootView(store: onboardingStore)
} else {
RealAppRootView() // whatever the app's true root already is
}
}
.onChange(of: onboardingStore.phase) { _, newPhase in
guard newPhase == .completed else { return }
appState.onboardingCompleted = true // durable fallback catches up
}
}
}
Arm a one-shot completion callback before the hand-off, plus a wander-off safety net that completes onboarding silently if the user backs out without resolving:
func beginReadyNowHandoff() {
store.beginHandoff()
router.presetPathIntoRealFeature(...) // land straight on the feature, never Home
router.onRealFeatureFinished = { outcome in
store.handoffReturned(valueMomentReached: outcome.reachedValueMoment)
}
}
// Safety net — user backed all the way out without the callback firing.
.onChange(of: router.path) { _, newPath in
guard store.phase == .awaitingHandoffReturn, newPath.isEmpty else { return }
store.abandonToHome() // NEVER re-interrupts; completes quietly
}
Adding this flow will break the first screen of every existing UI test that assumes it lands on the app's real home screen. Before finishing generation:
ProcessInfo.processInfo.arguments), usually in a UITestSupport-style file.static var showOnboardingOverride: Bool {
ProcessInfo.processInfo.arguments.contains("-uiTestShowOnboarding")
}
// At app launch, under the existing test-mode gate:
appState.onboardingCompleted = !UITestSupport.showOnboardingOverride
-uiTestShowOnboarding to exercise the real flow.After the plan lands, surface it on the app's home surface — a small chip/badge carrying the planned date/action that reopens the flow when tapped — and prune it once the date passes:
if let plannedAt = appState.plannedIntentionDate {
PlannedIntentionChip(date: plannedAt) { /* reopen the ready-now path directly */ }
}
// Called from wherever the home surface is revisited:
func prunePlannedIntentionIfExpired(now: Date = .now) {
guard let plannedIntentionDate, plannedIntentionDate <= now else { return }
self.plannedIntentionDate = nil
}
Read templates/carousel-fallback/ and the "Carousel Fallback" section of onboarding-patterns.md. Generate:
OnboardingView.swift — main paged/stepped containerOnboardingPageView.swift — individual page templateOnboardingPage.swift — page data modelOnboardingStorage.swift — persistenceOnboardingModifier.swift — view modifier for integrationAsk the same navigation-style/skip/presentation configuration questions as before (paged vs stepped, 2–5 screens, skip option, full-screen cover vs inline). Even here: still apply the root-swap and UI-test-suppression steps above — the presentation mechanics change, the anti-flash and anti-broken-test requirements don't.
Check project structure:
Sources/ exists → Sources/Onboarding/App/ exists → App/Onboarding/Onboarding/Run this before calling generation done — on a fresh flow, and again any time onboarding is later touched. If any answer is "no," the flow needs work before it ships:
After generation, provide:
Onboarding/
├── OnboardingPhase.swift # Phase/branch state model
├── OnboardingStore.swift # @Observable coordinator (business state only)
├── OnboardingRootView.swift # Phase switch — the root-swap target
├── OnboardingBranchView.swift # Screen 1: value-moment framing + fork
├── OnboardingReadyNowBridgeView.swift # Ready-now hand-off + resume wiring
├── OnboardingIntentionView.swift # Later: concrete "when" capture
├── OnboardingReminderView.swift # Later: contextual permission ask
├── OnboardingReminderService.swift # Local-notification seam (protocol + live impl)
└── OnboardingInstrumentation.swift # Value-moment reach-rate markers
Onboarding/
├── OnboardingView.swift # Main container
├── OnboardingPageView.swift # Page template
├── OnboardingPage.swift # Data model
├── OnboardingStorage.swift # @AppStorage persistence
└── OnboardingModifier.swift # .onboarding() modifier
Root swap (both architectures):
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView() // ContentView itself performs the root swap — see Step 2
}
}
}
Value-moment: define the app's own phases and hand-offs in OnboardingPhase.swift/OnboardingStore.swift — the template ships a two-phase (ready-now / later) skeleton; add or remove phases to match the actual value moment, keeping one decision per phase.
Carousel fallback: add pages as before —
static let pages: [OnboardingPage] = [
OnboardingPage(title: "Welcome", description: "...", imageName: "hand.wave", accentColor: .blue),
]
Value-moment flow:
UserDefaults)Carousel fallback: unchanged from the classic flow — delete app, confirm it shows once, confirm it doesn't reappear after completion.
// Add to Settings or debug menu
Button("Reset Onboarding") {
UserDefaults.standard.removeObject(forKey: "hasCompletedOnboarding")
OnboardingInstrumentation.resetForTesting(defaults: .standard) // value-moment flow only
}
Track value-moment reach rate — percentage of new users who reach the value moment in their first session, time-to-reach, and per-screen drop-off — not flow completion. A user who reached the value moment and closed the app is a win; a user who tapped through every screen and never felt it is not.
This works even in apps with no analytics SDK: local-only markers (UserDefaults timestamps for startedAt/branch/valueMomentAt/completedAt) plus os.Logger, every write idempotent (first stamp wins) so re-entrant paths never overwrite a real timestamp with a later, less meaningful one. See onboarding-patterns.md Lesson 8 for the full pattern; wire into a real analytics provider (e.g. an installed generators/analytics-setup output) when one exists.
generators/quick-win-session — guided first-action UI; check for overlap before generating both (see Pre-Generation Check 3)generators/permission-priming — deeper priming patterns if the reminder step needs more than a single contextual askgenerators/paywall-generator — the pre-purchase half of the flow for paywalled-first appsgenerators/push-notifications — remote push infrastructure, distinct from this skill's local-only reminder (no server involved)Take rshankras/onboarding-generator from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.