betterauth-integration

betterauth-integration is a skill for Claude Code from fcsouza/agent-skills. It costs 71 tokens per session (2,729 once invoked), scanned A, original, MIT.

A BetterAuth integration guide for game login and access control. BetterAuth is an authentication system; access control decides which users can perform particular actions.

In plain words
What is it for?
Use it when implementing login flows, OAuth sign-in, JWT sessions, roles, or role-based permissions in a game.
Why use it?
It helps structure sign-in, identity, sessions, and permissions without leaving security decisions undefined.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the game-dev plugin — 39 skills shipped together

Good fit Use it when implementing login flows, OAuth sign-in, JWT sessions, roles, or role-based permissions in a game.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/fcsouza/agent-skills/betterauth-integration
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add fcsouza/agent-skills --skill betterauth-integration
Clone the repo
git clone --depth 1 https://github.com/fcsouza/agent-skills

Made for: Claude Code.

Or install game-dev, the plugin that ships this one along with the rest of its 39 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for betterauth-integration

README.md
[![agentmods](https://agentmods.dev/badge/skills/fcsouza/agent-skills/betterauth-integration/github.svg)](https://agentmods.dev/skills/fcsouza/agent-skills/betterauth-integration)
Your own site
<a href="https://agentmods.dev/skills/fcsouza/agent-skills/betterauth-integration"><img src="https://agentmods.dev/badge/skills/fcsouza/agent-skills/betterauth-integration/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for betterauth-integration

Your own site · 80×15
<a href="https://agentmods.dev/skills/fcsouza/agent-skills/betterauth-integration"><img src="https://agentmods.dev/badge/skills/fcsouza/agent-skills/betterauth-integration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 71 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,729 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00071 $0.02729
Opus 5.5 $0.00028 $0.01092
Sonnet 5.5 $0.00014 $0.00546
Haiku 4.5 $0.00007 $0.00273

Measured 19d ago against content hash 88c477b61c4a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

betterauth-integration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 19d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (templates/role-definitions.ts, templates/staff-guard.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/betterauth-integration/SKILL.md · 109 lines

How it starts

The opening of the file, as written. The whole thing — 109 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Better Auth for games

Use the better-auth-best-practices skill if it is installed, otherwise https://www.better-auth.com/docs. This skill covers only what a game adds on top: the role matrix, the WebSocket handshake, and the split between who a player is and which match they are in.

Requires

  • postgres-game-schema

Decisions

  1. Every game endpoint and every WebSocket connection checks a Better Auth session. Derive the user id from the session, never from the request body or params.
  2. Use Better Auth sessions, not JWTs, for players. A session lives in the database, so a ban or logout revokes it.
  3. Use three roles: player, moderator, admin. They come from the admin plugin, not from a custom user field.
  4. Keep the auth session ("who you are") apart from the game session ("which match or room you are in"). A logged-in player may be in no match.
  5. Do not write password hashing. Better Auth hashes passwords with scrypt.

Setup steps

  1. Install the packages: bun add better-auth @better-auth/drizzle-adapter. Import the adapter with import { drizzleAdapter } from '@better-auth/drizzle-adapter'. If the project uses Drizzle Relations v2, import from @better-auth/drizzle-adapter/relations-v2 instead.
  2. Add the admin plugin with the game roles from templates/role-definitions.ts: admin({ ac, roles, defaultRole: 'player' }) on the server and adminClient({ ac, roles }) on the client. Without defaultRole: 'player', new users get the plugin's default role user, which the game matrix does not define, and every permission check fails.
  3. Add the staffGuard() plugin from templates/staff-guard.ts after admin(): plugins: [admin({ ... }), staffGuard()]. A plugin hook does not take the single user-level hooks.before slot, and its place relative to bearer() does not matter. If a project must call guardStaffTargets(ctx) from its own hooks.before instead, await it as the first statement, do not catch its error, and do not rewrite the body of /admin/* requests in any hook.
  4. Do not add a role field through additionalFields. The admin plugin adds role (plus banned, banReason, banExpires) to the user table.
  5. Generate the auth schema, then migrate it with Drizzle Kit. Better Auth's migrate command works only with its built-in Kysely adapter.

Read the full file on GitHub · 109 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 19d ago Changed · -45 lines · +18 tokens per session 88c477b61c4a
  2. 3mo ago First seen · 154 lines · 53 tokens per session scan A d7a82d139246

Subscribe to this mod's changes

betterauth-integration is a skill published in the GitHub repository fcsouza/agent-skills (29 stars, last pushed today), licensed MIT. It adds 71 tokens to every session and 2,729 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

betterauth-integration compared with skills from other repositories

betterauth-integration next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
betterauth-integrationfcsouza/agent-skillsSkill29todayMITA71Claude Code
playtest-reportDonchitos/Claude-Code-Game-StudiosSkill42k24d agoMITA20Claude Code
godot-signals-groupsgamedev-skills/awesome-gamedev-agent-skillsSkill13k3d agoApache-2.0A93Claude Code
scenario-unreal-gameplayscenario-labs/skillsSkill4.7kyesterdayMITA121Claude Code
texture-workflowarjun988/blender-skillsSkill5.8k27d agoMITA41Claude Code
motionOpenDCAI/GameFactory-3ASkill1.6kyesterdayApache-2.0A0Claude Code, Codex
gamedev-shadersericrisco/rsc-harnessSkill707yesterdayMITA102Claude Code, Codex