agentleFS
vantionlabsvantionlabs/saas-starter/.agents/skills/better-auth/SKILL.md

better-auth

Skill9 starsChanged 42 days agoMITView on GitHub

Use when touching authentication, organizations, members, invitations, roles, sessions, two-factor, single sign-on or SCIM provisioning in this repository. Covers which checks belong to better-auth and which belong to our policies, why a rule enforced on our side alone is one its own endpoints walk past, the `before`-hook pattern for plan gating, and the tables it owns and we must not write by hand.

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 12 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If a check needs an authenticated caller, it does not belong in a route before hook.

    line 41

“Common” is measured: kept by at least 6 in 10 of the 12 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

better-auth in this repository

better-auth owns identity. It owns the user, session, account, member, invitation, organizationRole, ssoProvider and scimProvider tables, and it owns the endpoints that write them. Everything below follows from that one fact.

The rule that costs the most to learn

A check on our side is one a request straight to better-auth's own endpoint walks past.

The seat limit taught this. Ours would have been a Policy on an RPC handler; an invitation created through POST /api/auth/organization/invite-member never reaches that handler. It is membershipLimit inside the plugin now, asked per invitation so an upgrade lands on the next invite rather than the next deploy.

So, before adding a rule, ask who owns the endpoint:

The rule is aboutWhere it goes
Something better-auth's endpoints doIts own option (membershipLimit, requiredRole, canGenerateToken)
Something only our procedures dowithPolicy(...) in the handler
A plan question better-auth cannot answerA before hook in auth/Options.ts

That third row is the pattern to copy. /sso/register and /scim/generate-token are both gated on an entitlement that lives in a table better-auth has never heard of, so both are before hooks calling a function the host supplies — ssoEntitled, scimEntitled — and both are resolved per request rather than captured at startup.

before hooks run ahead of a plugin's own middleware

This bit a real check. The SCIM seat limit started as a before hook on /scim/v2/Users, reading the organization out of the bearer token. It worked, and it answered a forged token with "this organization has no seats left" instead of "unauthorized" — a fact about a tenant handed to somebody who failed to authenticate.

If a check needs an authenticated caller, it does not belong in a route before hook. That one moved into databaseHooks.user.create.before, where the plugin has already verified the token and authenticatedScimOrganization can read what it resolved.

Permissions are one model, and ours mirror better-auth's names deliberately

identity/Permission.ts is handed to better-auth's access-control builder and used by our Policy. The resource and action names are better-auth's — member:create, invitation:create, organization:delete — so its endpoints and our screens ask the same question. contact, billing, sso, scim, webhook and file are ours, unknown to it, governed only by our policies.

Where a grant looks too loose, check whether the plugin already enforces it. sso:manage and scim:manage are owner-and-admin because hasOrgAdminRole and the SCIM plugin's requiredRole are, and a tighter rule on our side would be one its API walks past. Tightening means changing both.

Never write its tables by hand

pnpm seed creates users through the API, because better-auth hashes with scrypt and a row inserted by hand has a password nobody can sign in with. The one exception is SCIM provisioning, where there is no password to set — those accounts sign in through SSO.

member, invitation, organizationRole, ssoProvider and scimProvider carry no row-level security, and 0011_sso.sql explains why at length: better-auth writes them outside any withOrgScope transaction, so a policy in the usual shape would refuse its inserts, and one making room for a null app.current_org would permit every unscoped read while still reporting relrowsecurity as true. That is the appearance of defence.

Where to look

  • packages/modules/iam/src/auth/Options.ts — every plugin, every option, every hook
  • packages/modules/iam/src/auth/Auth.ts — the seam where Effect meets its promise chain
  • packages/modules/iam/test/Sso.test.ts, Scim.test.ts — the harness for testing a hook
  • docs/sso.md, docs/scim.md — the long version, including what has never been run against a real identity provider

Download now (ZIP)

  • Other versions14 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 14

    1. mrgoonie/claudekit-skills★ 2.2ksame name
    2. duongthinh03/portfolio★ 85same name
    3. georgekhananaev/claude-skills-vault★ 28same name
    4. VoDaiLocz/kilo-kit-mcp★ 28same name
    5. OpenAnalystInc/10x-Team★ 8same name
    6. stonegiantstudio/skills★ 2same name
    7. allanninal/claude-code-skills★ 1same name
    8. truongtv22/theone-training-skills★ 1same name
    9. captain-corgi/marketplace-website★ 0same name
    10. davidanthonyn/claude-skills★ 0same name

    4 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • Used alongsideProjects with it also use Problem-Solving Techniques, mobile-development and 6 more.

    Other files people use alongside this one.

    Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
    • truongtv22Skill

      Problem-Solving Techniques

      Apply systematic problem-solving techniques for complexity spirals (simplification cascades), innovation blocks (collision-zone thinking), recurring patterns (meta-pattern recognition), assumption constraints (inversion exercise), scale uncertainty (scale game), and dispatch when stuck. Techniques derived from Microsoft Amplifier project patterns adapted for immediate application.

      Also in 5 projects that use this

    • truongtv22Skill

      mobile-development

      Build modern mobile applications with React Native, Flutter, Swift/SwiftUI, and Kotlin/Jetpack Compose. Covers mobile-first design principles, performance optimization (battery, memory, network), offline-first architecture, platform-specific guidelines (iOS HIG, Material Design), testing strategies, security best practices, accessibility, app store deployment, and mobile development mindset. Use when building mobile apps, implementing mobile UX patterns, optimizing for mobile constraints, or making native vs cross-platform decisions.

      Also in 4 projects that use this

    • AWSSkill

      planning

      Discovers user intent and generates a structured, step-by-step plan for model customization workflows. This skill must always be activated alongside any other skill when the user's request relates to model customization — including fine-tuning, training, building, customizing, reviewing data, or getting advice on approach, regardless of domain. Do not skip this skill even if the immediate ask is narrow (e.g., reviewing data format or a single workflow step), because planning discovers the full scope of work needed. Also activate when the user wants to resume, continue, or modify an existing plan.

      Also in 5 projects that use this

    • StrayDragonSkill

      ui-ux-pro-max

      UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient.

      Also in 5 projects that use this

    • NVIDIASkill

      research

      Before designing a feature, research how comparable libraries solve the problem, check best practices, known pitfalls, and upstream changes. Use when starting a new feature, investigating an unfamiliar area, or the user asks to research something.

      Also in 5 projects that use this

    • AnthropicSkill

      design-system

      Audit, document, or extend your design system. Use when checking for naming inconsistencies or hardcoded values across components, writing documentation for a component's variants, states, and accessibility notes, or designing a new pattern that fits the existing system.

      Also in 3 projects that use this

  • In this repository33 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.