auth-patterns
CommunitySecure your app with robust authentication, effortlessly.
System Documentation
What problem does it solve?
This Skill simplifies the implementation of secure authentication flows using better-auth with SvelteKit remote functions. It handles complex aspects like user registration, login, protected routes, email verification, and social logins (e.g., GitHub OAuth), reducing the boilerplate and security risks associated with building auth from scratch.
Core Features & Use Cases
- Email/Password Authentication: Provides patterns for user registration, login, and password management, including robust validation.
- Protected Endpoints: Secures server-side queries, forms, and commands, ensuring only authenticated users can access sensitive data or perform actions.
- Email Verification: Implements a complete email verification flow, including sending verification emails and handling unverified user login attempts.
- Social Login Integration: Guides on integrating GitHub OAuth for seamless user onboarding and profile data synchronization.
- Use Case: Build a SaaS application where users need to register, log in, and access personalized dashboards. This Skill provides the complete authentication framework, including email verification to prevent spam accounts and protected routes to secure user data, allowing you to focus on core features.
Quick Start
Configure better-auth with your database, email service (Resend), and social providers (GitHub).
Use form() for login/registration, ensuring redirect(303, '/dashboard') is outside try/catch.
Protect server functions using guarded_query(), guarded_form(), or guarded_command() helpers.
For logout, use a command() and handle client-side navigation with goto('/login').
Dependency Matrix
Required Modules
Components
💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: auth-patterns Download link: https://github.com/spences10/devhub-crm/archive/main.zip#auth-patterns Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.