better-auth-security-best-practices: Claude Code skill
Hardens Better Auth deployments by configuring rate limits, CSRF rules, session caching, and OAuth token encryption.
npx skills add better-auth/skills --skill better-auth-security-best-practices -a claude-code
npx skills add better-auth/skills --skill security -a claude-codeWhat better-auth-security-best-practices does
This skill guides security configuration for Better Auth deployments. It sets up rate limiting with default windows of 10 seconds for 100 general requests and tighter limits of 3 requests for sensitive auth endpoints. It also activates CSRF checks, trusted origin lists, and secure cookie prefixes like __Secure-.
Secret keys resolve in strict order: first options.secret, then BETTER_AUTH_SECRET, and finally AUTH_SECRET. OAuth tokens gain AES-256-GCM encryption, while session cookies can use compact or encrypted jwe formats.
Using in-memory storage for rate limits causes counters to wipe on serverless restarts, which makes Redis or persistent database storage necessary for ephemeral environments.
What it helps with
- limit brute force attempts on authentication endpoints
- encrypt stored OAuth tokens using AES-256-GCM
- define dynamic and wildcard trusted origins
- record security audit logs on session events
Example prompts for the agent
- Configure Better Auth rate limiting for sign-in routes with custom limits
- Set up AES-256-GCM encryption for stored OAuth provider tokens
- Add databaseHooks to log session creation and deletion events
How to install better-auth-security-best-practices
1Skills CLI (Vercel)
npx skills add better-auth/skills --skill better-auth-security-best-practices -a claude-codenpx skills add better-auth/skills --skill security -a claude-code2Manually: put the files in place
~/.claude/skills/security/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/security/
1Skills CLI (Vercel)
npx skills add better-auth/skills --skill security -a codex2Manually: put the files in place
.agents/skills/security/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add better-auth/skills --skill security -a cursor2Manually: put the files in place
.cursor/skills/security/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install better-auth/skills security2Manually: put the files in place
.github/skills/security/SKILL.md1Skills CLI (Vercel)
npx skills add better-auth/skills --skill security -a gemini-cli2Platform CLI
gemini skills install https://github.com/better-auth/skills --path securityManually: put the files in place
.devin/skills/security/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add better-auth/skills --skill security -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set5
The whole set →Similar
Questions about better-auth-security-best-practices
How to install better-auth-security-best-practices in Claude Code?
Run npx skills add better-auth/skills --skill better-auth-security-best-practices -a claude-code in your terminal.
What does better-auth-security-best-practices do?
It provides hardening patterns for Better Auth, covering CSRF checks, session cookie strategies, and IP grouping rules.
Which rate limiting storage works best for serverless?
The memory option resets on container restart. Serverless architectures require database or secondary-storage with Redis to persist attempt counters across requests.