Back to Skills Library
SecurityDeterministicAuthAI Agent Skill

better-auth-security-best-practices

Deterministic security, session, and role guardrails to protect mission-critical flows.

better-auth/skills
26k stars
26.0k installs
Updated: 2026-06-11

Install Options

Install into Claude Code, Cursor, Codex, or Antigravity with:

$ npx skills add better-auth/skills@better-auth-security-best-practices

Real Work Situation Solved

Deterministic rules or an AI model - how do you decide?

The problem in front of you could be solved with if-else or with AI - which do you pick, and why?

5-Step Action Framework

  1. 1Ask: can the rule be written as a finite list that doesn't change with context? If yes → use a deterministic rule.
  2. 2Ask: does the system need to explain its decision to users or auditors? Rules are easier to explain than models.
  3. 3Ask: is the input varied, ambiguous, or does it keep shifting over time? If yes → a model is the better fit.
  4. 4Compare the cost of being wrong: a bad rule is a one-line fix; a bad model needs retraining and re-evaluation - which risk can this problem tolerate?
  5. 5When unsure, start with a rule for the 80% common cases and reserve AI for the harder-to-predict remainder.
Before

"Just use AI, it'll probably be more accurate."

After

"Approving refunds under $20: a deterministic rule (clear conditions, must be explainable to customers). Fraud detection: an AI model (input is varied, patterns keep shifting)."

Related Course Lesson

AI LiteracyLesson 1

Go to Lesson

SKILL.md Source Instructions

SKILL.md • Read-only preview
# Better Auth Security Practices

Enforce strict validation, deterministic token validation, and clear boundary checks.