auth-flow-builder
Skill1 starsChanged 5 months agoApache-2.0View on GitHub
Implements authentication flows including login, registration, password reset, and session management. Use when adding auth to a web app using JWT, sessions, or OAuth.
In this repository58 other files it gives its agents.
- agent-chain-designerSkill
- api-wrapper-builderSkill
- embeddings-builderSkill
- evaluation-harnessSkill
- fine-tuning-preparerSkill
- llm-router-builderSkill
- ml-model-trainerSkill
- model-benchmarkerSkill
- prompt-engineerSkill
- rag-pipeline-builderSkill
- synthetic-data-generatorSkill
- vector-db-integratorSkill
- csv-processorSkill
- database-schema-designerSkill
- data-pipeline-builderSkill
- etl-workflow-designerSkill
- json-transformerSkill
- pandas-data-cleanerSkill
- report-generatorSkill
- sql-query-optimizerSkill
- time-series-analyzerSkill
- visualization-generatorSkill
- backup-strategySkill
- ci-cd-optimizerSkill
- docker-compose-generatorSkill
- github-actions-pipelineSkill
- kubernetes-deploymentSkill
- load-balancer-configSkill
- log-aggregator-setupSkill
- monitoring-dashboardSkill
- nginx-config-generatorSkill
- security-hardeningSkill
- ssl-certificate-managerSkill
- terraform-module-builderSkill
- api-security-auditorSkill
- compliance-checkerSkill
- dependency-checkerSkill
- incident-responderSkill
- jwt-security-auditorSkill
- owasp-checkerSkill
- penetration-test-plannerSkill
- secret-detectorSkill
- threat-model-designerSkill
- vulnerability-scannerSkill
- accessibility-auditorSkill
- api-route-builderSkill
- css-animation-crafterSkill
- form-validatorSkill
- graphql-schema-designerSkill
- html-component-builderSkill
- nextjs-app-scaffoldSkill
- performance-auditorSkill
- pwa-setupSkill
- react-component-generatorSkill
- responsive-layout-systemSkill
- seo-optimizerSkill
- tailwind-design-systemSkill
- websocket-integrationSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 39
Always httpOnly + SameSite=Strict/Lax + Secure cookies.
- Distinctive: line 40
Never store tokens in localStorage or sessionStorage.
- Distinctive: line 49
CSRF protection: Use SameSite + double-submit cookie or framework built-in.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Overview
Implements secure authentication flows (login, register, forgot password, reset, logout, session refresh) using modern best practices: httpOnly cookies for tokens (never localStorage), PKCE for OAuth, CSRF protection, refresh token rotation, and clear guidance on JWT vs session vs OAuth tradeoffs. Provides complete flows for NextAuth.js / Auth.js, custom JWT, and session-based approaches.
When to Use This Skill
- Adding authentication to a new or existing web application.
- User requests "login page", "sign up", "protected route", "OAuth", or "session management".
- You need to choose between JWT, sessions, or OAuth and implement it securely.
Prerequisites
- Backend framework (Next.js, Express, etc.).
- Database or user store (Prisma, Drizzle, or auth provider).
- For OAuth: provider credentials (Google, GitHub, etc.).
- HTTPS in production (mandatory for cookies and OAuth).
Steps
- Choose auth strategy:
- Sessions + httpOnly cookie: Simplest, good for traditional apps.
- JWT in httpOnly cookie + refresh rotation: Stateless, good for APIs and microservices.
- OAuth 2.1 + PKCE: For third-party login (recommended when possible).
- Compare pros/cons in the output.
- Secure token storage:
- Always httpOnly + SameSite=Strict/Lax + Secure cookies.
- Never store tokens in localStorage or sessionStorage.
- Implement flows:
- Login: validate credentials → issue tokens/cookie → redirect.
- Register: validate, hash password (bcrypt/argon2), create user.
- Password reset: time-limited token via email, one-time use.
- Refresh: short-lived access token + rotating refresh token.
- Logout: clear cookies, invalidate refresh token on server.
- CSRF protection: Use SameSite + double-submit cookie or framework built-in.
- Protected routes / middleware:
- Next.js middleware example that checks for valid session/JWT.
- Redirect unauthenticated users to /login with return URL.
- NextAuth.js / Auth.js integration (recommended for most Next.js apps):
- Full config with credentials provider + Google/GitHub.
- Custom pages.
- Session callback to enrich user object.
- Output:
- Complete auth service functions.
- Route handlers or API routes for each flow.
- Middleware.
- Frontend login/register forms (or point to form-validator skill).
- Environment variable list.
- Security checklist.
Examples
Full NextAuth config, custom JWT login/register handlers with httpOnly cookies, password reset flow with email token, and protected route middleware are included.
Edge Cases & Error Handling
- Invalid/expired refresh token: Force re-login, clear all cookies.
- Brute force: Rate limit login attempts per email/IP.
- Email verification: Optional but recommended step after registration.
- Account linking: For OAuth + credentials.
- Session fixation: Regenerate session on login.
Verification
- Register a new user.
- Login — verify httpOnly cookie is set (inspect in DevTools → Application → Cookies).
- Access a protected page while logged out — redirected to login.
- Refresh the page while logged in — session persists.
- Logout — cookie cleared.
- Attempt password reset end-to-end.
- Success: All flows work, no tokens in localStorage, cookies are httpOnly and secure-flagged in production.
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

