joabgonzalez/ai-agents-skills/authentication
Claude Code and agent skill by joabgonzalez/ai-agents-skills
- community
Checking that the SKILL.md file is still in the repository.
Auth patterns: password hashing, JWT, sessions, and OAuth. Trigger: When implementing login, registration, token handling, or OAuth flows.
Install
npx vskill@latest install joabgonzalez/ai-agents-skills/authenticationSKILL.md
The same SKILL.md was published earlier as joabgonzalez/ai-agents-skills/authentication.
Authentication
Patterns for implementing authentication correctly: password hashing strategy, token design, session management, OAuth flows, and security hardening. Language-agnostic principles; JWT/OAuth examples use Node.js.
When to Use
- Implementing login, registration, or logout
- Designing JWT or session-based auth
- Integrating OAuth / OIDC providers (Google, GitHub, etc.)
- Hardening an existing auth layer
Don't use for:
- Authorization / RBAC (permissions after authentication)
- Specific framework setup (use express, nest, nextjs)
Critical Patterns
✅ REQUIRED [CRITICAL]: JWT — Sign, Verify, Never Just Decode
jwt.decode() skips signature verification. Always use jwt.verify() with the secret.
✅ REQUIRED [CRITICAL]: Short Access Token + Refresh Token Pattern
Access tokens expire fast (15 min). Refresh tokens are long-lived, stored httpOnly, rotated on use.
❌ NEVER: Secrets in JWT Payload
JWTs are base64-encoded, not encrypted. Anyone can decode the payload.
✅ REQUIRED [CRITICAL]: Password Hashing — Algorithm and Parameters
Passwords require a slow, memory-hard hash with an automatic per-password salt. Never use SHA-256, MD5, or any fast hash — a leaked DB is cracked in hours.
| Algorithm | Verdict | Notes | |
|---|---|---|---|
| Argon2id | ✅ First choice | Memory-hard · no input limit · configurable cost | |
| bcrypt | ✅ Acceptable | Widely supported · cost ≥ 12 · 72-byte input limit | |
| scrypt | ✅ Acceptable | Memory-hard · built into many standard libraries | |
| SHA-256 / MD5 | ❌ Never | Designed for speed — wrong tool for passwords |
Core rules:
- Let the library generate the salt — never manually
- Store the full PHC string output, not raw bytes
- Use library
verify/compare— timing-safe;===is not - Hash only the password field — never concatenate other fields
- Always run the hash even when user not found (prevents email enumeration via timing)
Full detail — algorithm parameters, pepper, NIST password policy, known antipatterns (Okta 2022), migration patterns: see references/password-hashing.md
✅ REQUIRED: Timing-Safe Comparison for Secrets
String equality (===) leaks timing information. Use crypto.timingSafeEqual.
✅ REQUIRED: OAuth — Validate State Parameter
The state param prevents CSRF in OAuth flows. Always generate, store, and verify it.
✅ REQUIRED: Rate Limit Auth Endpoints
Login, register, and password reset are brute-force targets. Apply per-IP and per-account limits.
❌ NEVER: Expose Auth Errors in Detail
Don't confirm whether an email exists — it enables user enumeration.
Decision Tree
Example
JWT auth with refresh token rotation.
Edge Cases
Refresh token theft: If a stolen refresh token is used after rotation, the original is already deleted — the second use will fail. Optionally: invalidate all sessions for that user on double-use detection.
Stateless vs stateful JWTs: Stateless JWTs cannot be revoked mid-lifetime. If you need instant revocation (logout from all devices), store a token version or jti in the DB and check on each request.
PKCE for SPAs: SPAs cannot keep a client secret. Use OAuth PKCE flow (code_verifier + code_challenge) instead of client_secret.
Multi-device sessions: Store refresh tokens per device with a device identifier. Logout invalidates only that device's token; "logout everywhere" purges all.
Resources
- password-hashing.md - Algorithm selection, parameters, pepper, NIST policy, antipatterns, migration
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/authentication/SKILL.md
Popularity
- Repository stars
- 9
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/joabgonzalez/ai-agents-skills/authentication)