Claude Code Plugins

Community-maintained marketplace

Feedback
5
0

Better-auth integration for authentication. Use when implementing login, registration, protected routes, or email verification.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name auth-patterns
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/command for protected endpoints
  • Email verification required before login
  • Commands cannot redirect - use client-side goto()

Reference Files