CodeQL, Semgrep and SARIF static-analysis toolkit from Trail of Bits: taint tracking, fast pattern scans and merged, deduplicated security findings for coding agents.
Better Auth: Two-Factor AuthSkill
Summary
Adds real 2FA to a Better Auth app — TOTP, email/SMS OTP, backup codes, trusted devices — including the sign-in interrupt and the encryption-at-rest details.
Features
- TOTP enrolment with QR code, first-code verification and period/digit config
- Email and SMS OTP delivery, with a section on storing those codes safely
- Backup codes: one-time display, regeneration and sign-in recovery
- Trusted devices to skip the second factor on a proven machine
- The sign-in interrupt flow when a password succeeds but 2FA is outstanding
- Rate limiting the verify endpoint and encryption at rest for secrets
Install This Skill
Add this skill to your favorite AI agent in a few steps.
Skill Content
Usage Instructions
Learn how to use this skill with different AI agents.
Description
Two-factor authentication has three parts that must all be right: enrolment, the sign-in interrupt, and recovery. Ship two of them and you have either an unusable account-lockout generator or security theatre. This official Better Auth skill covers all three.
Enrolment starts with the plugin pair — twoFactor({ issuer }) on the server, twoFactorClient() on the client — then a migration that adds the twoFactorSecret column. TOTP covers rendering the enrolment QR code, verifying the first code, and the configuration knobs around period and digits. The OTP path covers delivering codes by email or SMS, sending and verifying them, and, importantly, how those codes are stored: the skill has a dedicated section on OTP storage security rather than leaving them as plaintext rows.
Recovery is treated as a first-class flow, not an afterthought. Backup codes are displayed once, regenerated on demand, and accepted at sign-in when the authenticator is gone, with configuration for count and format. Trusted devices let a user skip the second factor on a machine they have already proved out.
The sign-in section documents the interrupt itself — what the client receives when a password succeeds but a second factor is outstanding, and how to drive the follow-up. The security section covers what happens to sessions around 2FA changes, rate limiting the verification endpoint so codes cannot be brute-forced, and encryption at rest for secrets and backup codes. It finishes with disabling 2FA safely and a complete configuration example.
Published by the Better Auth team in their official skills repository, in the portable Agent Skills format read by Claude Code, Codex, Cursor and others.
Related Skills
Microsoft's official Playwright skill — drives a real browser from the command line using accessibility snapshots and element refs, and plans, generates and heals Playwright tests.
Google's official agent skill for writing production Maps Platform code — grounded in freshly fetched docs, with a demo key path that needs no billing account.
Railway's official agent skill: create projects, provision databases and buckets, deploy, manage variables and domains, and read build failures back — from the CLI, API or MCP server.