060104 better auth rbac
Multi-domain agent skills collection for AI coding agents (Claude, Cursor, Copilot, OpenCode, and more). Covers programming, biology, cooking, and future domains. Installable via npx skills add.
npx -y skills add natuleadan/skills --skill 060104-better-auth-rbacAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Role-based access control with Better Auth — permission statements, createAccessControl, authorize() checks, dual auth, and frontend permission sync.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
1.1 KB, as published. Nobody here has run it
Better Auth RBAC
When to use
When implementing granular role-based permissions beyond Better Auth's built-in admin plugin roles.
References
| Topic | File |
|---|---|
| Permission statements | references/permission-statements.md |
| Role definitions | references/role-definitions.md |
| Dual auth (API key + session) | references/dual-auth.md |
| Frontend permissions sync | references/frontend-sync.md |
Quick checklist
- Define all permission actions in
customStatementswithas const - Create roles with
ac.newRole({})mapping statements to actions - Check permissions with
roleObj.authorize(permissions) - Admin role always passes (short-circuit before authorize)
- Use
requireApiKeyOrSession()for dual auth (Bearer or cookie) - Frontend: keep
permissions.tsin sync with backend role definitions
Gives 0 of the 12 instructions most auth identity skills give
Counted across 409 of the 410 authors here whose files we hold, read 2026-08-06
- hash passwords with bcrypt or argon2in 53 of 409, across 43 files
- use parameterized queriesin 47 of 409, across 39 files
- load SECRET_KEY from environment variablesin 23 of 409, across 14 files
- validate all input server-sidein 19 of 409, across 11 files
- refresh access tokens before expiryin 17 of 409, across 9 files
- store tokens in httponly cookiesin 17 of 409, across 16 files
- store refresh tokens securelyin 16 of 409, across 6 files
- validate webhook signatures before processingin 15 of 409, across 5 files
- sanitize user inputsin 15 of 409, across 9 files
- implement rate limiting on auth endpointsin 14 of 409, across 9 files
- encrypt sensitive data at restin 13 of 409, across 10 files
- validate uploaded file extensions and sizesin 12 of 409, across 5 files
Said here and by no other author read
- define all permission actions using customStatements with as const
- create roles mapping statements to allowed actions
- check permissions using roleObj.authorize
- short-circuit authorization for the admin role
- use requireApiKeyOrSession for dual authentication
- keep frontend permissions synced with backend role definitions
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.