Skip to content
Back to skills

Auth Patterns 1

ASecurity

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

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
developmenttypescriptgoapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill auth-patterns-1 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Auth Patterns 1?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Auth Patterns 1
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-auth-patterns-1/badge)](https://www.skillsdirectory.com/skills/david-li0406-auth-patterns-1)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
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

```typescript
// 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

- [auth-setup.md](references/auth-setup.md) - Complete better-auth
  configuration
- [auth-usage.md](references/auth-usage.md) - All auth patterns and
  examples
- [email-verification.md](references/email-verification.md) - Email
  verification flow

Files in this skill

  • README.md456 B
  • SKILL.md1.1 KB
  • references/auth-setup.md8.4 KB
  • references/auth-usage.md9 KB
  • references/email-verification.md4.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…