← Back to list

auth-patterns
by spences10
⭐ 6🍴 0📅 Jan 21, 2026
SKILL.md
name: auth-patterns
prettier-ignore
description: Better-auth integration for authentication. Use when implementing login, registration, protected routes, or email verification.
Auth Patterns
Quick Pattern
// Login form
export const login = form(schema, async ({ email, password }) => {
const event = getRequestEvent();
await auth.api.signInEmail({
body: { email, password },
headers: event.request.headers,
});
redirect(303, '/dashboard'); // Outside try/catch
});
// Protected query
export const get_data = guarded_query(() => {
return { message: 'Protected data' };
});
Core Principles
- Use
getRequestEvent()for headers (cookie access) - Redirect MUST be outside try/catch (throws error)
- Use
guarded_query/form/commandfor protected endpoints - Email verification required before login
- Commands cannot redirect - use client-side
goto()
Reference Files
- auth-setup.md - Complete better-auth configuration
- auth-usage.md - All auth patterns and examples
- email-verification.md - Email verification flow
Score
Total Score
50/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon