迁移和代码生成命令执行未固定版本的远程 CLI
原文依据:4 处工作流反复使用 `npx auth@latest`。`npx` 可能下载并执行当时发布的最新 CLI,而不是项目锁文件中的 Better Auth 版本。这也与本 Skill 自己要求匹配已安装版本的原则不一致。
若最新版被破坏、供应链受损或与项目版本不兼容,它会在开发者权限下执行,并可能生成错误架构或实施不兼容迁移。
Skill 要求文档与项目安装版本匹配,却在迁移和生成步骤中指定 `auth@latest`。这可能让最新版 CLI 针对旧版运行并修改数据库或生成文件。用户可要求所有 CLI 命令采用解析出的兼容版本,而不是 `latest`。
Use documentation that matches the Better Auth version installed in the project. APIs and plugin names can differ across maintained release lines.1. Prefer a version explicitly named by the user.2. Otherwise, inspect the resolved `better-auth` version in the lockfile, falling back to the package manifest when no lockfile is available.3. When the Better Auth MCP is available, call `get_doc` with `/llms.txt` to resolve that package version to a documentation identifier. Pass the identifier to every `search_docs` call and pass result paths to `get_doc` unchanged.4. Without MCP, start at [better-auth.com/llms.txt](https://better-auth.com/llms.txt) and follow the matching version index.5. Use the latest documentation only when the project version cannot be determined or the user explicitly asks about the latest release or an upgrade.查看另外 3 个位置
4. Create route handler for your framework5. Run migrations: - **Built-in adapter:** `npx auth@latest migrate` - **Drizzle:** `npx auth@latest generate --output src/db/auth-schema.ts` then `npx drizzle-kit push` (dev) or `npx drizzle-kit generate && npx drizzle-kit migrate` (prod) - **Prisma:** `npx auth@latest generate --output prisma/schema.prisma` then `npx prisma migrate dev`6. Verify: call `GET /api/auth/ok` — should return `{ status: "ok" }`1. Prefer a version explicitly named by the user.2. Otherwise, inspect the resolved `better-auth` version in the lockfile, falling back to the package manifest when no lockfile is available.3. When the Better Auth MCP is available, call `get_doc` with `/llms.txt` to resolve that package version to a documentation identifier. Pass the identifier to every `search_docs` call and pass result paths to `get_doc` unchanged.5. Run migrations: - **Built-in adapter:** `npx auth@latest migrate` - **Drizzle:** `npx auth@latest generate --output src/db/auth-schema.ts` then `npx drizzle-kit push` (dev) or `npx drizzle-kit generate && npx drizzle-kit migrate` (prod) - **Prisma:** `npx auth@latest generate --output prisma/schema.prisma` then `npx prisma migrate dev`6. Verify: call `GET /api/auth/ok` — should return `{ status: "ok" }`