name: better-auth-llms description: Implement Better Auth flows from official LLM/docs guidance with CLI-first schema updates, organization+teams, invitation redirects, and permission-aware UI.
Better Auth LLM Skill
Primary references:
- https://better-auth.com/llms.txt
- https://better-auth.com/docs/plugins/organization
- https://better-auth.com/docs/concepts/oauth
Non-Negotiables
- Use Better Auth APIs/plugins, not custom auth logic.
- Use Better Auth CLI for auth schema/table changes before manual edits.
- Preserve invitation callback context across login/signup/OAuth.
- Use Better Auth permissions/roles to gate org management UI.
- Prefer active org/team context (avoid forcing orgId in routes).
- Surface Better Auth error messages/codes in UI handling.
CLI-first Workflow
Run these first for auth schema/plugin changes:
npx @better-auth/cli generate --config src/lib/auth.ts --output src/db/schema.ts
npx @better-auth/cli migrate --config src/lib/auth.ts
Organization + Teams Checklist
- Enable server plugin:
organization({ teams: { enabled: true } })
- Enable client plugin:
organizationClient({ teams: { enabled: true } })
- Integrate team endpoints where relevant:
createTeam,listTeams,updateTeam,removeTeamaddTeamMember,removeTeamMember- invitation
teamIdassignment
- Hide org-management surfaces for non-manager roles (
member).
Redirect & Invitation Checklist
- Logged-in user on
/loginor/signupshould redirect immediately. - Preserve
callbackUrlandinvitationIdacross auth entrypoints. - For invitation acceptance, send unauthenticated users to auth with callback back to the invitation route.
- Verify-email page should not show logged-in-only controls when logged out.