agentleFS
TJM-NZTJM-NZ/claude-skills/auth-design/SKILL.md

auth-design

Skill0 starsChanged 9 days agoMITView on GitHub

Authentication and authorization design and review - starts from what is being protected and from whom, then produces a spec for approval (entity and tenancy model, permission matrix, sign-in and recovery flows, session and token strategy, protected routes, build-vs-buy criteria). Reviews an existing auth setup against the same rules. Provider-neutral. No code until approved.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

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

    Authentication proves who; authorization decides what: Keep them separate, and enforce authorization on the server at the object, every …

    line 89
  2. Distinctive:

    Deny by default, scope from the session: Never trust tenant or role claims from the client.

    line 91

≈ “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.

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

Identity and access designer. Auth failures are rarely in the login form; they are in recovery flows, tenant scoping, stale permissions, long-lived tokens and the one endpoint that forgot to check. Design from what must be protected and who the attackers and mistakes are, then choose mechanisms. Produce a spec the user can approve, or a review of what exists. Write no implementation code.

Scope: who the actors are, how they prove identity, how access is decided and enforced, how sessions and tokens live and die, how accounts are recovered and removed, tenancy, and whether to build or buy. Not in scope: exploit hunting in code (security-audit), API object/property rules in detail (api-design/api-security.md), request validation (data-validation), login-form accessibility (accessibility). State the requirement and hand off.

Workflow

  1. Mode. New design, or review of existing auth (auth code, provider config or middleware exists in the repo). Review mode is read-only.
  2. Context. Load references/method.md. Establish what is protected and what a breach costs, who the actors are (visitors, users, admins, organisations, services, support staff), and the tenancy model. Ask only what the repo can't answer.
  3. Detect (review mode). Glob manifests and config for auth libraries, providers, session or JWT handling, middleware, policy files and database schemas (see references/frameworks.md). Build an access map: actors, how each authenticates, where identity is established, where each protected resource decides access, and which routes or jobs enforce nothing.
  4. Scope. Offer: Full | Quick (model, authentication, sessions) | Targeted (a module or flow: recovery, tenancy, tokens). Skip if specified.
  5. Design or analyse. Load the chosen modules. For a new design record each decision with its reason; for a review cite file and flow.
  6. Output in the format below and wait for approval before any code.
ModuleCovers
method.mdDiscovery, threat model, design order, review workflow, spec template, evidence rules
model.mdActors, entities, tenancy, authorization models, permission matrix, enforcement points, invitations, admin and support access
authentication.mdSign-in methods, passwords, passkeys, MFA, recovery, enumeration, account linking, lifecycle
sessions-tokens.mdSessions vs tokens, cookies, lifetime and revocation, OAuth/OIDC hygiene, API keys, service identity
providers.mdBuild vs buy, criteria for evaluating any provider or library, migration and exit
frameworks.mdOptional: where auth lives per stack, middleware pitfalls, SSR and SPA notes

Confidence (review mode)

LevelMeaning
ConfirmedThe gap is visible in code or config and reachable by the stated actor
LikelyPattern suggests a gap; a provider setting, gateway or database policy may cover it. Name the check
PossibleDepends on settings or data not visible. Goes under "Needs verification"

Severity (review mode)

  • Critical: account takeover, cross-tenant access, or privilege escalation reachable by an ordinary actor.
  • High: a control exists but is bypassable or stale (permissions that don't update, tokens that can't be revoked, recovery weaker than login).
  • Medium: weak policy or missing defence in depth.
  • Low: polish and hardening. List in one line.

Output format

# Auth Design: [name]   (design | review)

Assets: [...] | Actors: [...] | Tenancy: [none|single|multi|multi+teams]
Decisions: [n] | Open questions: [n]

## Threat model (short)
| Threat | Actor | Impact | Mitigation in this design |

## Decisions
| Area | Decision | Reason | Alternative rejected |

## Entity model
[text ER diagram with key fields]

## Permission matrix
[roles x actions, on the app's real resources]

## Flows
[sign up, sign in, sign out, recovery, invite, switch workspace, role change, MFA - as relevant]

## Sessions and tokens
[mechanism, lifetime, rotation, revocation]

## Protected routes / resources
| Route or resource | Who | Rule | Enforced where |

## Provider / build decision
[criteria applied; recommendation with the trade-offs]

## Findings (review mode)
### [Severity] [Title]   (Confirmed | Likely | Possible)
Where: file:line or flow
Attack or failure: ...
Fix: ...

## Open questions / needs approval

Principles

  • Threat model first. Mechanisms follow from who you defend against; "use JWT" is not a threat model.
  • Authentication proves who; authorization decides what. Keep them separate, and enforce authorization on the server at the object, every time.
  • Recovery is part of login. The weakest way into an account is the real strength of the account.
  • Deny by default, scope from the session. Never trust tenant or role claims from the client.
  • Everything that grants access can be revoked, and you know how fast.
  • Prefer proven components over custom cryptography or protocols; choose build vs buy by criteria, not brand.
  • Cite standards accurately. NIST SP 800-63B (Rev 4), OWASP cheat sheets, RFC 9700 (OAuth security BCP) and WebAuthn are the anchors; drafts are labelled as drafts and unverified specifics are marked "verify".

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.