# Referral System

Generates referral/invite infrastructure with unique codes, deep link sharing, reward...

- Repository: https://github.com/rshankras/claude-code-apple-skills (846 stars)
- Category: DevOps
- License: MIT
- Last updated: 2026-07-24
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add rshankras/claude-code-apple-skills --skill referral-system -g -a claude-code -y`
Codex: `npx skills add rshankras/claude-code-apple-skills --skill referral-system -g -a codex -y`
Cursor: `npx skills add rshankras/claude-code-apple-skills --skill referral-system -g -a cursor -y`
Gemini CLI: `npx skills add rshankras/claude-code-apple-skills --skill referral-system -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add rshankras/claude-code-apple-skills`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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:

1. **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)

2. **Code format?**
   - Short alphanumeric (e.g., `A7K2M9`) -- recommended
   - Custom prefix (e.g., `MYAPP-A7K2M9`)
   - Username-based (e.g., `john-A7K2`)

The rest: https://github.com/rshankras/claude-code-apple-skills/blob/HEAD/skills/generators/referral-system/SKILL.md
