referral-system
БесплатноБез исполняемых скриптовНе проверенGenerates referral/invite infrastructure with unique codes, deep link sharing, reward tracking, and fraud prevention. Use when user wants referral codes…
от rshankras★ 922 звезды на GitHubОб этом скилле
Referral System Generator
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.
When This Skill Activates
Use this skill when the user:
- Asks to "add a referral system" or "referral codes"
- Wants to "invite friends" or "refer a friend" flow
- Mentions "viral growth" or "invitation system"
- Asks about "referral rewards" or "referral tracking"
- Wants "invite codes" or "shareable invite links"
Pre-Generation Checks
1. Project Context Detection
- Check Swift version (requires Swift 5.9+)
- Check deployment target (iOS 17+ / macOS 14+ for @Observable and SwiftData)
- Identify source file locations
- Check for existing entitlements (Associated Domains for deep links)
2. Conflict Detection
Search for existing referral/invite code:
Glob: **/*Referral*.swift, **/*Invite*.swift, **/*InviteCode*.swift
Grep: "referralCode" or "inviteCode" or "ReferralManager"
If existing referral system found:
- Ask if user wants to replace or extend it
- If extending, identify integration points
3. Deep Link Setup Detection
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.
Configuration Questions
Ask user via AskUserQuestion:
Reward type?
- Both-get (referrer and invitee both earn a reward) -- recommended
- Referrer-only (only the person who shares gets rewarded)
- Points-based (both parties earn points toward rewards)
Code format?
- Short alphanumeric (e.g.,
A7K2M9) -- recommended - Custom prefix (e.g.,
MYAPP-A7K2M9) - Username-based (e.g.,
john-A7K2)
- Short alphanumeric (e.g.,
Sharing method?
- Deep link (universal link with embedded code) -- recommended
- Clipboard copy (copy code to pasteboard)
- Share sheet (system share with link and message)
- All of the above
Storage?
- SwiftData (local persistence, recommended for most apps)
- UserDefaults (lightweight, for simple single-code scenarios)
- CloudKit (sync across devices)
Generation Process
Step 1: Read Templates
Read templates.md for production Swift code.
Step 2: Create Core Files
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 tracking
Step 3: Create UI Files
InviteView.swift-- SwiftUI invite screen with code display and sharingReferralDashboardView.swift-- Stats view for referral performance
Step 4: Create Integration Files
ReferralDeepLinkHandler.swift-- Deep link parsing and redemption triggering
Step 5: Determine File Location
Check project structure:
- If
Sources/exists ->Sources/Referral/ - If
App/exists ->App/Referral/ - Otherwise ->
Referral/
Output Format
After generation, provide:
Files Created
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
Integration Steps
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()
}
Testing
@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(c
Установить referral-system в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditGlobGrepBashAskUserQuestionВложенные файлы
FAQ
Что делает скилл referral-system?
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.
Как установить скилл referral-system?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл referral-system запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic