This walks you through the Better Auth setup in TypeScript apps: wiring up the server instance with your database driver or adapter, mounting handlers, creating the client, and working with sessions. You'll configure environment variables, set up social or email/password auth, and call server-side APIs with the right headers. The skill pushes you toward a clean separation between client and server, keeps the data layer pluggable, and includes TypeScript inference helpers. It's practical if you're adding authentication to a full-stack TypeScript project and want the plumbing done correctly without hunting through docs.

skills.sh installs
368
GitHub stars
79
last updated
Aug 21, 2026

Install

$ npx -y skills add bobmatnyc/claude-mpm-skills --skill better-auth-core --agent claude-code

Installs into .claude/skills of the current project.

Files

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

  1. Install better-auth.
  2. Set BETTER_AUTH_SECRET (32+ chars) and BETTER_AUTH_URL.
  3. Create auth.ts and export auth.
  4. Provide database (driver or adapter) or omit for stateless sessions.
  5. Mount a handler (auth.handler or a framework helper).
  6. 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,
    },
  },
});

Sponsors

Details

Repository
github.com/bobmatnyc/claude-mpm-skills
Category
Backend & APIs
First seen
Jun 3, 2026

More from bobmatnyc/claude-mpm-skills

All 158
1bobmatnyc avatarbetter-auth-pluginsbobmatnyc/claude-mpm-skillsBetter Auth plugin system for TypeScript. Use when adding advanced auth features (2FA, magic link, passkey, username, JWT, organizations) via server and client 362skills.sh installs
2davila7 avatarbiorxiv-databasedavila7/claude-code-templatesEfficient database search tool for bioRxiv preprint server. Use this skill when searching for life sciences preprints by keywords, authors, date ranges, or cate358skills.sh installs
3secondsky avatarbun-drizzle-integrationsecondsky/claude-skillsUse when integrating Drizzle ORM with Bun's SQLite driver for type-safe schema definitions and migrations.353skills.sh installs
4jezweb avataremail-gatewayjezweb/claude-skillsMulti-provider email sending for Cloudflare Workers and Node.js applications. Build transactional email systems with Resend (React Email support), SendGrid (ent342skills.sh installs
5bobmatnyc avatargraphqlbobmatnyc/claude-mpm-skillsGraphQL query language and runtime for APIs enabling clients to request exactly the data they need with strongly-typed schemas and single endpoint architecture.340skills.sh installs
6secondsky avatarbun-http-serversecondsky/claude-skillsUse when building HTTP servers with Bun.serve, handling requests/responses, implementing routing, creating REST APIs, or configuring fetch handlers.336skills.sh installs