agentleFS
launch52-ailaunch52-ai/flutter-template/.claude/skills/local-auth/SKILL.md

local-auth

Skill2 starsChanged 9 months agoMITView on GitHub

Local device authentication (biometric + device credentials). App unlock with configurable timeout, biometric change detection, optional app PIN, optional lock screen UI. Use when adding biometric login, app unlock, or secure action confirmation.

We split this skill into the rules it gives an agent

16 rules. About 0 are common, 5 are distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Remote authentication: - Use /auth, /social-login, /phone-auth

    line 20
  2. Distinctive:

    Before generating code, ask these questions:

    line 26
  3. Distinctive:

    Ask all questions from "Questions to Ask" section before proceeding.

    line 76
  4. Very specific:

    Create LocalAuthService in lib/core/services/

    line 86
  5. Very specific:

    Create LocalAuthNotifier + state in lib/core/providers/

    line 87
  6. Very specific:

    Create LocalAuthSettings for preferences

    line 88
  7. Very specific:

    Lock screen: Create LockScreen widget

    line 93
  8. Very specific:

    Settings toggle: Create LocalAuthToggle widget

    line 94
  9. Very specific:

    App PIN: Create AppPinService and PIN entry UI

    line 95
  10. Distinctive:

    Banking security: Add biometric state tracking

    line 96
  11. Very specific:

    Add WidgetsBindingObserver for app lifecycle

    line 100
  12. Distinctive:

    After running this skill:

    line 194
  13. Distinctive:

    Test on real device (simulators have limitations)

    line 195
  14. Very specific:

    Run /i18n for auth prompt strings

    line 196
  15. Very specific:

    Run /design for lock screen polish

    line 197
  16. Very specific:

    Run /testing for auth flow tests

    line 198

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Local Auth - Device Authentication

Local device authentication using biometrics (Face ID, Touch ID, fingerprint) and device credentials (PIN, pattern, password). Configurable security levels from basic to banking-grade.

When to Use This Skill

  • Adding biometric/device unlock to an app
  • Implementing app lock after background timeout
  • Securing sensitive actions (payments, delete, view PII)
  • User asks "biometric", "face id", "fingerprint", "app lock", "local auth"

When NOT to Use This Skill

  • Remote authentication - Use /auth, /social-login, /phone-auth
  • Session tokens - Handled by /auth and /data
  • Secure storage - Already in /core (flutter_secure_storage)

Questions to Ask

Before generating code, ask these questions:

  1. Use case: App unlock after timeout OR sensitive action confirmation OR both?
  2. Security level: Trust device (simple) OR detect biometric changes (banking-grade)?
  3. Lock screen: Generate lock screen UI OR service only?
  4. Settings toggle: Generate enable/disable toggle widget?
  5. App PIN: Include app-level PIN for devices without lock screen?
  6. Timeout: How long in background before requiring re-auth? (0 = immediate)
  7. Failure behavior: Force full re-login OR let device handle lockout?

Quick Reference

Dependencies

dependencies:
  local_auth: ^2.3.0

Security Levels

LevelBiometric ChangeUse Case
SimpleTrust any enrolled biometricSocial apps, low-risk
BankingDetect changes, require re-loginFinance, health, PII

Authentication Options

OptioniOSAndroid
Face ID / Face UnlockYesYes
Touch ID / FingerprintYesYes
PasscodeYesYes
PIN / PatternN/AYes

Core Components

ComponentPurpose
LocalAuthServiceWraps local_auth, handles platform checks
LocalAuthNotifierState management, timeout tracking
LocalAuthSettingsUser preferences (enabled, timeout)
LockScreenOptional full-screen auth prompt
LocalAuthToggleOptional settings widget
AppPinServiceOptional app-level PIN (no device lock)

Workflow

Phase 1: Gather Requirements

Ask all questions from "Questions to Ask" section before proceeding.

Phase 2: Platform Setup

  1. iOS: Add NSFaceIDUsageDescription to Info.plist
  2. Android: Add USE_BIOMETRIC permission to AndroidManifest.xml
  3. Run flutter pub get

Phase 3: Create Core Files

  1. Create LocalAuthService in lib/core/services/
  2. Create LocalAuthNotifier + state in lib/core/providers/
  3. Create LocalAuthSettings for preferences

Phase 4: Optional Components

Based on user answers:

  • Lock screen: Create LockScreen widget
  • Settings toggle: Create LocalAuthToggle widget
  • App PIN: Create AppPinService and PIN entry UI
  • Banking security: Add biometric state tracking

Phase 5: Integration

  1. Add WidgetsBindingObserver for app lifecycle
  2. Configure timeout-based re-auth
  3. Wrap sensitive actions with auth check

Phase 6: Verify

dart run .claude/skills/local-auth/scripts/check.dart

Core API

// Check availability
final canAuth = await localAuthService.canAuthenticate();

// Authenticate (biometricOnly: false allows PIN/pattern fallback)
final result = await localAuthService.authenticate(reason: 'Unlock');

See: reference/services/local_auth_service.dart for full API.

File Structure

lib/core/
├── services/local_auth_service.dart    # Core service
├── providers/local_auth_provider.dart  # Notifier + settings
└── widgets/lock_screen.dart            # Optional UI

See: checklist.md for full file list with optional components.

Failure Types

TypeWhenUI Action
LocalAuthNotAvailableNo biometric/lock enrolledShow setup prompt
LocalAuthNotEnrolledBiometric not set upShow settings link
LocalAuthFailedUser failed authRetry or fallback
LocalAuthCancelledUser cancelledSilent (not error)
BiometricsChangedFingerprint/face changedForce full re-login
LocalAuthLockoutToo many failuresShow countdown/message

Guides

FileContent
setup-guide.mdPlatform setup (iOS/Android)
security-guide.mdSecurity levels, biometric change detection
patterns-guide.mdUsage patterns, timeout, lifecycle
troubleshooting-guide.mdCommon issues and solutions
checklist.mdVerification checklist

Reference Files

See: reference/ directory for complete implementations (services, providers, widgets, utils).

Checklist

Platform Setup:

  • local_auth: ^2.3.0 added to pubspec.yaml
  • iOS: NSFaceIDUsageDescription in Info.plist
  • Android: USE_BIOMETRIC permission in AndroidManifest.xml
  • flutter pub get run successfully

Core Implementation:

  • LocalAuthService created with availability checks
  • LocalAuthNotifier manages auth state
  • LocalAuthSettings stores user preferences
  • App lifecycle observer tracks background time

Optional Components:

  • Lock screen UI (if requested)
  • Settings toggle widget (if requested)
  • App PIN service (if requested)
  • Biometric change detection (if banking-grade)

Testing:

  • Biometric auth works on real device
  • Device credential fallback works
  • Timeout triggers re-auth correctly
  • Cancellation handled silently

Related Skills

  • /auth - Base authentication (this extends it for local unlock)
  • /social-login, /phone-auth - Remote auth methods
  • /design - Lock screen UI patterns
  • /i18n - Localized auth prompts
  • /testing - Test local auth flows

Next Steps

After running this skill:

  1. Test on real device (simulators have limitations)
  2. Run /i18n for auth prompt strings
  3. Run /design for lock screen polish
  4. Run /testing for auth flow tests

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.