agentleFS
shinzoxDshinzoxD/knackbox/skills/coding/auth-design/SKILL.md

auth-design

Skill0 starsChanged 5 months agoApache-2.0View on GitHub

Design authentication and authorization — sessions, OAuth/OIDC,

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is 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.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Do not put long-lived JWTs in localStorage for a first-party browser app without stating the XSS tradeoff.

    line 64
  2. Distinctive:

    Every resource handler checks *this* object and *this* tenant, not only "is logged in".

    line 66
  3. Distinctive:

    Never invent a custom crypto protocol.

    line 76
  4. Distinctive:

    "Just use JWT so we can scale": ask whether a shared session store or split auth service is actually the constraint.

    line 81

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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.

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

Auth Design

Separate who they are (authn) from what they may do to this object (authz). Default to boring, revocable server sessions unless the constraint set forces something else.

For a vulnerability hunt on existing code, use security-review. For a system-wide STRIDE pass, use threat-modeling.

Workflow

  1. Actors, clients (browser, mobile, machine), and what is being protected (accounts, money, PII, admin).
  2. Identity: first-party password, magic link, SSO (OIDC), or passkeys. Password storage is argon2/bcrypt — never reversible or MD5/SHA1.
  3. Session: server-side session id in an HttpOnly; Secure; SameSite cookie is the default. Say why before choosing JWT in localStorage.
  4. Token lifetimes: access short; refresh rotating and reuse-detected; logout revokes the family.
  5. Authz model: RBAC roles plus object/tenant checks on every mutate and read of another user's record (no IDOR).
  6. Recovery: email change, password reset, MFA reset — treat as account-takeover paths.
  7. Threats: CSRF, session fixation, open redirects after login, token leak in URLs/logs, confused-deputy OAuth redirects.

Output format

## Auth design: <product>

**Clients:** …
**Identity:** …
**Session / tokens:** …
**Authz model:** …
**Recovery:** …

### Decisions
| Decision | Choice | Why |

### Abuse paths still open
…

### Do not
…

Rules

  1. Do not put long-lived JWTs in localStorage for a first-party browser app without stating the XSS tradeoff.
  2. Every resource handler checks this object and this tenant, not only "is logged in".
  3. OAuth: exact redirect URI allowlist, state/nonce, PKCE for public clients, minimal scopes.
  4. MFA is phishing-resistant (passkey / WebAuthn) when the account is high value; TOTP is a step up from nothing, not the ceiling.
  5. API keys are secrets: hashed at rest, scoped, rotatable, never in query strings or frontend bundles.
  6. Clock-skew and "alg=none" / key-confusion are findings if JWT is chosen; name the library and validation steps.
  7. Never invent a custom crypto protocol. Use the platform or a well-known library and say which.

Edge cases

  • "Just use JWT so we can scale": ask whether a shared session store or split auth service is actually the constraint.
  • Machine-to-machine: client credentials or signed requests; no user refresh-token pattern.
  • Impersonation / support login: audit log, time-box, and distinct actor vs subject.
  • Multi-tenant: tenant id from the session, never from an unchecked client header.

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.