[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77V17MTMDNYN8T7DRPK5H8M":3,"skill-same:01M77V17MTMDNYN8T7DRPK5H8M":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M77V17MTMDNYN8T7DRPK5H8M","organization-best-practices",null,"Configure multi-tenant organizations, manage members and invitations, define custom roles and permissions, set up teams, and implement RBAC using Better Auth's organization plugin. Use when users need org setup, team management, member roles, access control, or the Better Auth organization plugin.","Reihantt6\u002Fsns-myagent","Reihantt6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F219822095?v=4","01M77KK94PV8B7C2D9XWXNS8DJ","Mohamad Reihan tegar prasetya","01M77KK958QFMTHYXGXFV7KZ79",2,"MIT","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Forganization-best-practices\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\ndescription: \"Configure multi-tenant organizations, manage members and invitations, define custom roles and permissions, set up teams, and implement RBAC using Better Auth's organization plugin. Use when users need org setup, team management, member roles, access control, or the Better Auth organization plugin.\"\n---\n## Setup\n\n1. Add `organization()` plugin to server config\n2. Add `organizationClient()` plugin to client config\n3. Run `npx @better-auth\u002Fcli@latest migrate` (built-in adapter) or generate + push for Drizzle\u002FPrisma\n4. Verify: check that organization, member, invitation tables exist in your database\n\n```ts\nimport { betterAuth } from \"better-auth\";\nimport { organization } from \"better-auth\u002Fplugins\";\n\nexport const auth = betterAuth({\n  plugins: [\n    organization({\n      allowUserToCreateOrganization: true,\n      organizationLimit: 5, \u002F\u002F Max orgs per user\n      membershipLimit: 100, \u002F\u002F Max members per org\n    }),\n  ],\n});\n```\n\n### Client-Side Setup\n\n```ts\nimport { createAuthClient } from \"better-auth\u002Fclient\";\nimport { organizationClient } from \"better-auth\u002Fclient\u002Fplugins\";\n\nexport const authClient = createAuthClient({\n  plugins: [organizationClient()],\n});\n```\n\n## Creating Organizations\n\nThe creator is automatically assigned the `owner` role.\n\n```ts\nconst createOrg = async () => {\n  const { data, error } = await authClient.organization.create({\n    name: \"My Company\",\n    slug: \"my-company\",\n    logo: \"https:\u002F\u002Fexample.com\u002Flogo.png\",\n    metadata: { plan: \"pro\" },\n  });\n};\n```\n\n### Controlling Organization Creation\n\nRestrict who can create organizations based on user attributes:\n\n```ts\norganization({\n  allowUserToCreateOrganization: async (user) => {\n    return user.emailVerified === true;\n  },\n  organizationLimit: async (user) => {\n    \u002F\u002F Premium users get more organizations\n    return user.plan === \"premium\" ? 20 : 3;\n  },\n});\n```\n\n### Creating Organizations on Behalf of Users\n\nAdministrators can create organizations for other users (server-side only):\n\n```ts\nawait auth.api.createOrganization({\n  body: {\n    name: \"Client Organization\",\n    slug: \"client-org\",\n    userId: \"user-id-who-will-be-owner\", \u002F\u002F `userId` is required\n  },\n});\n```\n\n**Note**: The `userId` parameter cannot be used alongside session headers.\n\n\n## Active Organizations\n\nStored in the session and scopes subsequent API calls. Set after user selects one.\n\n```ts\nconst setActive = async (organizationId: string) => {\n  const { data, error } = await authClient.organization.setActive({\n    organizationId,\n  });\n};\n```\n\nMany endpoints use the active organization when `organizationId` is not provided (`listMembers`, `listInvitations`, `inviteMember`, etc.).\n\nUse `getFullOrganization()` to retrieve the active org with all members, invitations, and teams.\n\n## Members\n\n### Adding Members (Server-Side)\n\n```ts\nawait auth.api.addMember({\n  body: {\n    userId: \"user-id\",\n    role: \"member\",\n    organizationId: \"org-id\",\n  },\n});\n```\n\nFor client-side member additions, use the invitation system instead.\n\n### Assigning Multiple Roles\n\n```ts\nawait auth.api.addMember({\n  body: {\n    userId: \"user-id\",\n    role: [\"admin\", \"moderator\"],\n    organizationId: \"org-id\",\n  },\n});\n```\n\n### Removing Members\n\nUse `removeMember({ memberIdOrEmail })`. The last owner cannot be removed — assign ownership to another member first.\n\n### Updating Member Roles\n\nUse `updateMemberRole({ memberId, role })`.\n\n### Membership Limits\n\n```ts\norganization({\n  membershipLimit: async (user, organization) => {\n    if (organization.metadata?.plan === \"enterprise\") {\n      return 1000;\n    }\n    return 50;\n  },\n});\n```\n\n## Invitations\n\n### Setting Up Invitation Emails\n\n```ts\nimport { betterAuth } from \"better-auth\";\nimport { organization } from \"better-auth\u002Fplugins\";\nimport { sendEmail } from \".\u002Femail\";\n\nexport const auth = betterAuth({\n  plugins: [\n    organization({\n      sendInvitationEmail: async (data) => {\n        const { email, organization, inviter, invitation } = data;\n\n        await sendEmail({\n          to: email,\n          subject: `Join ${organization.name}`,\n          html: `\n            \u003Cp>${inviter.user.name} invited you to join ${organization.name}\u003C\u002Fp>\n            \u003Ca href=\"https:\u002F\u002Fyourapp.com\u002Faccept-invite?id=${invitation.id}\">\n              Accept Invitation\n            \u003C\u002Fa>\n          `,\n        });\n      },\n    }),\n  ],\n});\n```\n\n### Sending Invitations\n\n```ts\nawait authClient.organization.inviteMember({\n  email: \"newuser@example.com\",\n  role: \"member\",\n});\n```\n\n### Shareable Invitation URLs\n\n```ts\nconst { data } = await authClient.organization.getInvitationURL({\n  email: \"newuser@example.com\",\n  role: \"member\",\n  callbackURL: \"https:\u002F\u002Fyourapp.com\u002Fdashboard\",\n});\n\n\u002F\u002F Share data.url via any channel\n```\n\nThis endpoint does not call `sendInvitationEmail` — handle delivery yourself.\n\n### Invitation Configuration\n\n```ts\norganization({\n  invitationExpiresIn: 60 * 60 * 24 * 7, \u002F\u002F 7 days (default: 48 hours)\n  invitationLimit: 100, \u002F\u002F Max pending invitations per org\n  cancelPendingInvitationsOnReInvite: true, \u002F\u002F Cancel old invites when re-inviting\n});\n```\n\n## Roles & Permissions\n\nDefault roles: `owner` (full access), `admin` (manage members\u002Finvitations\u002Fsettings), `member` (basic access).\n\n### Checking Permissions\n\n```ts\nconst { data } = await authClient.organization.hasPermission({\n  permission: \"member:write\",\n});\n\nif (data?.hasPermission) {\n  \u002F\u002F User can manage members\n}\n```\n\nUse `checkRolePermission({ role, permissions })` for client-side UI rendering (static only). For dynamic access control, use the `hasPermission` endpoint.\n\n## Teams\n\n### Enabling Teams\n\n```ts\nimport { organization } from \"better-auth\u002Fplugins\";\n\nexport const auth = betterAuth({\n  plugins: [\n    organization({\n        teams: {\n            enabled: true\n        }\n    }),\n  ],\n});\n```\n\n### Creating Teams\n\n```ts\nconst { data } = await authClient.organization.createTeam({\n  name: \"Engineering\",\n});\n```\n\n### Managing Team Members\n\nUse `addTeamMember({ teamId, userId })` (member must be in org first) and `removeTeamMember({ teamId, userId })` (stays in org).\n\nSet active team with `setActiveTeam({ teamId })`.\n\n### Team Limits\n\n```ts\norganization({\n  teams: {\n      maximumTeams: 20, \u002F\u002F Max teams per org\n      maximumMembersPerTeam: 50, \u002F\u002F Max members per team\n      allowRemovingAllTeams: false, \u002F\u002F Prevent removing last team\n  }\n});\n```\n\n## Dynamic Access Control\n\n### Enabling Dynamic Access Control\n\n```ts\nimport { organization } from \"better-auth\u002Fplugins\";\nimport { dynamicAccessControl } from \"@better-auth\u002Forganization\u002Faddons\";\n\nexport const auth = betterAuth({\n  plugins: [\n    organization({\n        dynamicAccessControl: {\n            enabled: true\n        }\n    }),\n  ],\n});\n```\n\n### Creating Custom Roles\n\n```ts\nawait authClient.organization.createRole({\n  role: \"moderator\",\n  permission: {\n    member: [\"read\"],\n    invitation: [\"read\"],\n  },\n});\n```\n\nUse `updateRole({ roleId, permission })` and `deleteRole({ roleId })`. Pre-defined roles (owner, admin, member) cannot be deleted. Roles assigned to members cannot be deleted until reassigned.\n\n## Lifecycle Hooks\n\nExecute custom logic at various points in the organization lifecycle:\n\n```ts\norganization({\n  hooks: {\n    organization: {\n      beforeCreate: async ({ data, user }) => {\n        \u002F\u002F Validate or modify data before creation\n        return {\n          data: {\n            ...data,\n            metadata: { ...data.metadata, createdBy: user.id },\n          },\n        };\n      },\n      afterCreate: async ({ organization, member }) => {\n        \u002F\u002F Post-creation logic (e.g., send welcome email, create default resources)\n        await createDefaultResources(organization.id);\n      },\n      beforeDelete: async ({ organization }) => {\n        \u002F\u002F Cleanup before deletion\n        await archiveOrganizationData(organization.id);\n      },\n    },\n    member: {\n      afterCreate: async ({ member, organization }) => {\n        await notifyAdmins(organization.id, `New member joined`);\n      },\n    },\n    invitation: {\n      afterCreate: async ({ invitation, organization, inviter }) => {\n        await logInvitation(invitation);\n      },\n    },\n  },\n});\n```\n\n## Schema Customization\n\nCustomize table names, field names, and add additional fields:\n\n```ts\norganization({\n  schema: {\n    organization: {\n      modelName: \"workspace\", \u002F\u002F Rename table\n      fields: {\n        name: \"workspaceName\", \u002F\u002F Rename fields\n      },\n      additionalFields: {\n        billingId: {\n          type: \"string\",\n          required: false,\n        },\n      },\n    },\n    member: {\n      additionalFields: {\n        department: {\n          type: \"string\",\n          required: false,\n        },\n        title: {\n          type: \"string\",\n          required: false,\n        },\n      },\n    },\n  },\n});\n```\n\n## Security Considerations\n\n### Owner Protection\n\n- The last owner cannot be removed from an organization\n- The last owner cannot leave the organization\n- The owner role cannot be removed from the last owner\n\nAlways ensure ownership transfer before removing the current owner:\n\n```ts\n\u002F\u002F Transfer ownership first\nawait authClient.organization.updateMemberRole({\n  memberId: \"new-owner-member-id\",\n  role: \"owner\",\n});\n\n\u002F\u002F Then the previous owner can be demoted or removed\n```\n\n### Organization Deletion\n\nDeleting an organization removes all associated data (members, invitations, teams). Prevent accidental deletion:\n\n```ts\norganization({\n  disableOrganizationDeletion: true, \u002F\u002F Disable via config\n});\n```\n\nOr implement soft delete via hooks:\n\n```ts\norganization({\n  hooks: {\n    organization: {\n      beforeDelete: async ({ organization }) => {\n        \u002F\u002F Archive instead of delete\n        await archiveOrganization(organization.id);\n        throw new Error(\"Organization archived, not deleted\");\n      },\n    },\n  },\n});\n```\n\n### Invitation Security\n\n- Invitations expire after 48 hours by default\n- Only the invited email address can accept an invitation\n- Pending invitations can be cancelled by organization admins\n\n## Complete Configuration Example\n\n```ts\nimport { betterAuth } from \"better-auth\";\nimport { organization } from \"better-auth\u002Fplugins\";\nimport { sendEmail } from \".\u002Femail\";\n\nexport const auth = betterAuth({\n  plugins: [\n    organization({\n      \u002F\u002F Organization limits\n      allowUserToCreateOrganization: true,\n      organizationLimit: 10,\n      membershipLimit: 100,\n      creatorRole: \"owner\",\n\n      \u002F\u002F Slugs\n      defaultOrganizationIdField: \"slug\",\n\n      \u002F\u002F Invitations\n      invitationExpiresIn: 60 * 60 * 24 * 7, \u002F\u002F 7 days\n      invitationLimit: 50,\n      sendInvitationEmail: async (data) => {\n        await sendEmail({\n          to: data.email,\n          subject: `Join ${data.organization.name}`,\n          html: `\u003Ca href=\"https:\u002F\u002Fapp.com\u002Finvite\u002F${data.invitation.id}\">Accept\u003C\u002Fa>`,\n        });\n      },\n\n      \u002F\u002F Hooks\n      hooks: {\n        organization: {\n          afterCreate: async ({ organization }) => {\n            console.log(`Organization ${organization.name} created`);\n          },\n        },\n      },\n    }),\n  ],\n});\n```\n","## Setup\n\n1. Add `organization()` plugin to server config\n2. Add `organizationClient()` plugin to client config\n3. Run `npx @better-auth\u002Fcli@latest migrate` (built-in adapter) or generate + push for Drizzle\u002FPrisma\n4. Verify: check that organization, member, invitation tables exist in your database\n\n```ts\nimport { betterAuth } from \"better-auth\";\nimport { organization } from \"better-auth\u002Fplugins\";\n\nexport const auth = betterAuth({\n  plugins: [\n    organization({\n      allowUserToCreateOrganization: true,\n      organizationLimit: 5, \u002F\u002F Max orgs per user\n      membershipLimit: 100, \u002F\u002F Max members per org\n    }),\n  ],\n});\n```\n\n### Client-Side Setup\n\n```ts\nimport { createAuthClient } from \"better-auth\u002Fclient\";\nimport { organizationClient } from \"better-auth\u002Fclient\u002Fplugins\";\n\nexport const authClient = createAuthClient({\n  plugins: [organizationClient()],\n});\n```\n\n## Creating Organizations\n\nThe creator is automatically assigned the `owner` role.\n\n```ts\nconst createOrg = async () => {\n  const { data, error } = await authClient.organization.create({\n    name: \"My Company\",\n    slug: \"my-company\",\n    logo: \"https:\u002F\u002Fexample.com\u002Flogo.png\",\n    metadata: { plan: \"pro\" },\n  });\n};\n```\n\n### Controlling Organization Creation\n\nRestrict who can create organizations based on user attributes:\n\n```ts\norganization({\n  allowUserToCreateOrganization: async (user) => {\n    return user.emailVerified === true;\n  },\n  organizationLimit: async (user) => {\n    \u002F\u002F Premium users get more organizations\n    return user.plan === \"premium\" ? 20 : 3;\n  },\n});\n```\n\n### Creating Organizations on Behalf of Users\n\nAdministrators can create organizations for other users (server-side only):\n\n```ts\nawait auth.api.createOrganization({\n  body: {\n    name: \"Client Organization\",\n    slug: \"client-org\",\n    userId: \"user-id-who-will-be-owner\", \u002F\u002F `userId` is required\n  },\n});\n```\n\n**Note**: The `userId` parameter cannot be used alongside session headers.\n\n\n## Active Organizations\n\nStored in the session and scopes subsequent API calls. Set after user selects one.\n\n```ts\nconst setActive = async (organizationId: string) => {\n  const { data, error } = await authClient.organization.setActive({\n    organizationId,\n  });\n};\n```\n\nMany endpoints use the active organization when `organizationId` is not provided (`listMembers`, `listInvitations`, `inviteMember`, etc.).\n\nUse `getFullOrganization()` to retrieve the active org with all members, invitations, and teams.\n\n## Members\n\n### Adding Members (Server-Side)\n\n```ts\nawait auth.api.addMember({\n  body: {\n    userId: \"user-id\",\n    role: \"member\",\n    organizationId: \"org-id\",\n  },\n});\n```\n\nFor client-side member additions, use the invitation system instead.\n\n### Assigning Multiple Roles\n\n```ts\nawait auth.api.addMember({\n  body: {\n    userId: \"user-id\",\n    role: [\"admin\", \"moderator\"],\n    organizationId: \"org-id\",\n  },\n});\n```\n\n### Removing Members\n\nUse `removeMember({ memberIdOrEmail })`. The last owner cannot be removed — assign ownership to another member first.\n\n### Updating Member Roles\n\nUse `updateMemberRole({ memberId, role })`.\n\n### Membership Limits\n\n```ts\norganization({\n  membershipLimit: async (user, organization) => {\n    if (organization.metadata?.plan === \"enterprise\") {\n      return 1000;\n    }\n    return 50;\n  },\n});\n```\n\n## Invitations\n\n### Setting Up Invitation Emails\n\n```ts\nimport { betterAuth } from \"better-auth\";\nimport { organization } from \"better-auth\u002Fplugins\";\nimport { sendEmail } from \".\u002Femail\";\n\nexport const auth = betterAuth({\n  plugins: [\n    organization({\n      sendInvitationEmail: async (data) => {\n        const { email, organization, inviter, invitation } = data;\n\n        await sendEmail({\n          to: email,\n          subject: `Join ${organization.name}`,\n          html: `\n            \u003Cp>${inviter.user.name} invited you to join ${organization.name}\u003C\u002Fp>\n            \u003Ca href=\"https:\u002F\u002Fyourapp.com\u002Faccept-invite?id=${invitation.id}\">\n              Accept Invitation\n            \u003C\u002Fa>\n          `,\n        });\n      },\n    }),\n  ],\n});\n```\n\n### Sending Invitations\n\n```ts\nawait authClient.organization.inviteMember({\n  email: \"newuser@example.com\",\n  role: \"member\",\n});\n```\n\n### Shareable Invitation URLs\n\n```ts\nconst { data } = await authClient.organization.getInvitationURL({\n  email: \"newuser@example.com\",\n  role: \"member\",\n  callbackURL: \"https:\u002F\u002Fyourapp.com\u002Fdashboard\",\n});\n\n\u002F\u002F Share data.url via any channel\n```\n\nThis endpoint does not call `sendInvitationEmail` — handle delivery yourself.\n\n### Invitation Configuration\n\n```ts\norganization({\n  invitationExpiresIn: 60 * 60 * 24 * 7, \u002F\u002F 7 days (default: 48 hours)\n  invitationLimit: 100, \u002F\u002F Max pending invitations per org\n  cancelPendingInvitationsOnReInvite: true, \u002F\u002F Cancel old invites when re-inviting\n});\n```\n\n## Roles & Permissions\n\nDefault roles: `owner` (full access), `admin` (manage members\u002Finvitations\u002Fsettings), `member` (basic access).\n\n### Checking Permissions\n\n```ts\nconst { data } = await authClient.organization.hasPermission({\n  permission: \"member:write\",\n});\n\nif (data?.hasPermission) {\n  \u002F\u002F User can manage members\n}\n```\n\nUse `checkRolePermission({ role, permissions })` for client-side UI rendering (static only). For dynamic access control, use the `hasPermission` endpoint.\n\n## Teams\n\n### Enabling Teams\n\n```ts\nimport { organization } from \"better-auth\u002Fplugins\";\n\nexport const auth = betterAuth({\n  plugins: [\n    organization({\n        teams: {\n            enabled: true\n        }\n    }),\n  ],\n});\n```\n\n### Creating Teams\n\n```ts\nconst { data } = await authClient.organization.createTeam({\n  name: \"Engineering\",\n});\n```\n\n### Managing Team Members\n\nUse `addTeamMember({ teamId, userId })` (member must be in org first) and `removeTeamMember({ teamId, userId })` (stays in org).\n\nSet active team with `setActiveTeam({ teamId })`.\n\n### Team Limits\n\n```ts\norganization({\n  teams: {\n      maximumTeams: 20, \u002F\u002F Max teams per org\n      maximumMembersPerTeam: 50, \u002F\u002F Max members per team\n      allowRemovingAllTeams: false, \u002F\u002F Prevent removing last team\n  }\n});\n```\n\n## Dynamic Access Control\n\n### Enabling Dynamic Access Control\n\n```ts\nimport { organization } from \"better-auth\u002Fplugins\";\nimport { dynamicAccessControl } from \"@better-auth\u002Forganization\u002Faddons\";\n\nexport const auth = betterAuth({\n  plugins: [\n    organization({\n        dynamicAccessControl: {\n            enabled: true\n        }\n    }),\n  ],\n});\n```\n\n### Creating Custom Roles\n\n```ts\nawait authClient.organization.createRole({\n  role: \"moderator\",\n  permission: {\n    member: [\"read\"],\n    invitation: [\"read\"],\n  },\n});\n```\n\nUse `updateRole({ roleId, permission })` and `deleteRole({ roleId })`. Pre-defined roles (owner, admin, member) cannot be deleted. Roles assigned to members cannot be deleted until reassigned.\n\n## Lifecycle Hooks\n\nExecute custom logic at various points in the organization lifecycle:\n\n```ts\norganization({\n  hooks: {\n    organization: {\n      beforeCreate: async ({ data, user }) => {\n        \u002F\u002F Validate or modify data before creation\n        return {\n          data: {\n            ...data,\n            metadata: { ...data.metadata, createdBy: user.id },\n          },\n        };\n      },\n      afterCreate: async ({ organization, member }) => {\n        \u002F\u002F Post-creation logic (e.g., send welcome email, create default resources)\n        await createDefaultResources(organization.id);\n      },\n      beforeDelete: async ({ organization }) => {\n        \u002F\u002F Cleanup before deletion\n        await archiveOrganizationData(organization.id);\n      },\n    },\n    member: {\n      afterCreate: async ({ member, organization }) => {\n        await notifyAdmins(organization.id, `New member joined`);\n      },\n    },\n    invitation: {\n      afterCreate: async ({ invitation, organization, inviter }) => {\n        await logInvitation(invitation);\n      },\n    },\n  },\n});\n```\n\n## Schema Customization\n\nCustomize table names, field names, and add additional fields:\n\n```ts\norganization({\n  schema: {\n    organization: {\n      modelName: \"workspace\", \u002F\u002F Rename table\n      fields: {\n        name: \"workspaceName\", \u002F\u002F Rename fields\n      },\n      additionalFields: {\n        billingId: {\n          type: \"string\",\n          required: false,\n        },\n      },\n    },\n    member: {\n      additionalFields: {\n        department: {\n          type: \"string\",\n          required: false,\n        },\n        title: {\n          type: \"string\",\n          required: false,\n        },\n      },\n    },\n  },\n});\n```\n\n## Security Considerations\n\n### Owner Protection\n\n- The last owner cannot be removed from an organization\n- The last owner cannot leave the organization\n- The owner role cannot be removed from the last owner\n\nAlways ensure ownership transfer before removing the current owner:\n\n```ts\n\u002F\u002F Transfer ownership first\nawait authClient.organization.updateMemberRole({\n  memberId: \"new-owner-member-id\",\n  role: \"owner\",\n});\n\n\u002F\u002F Then the previous owner can be demoted or removed\n```\n\n### Organization Deletion\n\nDeleting an organization removes all associated data (members, invitations, teams). Prevent accidental deletion:\n\n```ts\norganization({\n  disableOrganizationDeletion: true, \u002F\u002F Disable via config\n});\n```\n\nOr implement soft delete via hooks:\n\n```ts\norganization({\n  hooks: {\n    organization: {\n      beforeDelete: async ({ organization }) => {\n        \u002F\u002F Archive instead of delete\n        await archiveOrganization(organization.id);\n        throw new Error(\"Organization archived, not deleted\");\n      },\n    },\n  },\n});\n```\n\n### Invitation Security\n\n- Invitations expire after 48 hours by default\n- Only the invited email address can accept an invitation\n- Pending invitations can be cancelled by organization admins\n\n## Complete Configuration Example\n\n```ts\nimport { betterAuth } from \"better-auth\";\nimport { organization } from \"better-auth\u002Fplugins\";\nimport { sendEmail } from \".\u002Femail\";\n\nexport const auth = betterAuth({\n  plugins: [\n    organization({\n      \u002F\u002F Organization limits\n      allowUserToCreateOrganization: true,\n      organizationLimit: 10,\n      membershipLimit: 100,\n      creatorRole: \"owner\",\n\n      \u002F\u002F Slugs\n      defaultOrganizationIdField: \"slug\",\n\n      \u002F\u002F Invitations\n      invitationExpiresIn: 60 * 60 * 24 * 7, \u002F\u002F 7 days\n      invitationLimit: 50,\n      sendInvitationEmail: async (data) => {\n        await sendEmail({\n          to: data.email,\n          subject: `Join ${data.organization.name}`,\n          html: `\u003Ca href=\"https:\u002F\u002Fapp.com\u002Finvite\u002F${data.invitation.id}\">Accept\u003C\u002Fa>`,\n        });\n      },\n\n      \u002F\u002F Hooks\n      hooks: {\n        organization: {\n          afterCreate: async ({ organization }) => {\n            console.log(`Organization ${organization.name} created`);\n          },\n        },\n      },\n    }),\n  ],\n});\n```\n",{"description":7},"main","58843b159d7a4050d6b785a98b908cce505c0b92","agent\u002Fskills\u002Forganization-best-practices",0,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent","https:\u002F\u002Fgithub.com\u002FReihantt6","reihsns.web.id","2026-08-19 20:08:18",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add Reihantt6\u002Fsns-myagent --skill organization-best-practices",{"tool":38,"command":39},"bunx","bunx skills add Reihantt6\u002Fsns-myagent --skill organization-best-practices",{"tool":41,"command":42},"pnpm","pnpm dlx skills add Reihantt6\u002Fsns-myagent --skill organization-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Forganization-best-practices\u002FSKILL.md",true,[],[47,54,61,68,75,82],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M77XDCYZ407XYMF2T4P6F7VT","youtube-transcript","Extract transcripts from YouTube videos. Use when the user asks for a transcript, subtitles, or captions of a YouTube video and provides a YouTube URL (youtube.com\u002Fwatch?v=, youtu.be\u002F, or similar). Supports output with or without timestamps.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-transcript\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M77XD7PBC98J6MXGJJ2TJ8DX","youtube-thumbnail-design","YouTube thumbnail design with specific dimensions, contrast rules, and mobile preview optimization. Covers safe zones, text placement, face expression psychology, and A\u002FB testing. Use for: YouTube thumbnails, video cover images, click-through optimization. Triggers: youtube thumbnail, thumbnail design, video thumbnail, click through rate, ctr optimization, youtube cover, video cover image, thumbnail maker, thumbnail tips, youtube design, video preview image","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-thumbnail-design\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M77XD2541C8HXJ6RHYZP4NGJ","youtube-short-maker","Make YouTube Shorts that hold attention with Pexo — vertical 9:16, fast-paced, hook in the first 3 seconds. Describe your topic and Pexo writes the script, generates the shots, picks the models, and assembles a finished Short with music and captions. Use for YouTube Shorts: \"youtube short\", \"make a youtube short\", \"shorts video\", \"short-form video\". NOT for long-form or landscape video.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-short-maker\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M77XCXKVSYK7KTZ3PQBVVGFD","xcode-project-setup","Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fxcode-project-setup\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M77XCR1DV8ZQK2NHWKVY4EWX","x402","Set up Browser Use Cloud payments with x402 — pay per request from a crypto wallet (USDC on Base mainnet), no signup or API key. Two setups it works out up front — \"just use it\" (set up a wallet so you or Claude Code can run cloud browser tasks paid from the wallet — Claude writes and runs throwaway scripts, nothing touches your codebase) or \"build it in\" (install the SDK and write the key + code into your project). Walks through wallet setup, funding, .env, and a ~$1 test run. Use when the user asks about x402, pay-per-use, USDC payments, or wants Browser Use Cloud without an API key. For the free-tier signup (reverse-CAPTCHA → API key), use `browser-use cloud signup` or the `cloud` skill instead.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fx402\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M77XCMD3R3ZBZQQSW6E0793B","x-twitter-scraper","Build GitHub Copilot workflows with Xquik X API SDKs, REST endpoints, hosted Apify Actor runs, MCP tools, TweetClaw OpenClaw plugin installs, signed webhooks, tweet search, user lookup, follower exports, media actions, and agent automation.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fx-twitter-scraper\u002FSKILL.md",[],[]]