validate-auth-schema

A check that compares a Drizzle database schema with the tables and fields required by Better Auth, an authentication library. It uses generated data from the project's enabled authentication integrations as the reference.

In plain words
What is it for?
Use it to validate authentication database tables, columns, types, required and unique settings, foreign keys, and indexes against the configured Better Auth setup.
Why use it?
It finds missing or unnecessary tables, field mismatches, incorrect relationships, and index differences before they cause authentication problems.

Command for Claude Code

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.

agentmods
npx agentmods add commands/kriasoft/react-starter-kit/validate-auth-schema
Clone the repo
git clone --depth 1 https://github.com/kriasoft/react-starter-kit

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 485 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.00485
Opus 5 $0.00000 $0.00243
Sonnet 5 $0.00000 $0.00097
Haiku 4.5 $0.00000 $0.00049

Measured 2d ago against content hash 2d19e2fb5777, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

validate-auth-schema 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 2d ago.

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.

.claude/commands/validate-auth-schema.md · 21 lines

What it actually says

Validate Auth Schema

Check that the Drizzle schema in db/schema/ still satisfies what Better Auth expects. Better Auth derives its required tables from the enabled plugins, so the generated JSON — not the upstream docs — is the source of truth:

bun run db/scripts/generate-auth-schema.ts

The script builds a real auth instance from apps/api/lib/auth.ts with fixed placeholder credentials, every optional integration switched on, so the output is the full set of tables rather than the subset your environment happens to enable. Per field it carries the type, the required, unique and index flags, any literal defaultValue, and the reference target with its onDelete. Per table it carries indexes: the composite indexes a plugin declares, which is how the account identity key (issuer, accountId) arrives.

Compare that output against db/schema/ and report:

  • Tables Better Auth expects that are missing, and tables no plugin in auth.ts needs any more.
  • Field-level drift: missing or extra columns, mismatched types, and required or unique flags that disagree.
  • Foreign keys pointing at the wrong table or column.
  • A true index flag, a table-level entry in indexes, a literal defaultValue, or an onDelete in the output is Better Auth asking for it: report a schema that lacks one. Indexes, defaults and cascades the project adds beyond that list are its own decisions — check those against the conventions in db/AGENTS.md and do not report them as drift.
  • Local naming that must stay mapped, not renamed away: Better Auth's account is our identity table.
  • Project-specific columns, indexes, and constraints are expected and fine on their own. Flag any that constrain a write Better Auth performs: a NOT NULL column with no database default breaks every insert into that table, and an extra unique or check constraint can reject a row Better Auth considers valid. Fields that must participate in its models belong in additionalFields rather than added to the table behind its back.

Report findings with the specific fix for each. Do not run db:push, db:generate, or db:migrate as part of a validation — schema changes are a separate, deliberate step.

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. 2d ago First seen · 21 lines · 0 tokens per session scan A 2d19e2fb5777

Subscribe to this mod's changes

validate-auth-schema is a command published in the GitHub repository kriasoft/react-starter-kit (23,673 stars, last pushed 2d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 485 tokens. 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.