agentleFS
neuron-oneneuron-one/GODMODE/skills/security/auth-patterns/SKILL.md

auth-patterns

Skill33 starsChanged 8 months agoMITView on GitHub

Implements secure authentication patterns. JWT with refresh tokens, OAuth 2.0, RBAC, session management. Use when building auth for any project. Don't use for social login setup.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 3

    Distinctive

    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
  1. Distinctive:

    Always validate: expiry, issuer, audience

    line 14
  2. Distinctive:

    Never store JWT in localStorage (XSS vulnerable)

    line 15
  3. Distinctive:

    Never log passwords, even hashed

    line 23

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Secure Authentication Patterns

JWT Implementation

  • Access token: short-lived (15 min)
  • Refresh token: long-lived (7 days), stored in httpOnly cookie
  • Always validate: expiry, issuer, audience
  • Never store JWT in localStorage (XSS vulnerable)
  • Rotate refresh tokens on each use

Password Security

  • Hash with bcrypt (cost factor 12+)
  • Minimum 8 characters, require complexity
  • Rate limit login attempts (5 per minute)
  • Account lockout after 10 failed attempts
  • Never log passwords, even hashed

RBAC (Role-Based Access Control)

  • Define roles: admin, manager, user
  • Middleware checks role on EVERY protected route
  • Principle of least privilege
  • Separate admin endpoints from user endpoints

Session Management

  • Regenerate session ID after login
  • Expire inactive sessions (30 min)
  • Allow user to see/revoke active sessions
  • Invalidate all sessions on password change

API Security

  • CORS: whitelist specific origins, not *
  • Rate limiting per user and per IP
  • Input validation with schema (Zod, Joi)
  • Sanitize all outputs

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.