Generates referral/invite infrastructure with unique codes, deep link sharing, reward tracking, and fraud prevention. Use when user wants referral codes, invite friends flow, or viral growth mechanics.
npx skills add https://github.com/rshankras/claude-code-apple-skills --skill referral-system
Generate a production referral/invite system with unique code generation, deep link sharing, reward tracking, fraud prevention, and SwiftUI views for inviting friends and monitoring referral performance.
Use this skill when the user:
Search for existing referral/invite code:
Glob: **/*Referral*.swift, **/*Invite*.swift, **/*InviteCode*.swift
Grep: "referralCode" or "inviteCode" or "ReferralManager"
If existing referral system found:
Search for existing deep link handling:
Glob: **/*DeepLink*.swift, **/*UniversalLink*.swift
Grep: "onOpenURL" or "userActivity" or "NSUserActivity"
If deep link handling exists, integrate with it rather than generating a standalone handler.
Ask user via AskUserQuestion:
A7K2M9) -- recommendedMYAPP-A7K2M9)john-A7K2)Read templates.md for production Swift code.
Generate these files:
ReferralCode.swift -- Model with unique code generation, expiration, usage trackingReferralManager.swift -- @Observable manager for code lifecycle and redemptionReferralReward.swift -- Reward configuration, conditions, and fulfillment trackingInviteView.swift -- SwiftUI invite screen with code display and sharingReferralDashboardView.swift -- Stats view for referral performanceReferralDeepLinkHandler.swift -- Deep link parsing and redemption triggeringCheck project structure:
Sources/ exists -> Sources/Referral/App/ exists -> App/Referral/Referral/After generation, provide:
Referral/
├── ReferralCode.swift # Code model with generation and validation
├── ReferralManager.swift # @Observable manager for code lifecycle
├── ReferralReward.swift # Reward config and fulfillment tracking
├── InviteView.swift # Invite screen with share actions
├── ReferralDashboardView.swift # Referral stats dashboard
└── ReferralDeepLinkHandler.swift # Deep link parsing and redemption
Add deep link handling in your App struct:
@main
struct MyApp: App {
@State private var referralManager = ReferralManager()
private let deepLinkHandler = ReferralDeepLinkHandler()
var body: some Scene {
WindowGroup {
ContentView()
.environment(referralManager)
.onOpenURL { url in
if let code = deepLinkHandler.extractCode(from: url) {
Task {
await referralManager.redeemCode(code)
}
}
}
}
}
}
Present the invite screen:
struct ProfileView: View {
@State private var showInvite = false
var body: some View {
Button("Invite Friends") { showInvite = true }
.sheet(isPresented: $showInvite) {
InviteView()
}
}
}
Show referral dashboard:
NavigationLink("My Referrals") {
ReferralDashboardView()
}
@Test
func generatedCodeIsUnique() async throws {
let manager = ReferralManager(store: InMemoryReferralStore())
let code1 = await manager.generateCode(for: "user-1")
let code2 = await manager.generateCode(for: "user-2")
#expect(code1.value != code2.value)
}
@Test
func redemptionGrantsReward() async throws {
let manager = ReferralManager(store: InMemoryReferralStore())
let code = await manager.generateCode(for: "referrer-1")
let result = await manager.redeemCode(code.value, redeemedBy: "invitee-1")
#expect(result == .success)
#expect(manager.rewards(for: "referrer-1").count == 1)
#expect(manager.rewards(for: "invitee-1").count == 1)
}
@Test
func selfReferralIsRejected() async throws {
let manager = ReferralManager(store: InMemoryReferralStore())
let code = await manager.generateCode(for: "user-1")
let result = await manager.redeemCode(code.value, redeemedBy: "user-1")
#expect(result == .fraudDetected(.selfReferral))
}
@Test
func expiredCodeIsRejected() async throws {
let manager = ReferralManager(store: InMemoryReferralStore())
let code = ReferralCode(
value: "EXPIRED1",
ownerID: "user-1",
expiresAt: Date.distantPast
)
let result = await manager.redeemCode(code.value, redeemedBy: "user-2")
#expect(result == .expired)
}
// Generate code for current user
let code = await referralManager.generateCode(for: currentUserID)
// Share via system share sheet
let shareURL = deepLinkHandler.buildShareURL(for: code)
let message = "Join me on MyApp! Use my code \(code.value) for a bonus."
let activityItems: [Any] = [message, shareURL]
// On app launch or deep link open
let result = await referralManager.redeemCode(codeString, redeemedBy: currentUserID)
switch result {
case .success:
showRewardAnimation()
case .alreadyRedeemed:
showAlert("You've already used a referral code.")
case .expired:
showAlert("This referral code has expired.")
case .fraudDetected(let reason):
logger.warning("Fraud detected: \(reason)")
case .invalid:
showAlert("Invalid referral code.")
}
// Check pending rewards
let pending = referralManager.pendingRewards(for: currentUserID)
for reward in pending {
await fulfillReward(reward)
await referralManager.markFulfilled(reward)
}
apple-app-site-association file on your server.generators/deep-linking -- Universal link and deep link infrastructuregenerators/share-card -- Visual share cards for social sharinggenerators/analytics-setup -- Track referral funnel eventsConfigure, explore, and optimize Nx monorepo workspaces. Use when setting up Nx, exploring workspace structure, configuring project boundaries, analyzing affected projects, optimizing build caching, or implementing CI/CD with affected commands. Keywords — nx, monorepo, workspace, projects, targets, affected. Do NOT use for running tasks (use nx-run-tasks) or code generation with generators (use nx-generate).
> Design, validate, and optimize schema.org structured data for eligibility, correctness, and measurable SEO impact. Use when the user wants to add, fix, audit, or scale schema markup (JSON-LD) for rich results. This skill evaluates whether schema should be implemented, what types are valid, and how to deploy safely according to Google guidelines.
Fetches real-time Azure retail pricing using the Azure Retail Prices API (prices.azure.com) and estimates Copilot Studio agent credit consumption. Use when the user asks about the cost of any Azure service, wants to compare SKU prices, needs pricing data for a cost estimate, mentions Azure pricing, Azure costs, Azure billing, or asks about Copilot Studio pricing, Copilot Credits, or agent usage estimation. Covers compute, storage, networking, databases, AI, Copilot Studio, and all other Azure service families.
Monitor paid-ad account pacing, delivery, performance, creative fatigue, tracking, policy, and data quality across supported platforms. Use for daily or weekly checks, anomaly review, budget pacing, post-launch verification, or campaign monitoring.
Audit server-side paid-media measurement including server-side tag management, platform conversion APIs, event taxonomy, browser/server deduplication, consent, hashing, data quality, observability, and privacy. Use for server-side tracking, sGTM, server-side tagging, CAPI, Events API, event_id, pixel debugging, first-party measurement, or conversion data loss.
Use when building Next.js 14+ applications with App Router, server components, or server actions. Invoke for full-stack features, performance optimization, SEO implementation, production deployment.
Coordinate the end-to-end CAD/source-asset to SimReady workflow. Use for broad requests such as CAD to SimReady, source asset to simulation-ready USD, or prop packaging that require conversion, material/physics assignment, SimReady conformance, validation, and optional package creation; deploy or verify Content Agents services first when property assignment is enabled; route single-stage work through nested references.
Convert Kanchi-style dividend investing into a repeatable US-stock operating procedure. Use when users ask for かんち式配当投資, dividend screening, dividend growth quality checks, PERxPBR adaptation for US sectors, pullback limit-order planning, or one-page stock memo creation. Covers screening, deep dive, entry planning, and post-purchase monitoring cadence.
Take rshankras/referral-system 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.