用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/ForceInjection/domain-driven-design-skills --skill create-auth-skill命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | Create Auth Skill |
| description | A skill to create auth service for new applications. |
A user could ask you to create authentication and authorization layers for their TypeScript/JavaScript applications.
User task -> Do we start from a empty project?
├─ Yes → Create a new project with authentication scaffolding
│ ├─ Choose web framework: React, Next.js, Express, etc.
│ ├─ Select database: PostgreSQL, MongoDB, etc.
│ ├─ Set up auth using @better-auth/cli
│ └─ Customize auth flows as per user requirements, like OAuth, JWT, Organization, Admin...
│
└─ No → Is the existing project already have authentication?
├─ Yes → Review existing auth implementation
│ ├─ Identify gaps or improvements needed
│ ├─ Read document for missing features from `better-auth`
│ └─ Test and validate the updated auth flows
│
└─ No → Analyze the existing project structure
├─ Choose appropriate auth strategy
├─ Integrate `better-auth` into the existing codebase
└─ Implement and test the new authentication flows
You can read templates/nextjs to see a complete example of a Next.js app integrated with Better Auth.
In this example, you can see the most two essential files, auth.ts and auth-client.ts.
import { betterAuth } from 'better-auth'
import Database from 'better-sqlite3'
export const auth = betterAuth({
database: new Database('./auth.db'),
baseURL: 'http://localhost:3000',
plugins: [],
emailAndPassword: {
enabled: true
}
})
import { createAuthClient } from "better-auth/react";
export const authClient = createAuthClient();
In this example, it doesn't include any plugins, but you can easily add plugins by importing them from
better-auth/plugins and adding them to the plugins array in the betterAuth configuration.
Also you will need to update auth client to make sure client-side plugins are included.
You can refer to the plugins for more details on how to set up and customize your authentication flows.
To use better-auth, install these dependencies only if they aren't already present in package.json:
npm install better-auth
@better-auth/cli: See cli for details on how to use the CLI tool. Examples: See examples for complete example projects using better-auth, including astro, browser-extension, next.js, nuxt, svelte and tanstack.