better-auth-authentication — скилл для Claude Code: вход и OAuth
Скилл для TypeScript-приложений: помогает настроить вход по email и паролю, социальные провайдеры и проверку почты.
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a claude-codeЧто делает better-auth-authentication
Скилл описывает, как собрать аутентификацию на Better Auth в TypeScript-проекте. Внутри — быстрый старт из трёх шагов: включить emailAndPassword, задать socialProviders, создать клиент через createAuthClient. Дальше на клиенте вызываются signUp.email, signIn.email, signIn.social и signOut.
Отдельный раздел про подтверждение почты. Чтобы отправлять ссылку, нужен emailVerification.sendVerificationEmail, а emailAndPassword.requireEmailVerification заставляет пользователя подтвердить адрес до входа. Для OAuth-провайдеров в socialProviders прописываются их ключи, а signIn.social запускает поток; редиректы задаются через callbackURL, errorCallbackURL и newUserCallbackURL.
Есть и ограничения. Методы клиента вызывай только на клиенте, секреты держи в серверных переменных окружения. Для GitHub-провайдера в примере нужны GITHUB_CLIENT_ID и GITHUB_CLIENT_SECRET — без них вход через GitHub не заработает. Постоянные сессии на входе по паролю включает rememberMe. Скилл помечен как user-invocable: false, то есть напрямую его не вызвать.
Какие задачи решает
- включить вход по email и паролю в TypeScript-приложении
- подключить GitHub как OAuth-провайдер
- отправлять письмо со ссылкой подтверждения адреса
- запретить вход до подтверждения почты
- настроить редиректы после входа и при ошибке
Примеры запросов агенту
- Настрой вход по email и паролю через Better Auth в моём TypeScript-проекте
- Добавь вход через GitHub и редирект на /dashboard после успеха
- Сделай обязательное подтверждение почты перед входом
Как установить better-auth-authentication
1Через Skills CLI (Vercel)
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a claude-code2Вручную: положить файлы
~/.claude/skills/better-auth-authentication/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/better-auth-authentication/
1Через Skills CLI (Vercel)
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a codex2Вручную: положить файлы
.agents/skills/better-auth-authentication/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a cursor2Вручную: положить файлы
.cursor/skills/better-auth-authentication/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install bobmatnyc/claude-mpm-skills better-auth-authentication2Вручную: положить файлы
.github/skills/better-auth-authentication/SKILL.md1Через Skills CLI (Vercel)
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a gemini-cli2Командой платформы
gemini skills install https://github.com/bobmatnyc/claude-mpm-skills --path toolchains/platforms/auth/better-auth/better-auth-authenticationВручную: положить файлы
.devin/skills/better-auth-authentication/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о better-auth-authentication
Как установить better-auth-authentication в Claude?
Выполни npx skills add bobmatnyc/claude-mpm-skills --skill better-auth-authentication -a claude-code. Файл скилла окажется по пути ~/.claude/skills/better-auth-authentication/SKILL.md.
Что делает better-auth-authentication?
Описывает настройку Better Auth: вход по email и паролю, социальные провайдеры, регистрация, выход и подтверждение почты. Плюс правила про секреты и вызовы клиентских методов.
Что нужно для работы скилла?
TypeScript-проект с Better Auth. Для GitHub-провайдера понадобятся GITHUB_CLIENT_ID и GITHUB_CLIENT_SECRET в серверных переменных окружения.
Исходный текст
SKILL.md · MIT
---
name: better-auth-authentication
description: Better Auth authentication flows for TypeScript apps. Use when enabling email/password auth, configuring social providers, or implementing sign-up, sign-in, and verification flows.
user-invocable: false
disable-model-invocation: true
progressive_disclosure:
entry_point:
summary: "Better Auth authentication flows for TypeScript apps. Use when enabling email/password auth, configuring social providers, or implementing sign-up, sign-in, and verification flows."
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:
- email-password.md
- providers.md
---
# Better Auth Authentication
## Goals
- Enable email/password authentication and social providers.
- Implement sign-up, sign-in, sign-out, and verification flows.
- Handle redirects and errors consistently.
## Quick start
1. Enable `emailAndPassword` and configure `socialProviders`.
2. Create a client with `createAuthClient`.
3. Use `signUp.email`, `signIn.email`, `signIn.social`, and `signOut` on the client.
```ts
import { betterAuth } from "better-auth";
export const auth = betterAuth({
emailAndPassword: { enabled: true },
socialProviders: {
github: {
clientId: process.env.GITHUB_CLIENT_ID as string,
clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
},
},
});
```
```ts
import { createAuthClient } from "better-auth/client";
const authClient = createAuthClient();
await authClient.signUp.email({
email,
password,
name,
});
await authClient.signIn.email({
email,
password,
callbackURL: "/dashboard",
});
await authClient.signIn.social({
provider: "github",
callbackURL: "/dashboard",
});
await authClient.signOut();
```
## Email verification
- Provide `emailVerification.sendVerificationEmail` to send the verification link.
- Use `emailAndPassword.requireEmailVerification` to enforce verification before sign-in.
## Social providers
- Configure providers in `socialProviders` with provider-specific credentials.
- Use `signIn.social` to start OAuth flows.
- Pass `callbackURL`, `errorCallbackURL`, and `newUserCallbackURL` for redirects.
## Guardrails
- Call client methods from the client only.
- Keep secrets in server-only env variables.
- Use `rememberMe` to control persistent sessions on email/password sign-in.
## References
- `toolchains/platforms/auth/better-auth/better-auth-authentication/references/email-password.md`
- `toolchains/platforms/auth/better-auth/better-auth-authentication/references/providers.md`
© bobmatnyc · MIT · bobmatnyc/claude-mpm-skills