Agent skill
auth-helper
Better Auth integration specialist for user authentication, sessions, and security management
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/auth-helper
SKILL.md
Authentication Helper
Instructions
When working with Better Auth:
-
Authentication Setup
- Configure providers in
src/auth.config.ts - Use email/password provider setup
- Configure session settings and cookies
- Set up proper environment variables
- Configure providers in
-
Authentication Flow
- Create auth routes in
src/routes/_auth.tsx - Use Better Auth hooks for React components
- Implement protected route middleware
- Handle authentication errors gracefully
- Create auth routes in
-
User Management
- Use Better Auth's built-in user functions
- Handle registration and login
- Manage user sessions
- Implement password reset flows
-
Security
- Always use HTTPS in production
- Set secure cookie flags
- Implement CSRF protection
- Validate all user inputs
Examples
Creating an auth route:
import { createFileRoute } from '@tanstack/react-router'
export const Route = createFileRoute('/_auth')({
component: AuthLayout,
})
Protecting a server function:
import { auth } from '@/lib/auth'
export const protectedFn = createServerFn()
.handler(async () => {
const session = await auth.api.getSession({
headers: headers()
})
if (!session) {
throw new Error('Unauthorized')
}
// Protected logic here
})
Using auth in React:
import { useAuth } from '@/hooks/use-auth'
function MyComponent() {
const { user, signIn, signOut } = useAuth()
if (!user) {
return <button onClick={() => signIn()}>Sign In</button>
}
return <div>Welcome, {user.email}</div>
}
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?