← Back to list

better-auth-core
by bobmatnyc
Curated collection of Claude Code skills for intelligent project development with progressive loading and toolchain detection
⭐ 7🍴 2📅 Jan 22, 2026
SKILL.md
name: better-auth-core description: Better Auth core setup for TypeScript apps. Use when configuring the Better Auth instance, wiring server handlers and client instances, working with sessions, or calling server-side auth APIs. progressive_disclosure: entry_point: summary: "Better Auth core setup for TypeScript apps. Use when configuring the Better Auth instance, wiring server handlers and client instances, working with sessions, or calling server-side auth APIs." when_to_use: "When implementing authentication, authorization, or security." quick_start: "1. Review the core concepts below. 2. Apply patterns to your use case. 3. Follow best practices for implementation." references: - client-server.md - setup-database.md - typescript.md
Better Auth Core (TypeScript)
Goals
- Set up a Better Auth instance with environment variables and data layer wiring.
- Wire server handlers and a client instance.
- Use sessions and server-side API methods safely.
- Keep data-layer choices pluggable (drivers or adapters).
Quick start
- Install
better-auth. - Set
BETTER_AUTH_SECRET(32+ chars) andBETTER_AUTH_URL. - Create
auth.tsand exportauth. - Provide
database(driver or adapter) or omit for stateless sessions. - Mount a handler (
auth.handleror a framework helper). - Create a client with
createAuthClient.
import { betterAuth } from "better-auth";
export const auth = betterAuth({
database: myDatabaseOrAdapter, // driver or adapter; omit for stateless mode
emailAndPassword: { enabled: true },
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID as string,
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
},
},
});
Core setup checklist
- Export the instance as
auth(or default export) so helpers find it. - Keep
BETTER_AUTH_URLin sync with the public base URL. - Pass the full base URL to the client if you change the
/api/authbase path. - Add database migrations before enabling plugins that require tables.
Server API usage
- Call server endpoints via
auth.api.*with{ body, headers, query }. - Use
asResponse: trueif you need aResponseobject. - Use
returnHeaders: trueto accessSet-Cookieheaders.
import { auth } from "./auth";
const session = await auth.api.getSession({
headers: request.headers,
});
const response = await auth.api.signInEmail({
body: { email, password },
asResponse: true,
});
Session access
- Client:
authClient.useSession()orauthClient.getSession(). - Server:
auth.api.getSession({ headers }).
TypeScript tips
- Infer types with
auth.$InferandauthClient.$Infer. - Use
inferAdditionalFieldson the client when you extend the user schema.
References
toolchains/platforms/auth/better-auth/better-auth-core/references/setup-database.mdtoolchains/platforms/auth/better-auth/better-auth-core/references/client-server.mdtoolchains/platforms/auth/better-auth/better-auth-core/references/typescript.md
Score
Total Score
70/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
✓説明文
100文字以上の説明がある
+10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon