Better Auth organizations

Sets up the Better Auth organization plugin: creation limits, active organization, members, invitations, roles and permissions, teams, dynamic access control, hooks and owner and deletion safeguards. Use when building multi-tenant workspaces on Better Auth.

SecurityPack: Better Auth skillslinkbetter-auth-organization
Author
Source
better-auth/skills/better-auth/organization @ 20c9e88
License
none stated

About this skill

What it does

The skill sets up Better Auth's organization plugin for multi-tenant apps: server and client plugin, a migration, then a check that the organization, member and invitation tables exist. Who may create organizations, and how many, can be a function of the user; an admin can create one for another user on the server. The creator becomes owner. The active organization sits in the session and scopes later calls such as listMembers and inviteMember.

Members are added on the server, with one role or several, or invited from the client. Invitations go out through your sendInvitationEmail or as a link from getInvitationURL that you deliver yourself; they expire after 48 hours by default and only the invited address can accept. Roles are owner, admin and member. Permission checks go through the hasPermission endpoint; checkRolePermission is a static check for drawing the UI. Optional: teams, dynamic access control with roles created at runtime, lifecycle hooks, and renamed tables or extra fields.

Safeguards: the last owner cannot be removed, leave or lose the role, so ownership is transferred first. Deleting an organization removes its members, invitations and teams; disableOrganizationDeletion, or a beforeDelete hook that archives and throws, prevents that. The folder holds only SKILL.md.

When to use it, and when not

Use it for B2B workspaces, team accounts and per-tenant roles on Better Auth.

App-wide admin roles belong to the admin plugin, which is not covered here. On Neon's Managed Better Auth the plugin is Partial / Beta: members, invitations and the three default roles, but no teams, server hooks, custom roles or dynamic access control.

How to run it

We do not copy this skill: the author's repository has no licence. Install it from there with the button to the source. The Claude Code plugin in the repository's .claude-plugin/marketplace.json (auth-skills) carries only create-auth and best-practices, so copy the better-auth/organization folder into your agent's skills directory. The name is organization-best-practices:

  • Claude Code: /organization-best-practices, or ask for the skill by name.
  • Codex: $organization-best-practices.
  • Cursor: type / in the Agent chat and pick organization-best-practices.

Example: /organization-best-practices Add workspaces with email invitations, a custom "billing" role and at most three workspaces per free user.

How it differs from similar skills

Neon Auth offers the managed subset described above. Add authentication with Better Auth switches organizations on during setup and stops there. Security review checks the result from the other side, looking for routes and object access without an ownership check. Apart from these, no skill in our catalog builds organizations with members, invitations and roles.

Install

This skill is not copied to the catalog: the author's repository has no licence text. Install it from there.

Open the source

Connect through AnyModel API

This skill runs on whatever model your agent uses. Point Claude Code, Codex or Cursor at AnyModel to run it on Claude, GPT, Gemini and more with one key — pay per token, no subscription.

More from the pack Better Auth skills