Phone auth
Skill launch52-ai/flutter-template/.claude/skills/phone-auth
Phone OTP authentication - country data, phone formatting, E.164 validation, rate limiting, retry patterns. Use when implementing phone verification flows. Supports Supabase and custom backends.From its SKILL.md
npx -y skills add launch52-ai/flutter-template --skill phone-authAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- runs commandsInstructs the agent to run 1 command, including `dart run build_runner build`.
SKILL.md
3.7 KB, 854 tokens by cl100k_base, as published. Nobody here has run it
Phone Auth - Phone OTP Authentication
Phone number OTP authentication with Clean Architecture. Backend handles security (OTP generation, rate limiting). Mobile handles UX (formatting, countdown, error display).
When to Use This Skill
- Adding phone number login/signup to a Flutter app
- Implementing OTP verification flows
- User asks to "add phone auth", "phone login", or "OTP verification"
Questions to Ask
- Backend type: Supabase or Custom API?
- Countries data: Local JSON (faster) or Backend API (dynamic)?
Responsibilities
| Mobile | Backend |
|---|---|
| Display country picker | OTP generation (cryptographic) |
| Format phone input | OTP storage (hashed) |
| Convert to E.164 | Rate limiting |
| Show countdown timer | Expiration checking |
| Display errors | Attempt counting |
| Call backend APIs | User auth/creation |
Reference Files
reference/
├── models/ # Country model (Freezed)
├── utils/ # Phone formatting, E.164 conversion
├── repositories/ # Domain interface + mock
├── providers/ # Riverpod notifier + state
└── failures/ # Sealed Failure types
See: implementation-guide.md for complete file list and copy instructions.
Workflow
- Copy
data/countries.jsontoassets/data/ - Copy reference files to project (see implementation-guide.md)
- Implement repository (Supabase or API) - see implementation-guide.md
- Register provider in
lib/core/providers.dart - Run
dart run build_runner build - Use
/designfor UI components
Core API
// Format and convert
final e164 = PhoneFormatUtils.toE164(localNumber, country);
// Send OTP
await repository.sendOtp(e164);
// Verify OTP
await repository.verifyOtp(phoneNumber, otp);
Failure Types
| Type | When | UI Action |
|---|---|---|
InvalidPhoneFailure | Bad format | Validation error |
RateLimitFailure(retryAfter) | Too many sends | Countdown |
InvalidOtpFailure(remaining) | Wrong OTP | Show attempts |
OtpExpiredFailure | OTP timed out | Resend option |
MaxAttemptsFailure | 3+ failures | Force new OTP |
PhoneAuthNetworkFailure | Connection | Retry button |
Retry Pattern
Escalating intervals: 30s → 40s → 60s → 90s → 120s
See reference/providers/phone_auth_providers.dart for configuration.
Guides
| File | Content |
|---|---|
| implementation-guide.md | Step-by-step with Supabase + API examples |
| best-practices-guide.md | Security, UX patterns |
| phone-formats-guide.md | E.164, country formats |
| checklist.md | Implementation verification |
Checklist
-
countries.jsoncopied toassets/data/ - PhoneAuthRepository interface extends base AuthRepository
-
sendOtp(e164PhoneNumber)andverifyOtp(phone, otp)implemented - PhoneFormatUtils handles E.164 conversion
- All Failure types implemented (InvalidPhone, RateLimit, InvalidOtp, etc.)
- Retry intervals configured (30s → 40s → 60s → 90s → 120s)
- Provider registered in
lib/core/providers.dart -
build_runnerexecuted successfully - Error messages use i18n keys
Related Skills
/social-login- Can combine with phone auth/design- Phone input and OTP UI components/i18n- Localized error messages/testing- Unit and widget tests
What ships with it: 16 files
69.2 KB alongside SKILL.md
data/
- countries.json19.9 KB
reference/
- exceptions/phone_auth_exceptions.dart1.3 KB
- failures/phone_auth_failures.dart3.6 KB
- models/country.dart2.5 KB
- providers/phone_auth_provider.dart3.6 KB
- providers/phone_auth_providers.dart3.0 KB
- providers/phone_auth_state.dart1.8 KB
- repositories/mock_phone_auth_repository.dart5.7 KB
- repositories/phone_auth_repository.dart3.3 KB
- utils/countries_data.dart2.3 KB
- utils/phone_format_utils.dart2.5 KB
- utils/phone_number_formatter.dart2.1 KB
- best-practices-guide.md2.3 KB
- checklist.md6.6 KB
- implementation-guide.md6.6 KB
- phone-formats-guide.md1.9 KB