Generates lapsed user detection and re-engagement screens with personalized return experiences, win-back offers, and inactivity tracking. Use when user wants to re-engage inactive users, detect lapsed users, or build return flows.
npx skills add https://github.com/rshankras/claude-code-apple-skills --skill lapsed-user
Generate production infrastructure for detecting users who haven't opened the app in X days, showing personalized return screens that highlight what they missed, and optionally presenting win-back incentives to recover churned or lapsing users.
Use this skill when the user:
Search for existing engagement or analytics infrastructure:
Glob: **/*Analytics*.swift, **/*Engagement*.swift, **/*Tracker*.swift, **/*Activity*.swift
Grep: "lastActiveDate" or "UserDefaults" or "scenePhase" or "applicationDidBecomeActive"
If existing tracking found:
Search for existing push notification configuration:
Glob: **/*Notification*.swift, **/*Push*.swift
Grep: "UNUserNotificationCenter" or "UNNotification" or "registerForRemoteNotifications"
If push notifications are configured, offer push-based re-engagement as an option.
Search for existing lapsed user handling:
Glob: **/*LapsedUser*.swift, **/*WinBack*.swift, **/*ReturnExperience*.swift, **/*Reengag*.swift
Grep: "lapsedUser" or "winBack" or "returnExperience" or "daysInactive"
If existing implementation found:
Ask user via AskUserQuestion:
Read templates.md for production Swift code.
Generate these files:
InactivityTracker.swift — Tracks last active date, calculates days since last useLapsedUserDetector.swift — Evaluates inactivity against thresholds, returns lapse categoryLapsedUserManager.swift — Orchestrator combining detection + experience selection + analyticsReturnExperienceView.swift — Personalized "Welcome back" screen with what-you-missedWinBackOfferView.swift — Special offer screen for lapsed subscribersLapsedUserModifier.swift — SwiftUI ViewModifier for root view auto-detection and presentationCheck project structure:
Sources/ exists → Sources/LapsedUser/App/ exists → App/LapsedUser/LapsedUser/After generation, provide:
LapsedUser/
├── InactivityTracker.swift # Tracks last active date in UserDefaults
├── LapsedUserDetector.swift # Evaluates inactivity thresholds
├── LapsedUserManager.swift # Orchestrator for detection + experience
├── ReturnExperienceView.swift # Welcome back screen with highlights
├── WinBackOfferView.swift # Special offer for lapsed subscribers
└── LapsedUserModifier.swift # ViewModifier for auto-detection
Attach to root view:
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.lapsedUserDetection()
}
}
}
Manual detection (if you need control over presentation):
struct ContentView: View {
@State private var manager = LapsedUserManager()
var body: some View {
NavigationStack {
MainView()
}
.task {
await manager.checkOnReturn()
}
.sheet(item: $manager.returnExperience) { experience in
ReturnExperienceView(experience: experience)
}
.sheet(item: $manager.winBackOffer) { offer in
WinBackOfferView(offer: offer)
}
}
}
With custom thresholds:
let detector = LapsedUserDetector(
recentThreshold: 7, // 1-7 days: recently inactive
moderateThreshold: 21, // 8-21 days: moderately lapsed
longTermThreshold: 60 // 22-60 days: long-term lapsed
)
Win-back offer for lapsed subscribers:
WinBackOfferView(offer: WinBackOffer(
headline: "We missed you!",
discount: .percentage(30),
originalPrice: "$9.99/mo",
offerPrice: "$6.99/mo",
expiresIn: .days(7),
productID: "com.app.premium.monthly"
))
@Test
func detectsRecentlyInactiveUser() async {
let tracker = InactivityTracker(store: MockUserDefaults())
tracker.recordActivity()
// Simulate 5 days of inactivity
tracker.override(lastActiveDate: Calendar.current.date(byAdding: .day, value: -5, to: Date())!)
let detector = LapsedUserDetector(tracker: tracker)
let category = detector.evaluate()
#expect(category == .recentlyInactive)
}
@Test
func longTermLapsedUserGetsWinBackOffer() async {
let tracker = InactivityTracker(store: MockUserDefaults())
tracker.override(lastActiveDate: Calendar.current.date(byAdding: .day, value: -45, to: Date())!)
let manager = LapsedUserManager(tracker: tracker, isSubscriber: true)
await manager.checkOnReturn()
#expect(manager.winBackOffer != nil)
#expect(manager.returnExperience != nil)
}
@Test
func activeUserSeesNothing() async {
let tracker = InactivityTracker(store: MockUserDefaults())
tracker.recordActivity() // Just opened the app
let manager = LapsedUserManager(tracker: tracker)
await manager.checkOnReturn()
#expect(manager.returnExperience == nil)
#expect(manager.winBackOffer == nil)
}
// In your App struct or root view
.onChange(of: scenePhase) { _, newPhase in
if newPhase == .active {
inactivityTracker.recordActivity()
}
}
// LapsedUserManager determines what to show based on:
// 1. How long the user has been away
// 2. Whether they are/were a subscriber
// 3. What changed in the app since their last visit
let experience = manager.buildReturnExperience(
category: .moderatelyLapsed,
changelog: appChangelog.since(tracker.lastActiveDate)
)
// Only show win-back to users who previously had a subscription
if detector.category.isLapsed && subscriptionStatus == .expired {
manager.presentWinBackOffer(
discount: .percentage(30),
duration: .days(7)
)
}
Background app refresh triggers applicationDidBecomeActive without user interaction. Use scenePhase changes to .active paired with the app being in .background (not .inactive) to avoid false positives. Track whether the user actually interacted (foreground time > threshold).
Always use Calendar.current for day calculations, not raw TimeInterval division. A user who opened the app at 11pm and returns at 1am the next day has been away for 2 hours, not 1 day.
// Wrong - raw seconds
let daysAway = Date().timeIntervalSince(lastActive) / 86400
// Right - calendar-aware
let daysAway = Calendar.current.dateComponents([.day], from: lastActive, to: Date()).day ?? 0
Provide a "Don't show again" option on the return screen. Respect user preferences — if they dismiss the return experience, increase the threshold before showing again. Store dismissal count and back off exponentially.
If your app has onboarding, what's-new, or review prompts, coordinate with them. Don't show a return screen AND a review prompt AND a what's-new modal on the same launch. Use a presentation queue.
Inject the date source so tests can control "now":
let tracker = InactivityTracker(
store: mockDefaults,
currentDate: { Date(timeIntervalSince1970: 1700000000) }
)
generators/subscription-lifecycle — Subscription state managementgenerators/whats-new — What's New screen generationIntegration with protocols.io API for managing scientific protocols. This skill should be used when working with protocols.io to search, create, update, or publish protocols; manage protocol steps and materials; handle discussions and comments; organize workspaces; upload and manage files; or integrate protocols.io functionality into workflows. Applicable for protocol discovery, collaborative protocol development, experiment tracking, lab protocol management, and scientific documentation.
Analyzes job descriptions and generates tailored resumes that highlight relevant experience, skills, and achievements to maximize interview chances
Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw.
Build and distribute Expo development clients locally or via TestFlight
Use when you have a written implementation plan to execute in a separate session with review checkpoints
Data structure for annotated matrices in single-cell analysis. Use when working with .h5ad files or integrating with the scverse ecosystem. This is the data format skill—for analysis workflows use scanpy; for probabilistic models use scvi-tools; for population-scale queries use cellxgene-census.
Benchling R&D platform integration. Access registry (DNA, proteins), inventory, ELN entries, workflows via API, build Benchling Apps, query Data Warehouse, for lab data management automation.
Comprehensive molecular biology toolkit. Use for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Best for batch processing, custom bioinformatics pipelines, BLAST automation. For quick lookups use gget; for multi-service integration use bioservices.
Take rshankras/lapsed-user 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.