auth-design
Skill4 starsChanged 4 months agoMITView on GitHub
Designs how a system knows who someone is and what they may do — login, sessions, tokens, roles, and permission checks. Use this whenever the user is building login or signup, adding roles or permissions, choosing between sessions and JWTs, integrating OAuth or SSO, or asking how to protect an endpoint. For finding authorization bugs in code that exists, use security-analysis.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- shinzoxD/knackboxtheir own version, first seen Jul 10, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- shinzoxD/knackbox★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository61 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-deploymentSkill
- agent-designSkill
- agent-evaluationSkill
- agent-hardeningSkill
- agent-implementationSkill
- agent-observabilitySkill
- agent-scopingSkill
- api-designSkill
- code-templatingSkill
- dependency-upgradeSkill
- error-handlingSkill
- feature-implementationSkill
- project-scaffoldingSkill
- refactoringSkill
- data-analysisSkill
- data-migrationSkill
- data-modelingSkill
- sql-queriesSkill
- ci-pipelinesSkill
- containerizationSkill
- deployment-strategiesSkill
- infrastructure-as-codeSkill
- debuggingSkill
- issue-investigationSkill
- issue-triageSkill
- log-analysisSkill
- network-troubleshootingSkill
- performance-profilingSkill
- api-documentationSkill
- commit-messagesSkill
- diagrammingSkill
- markdown-docsSkill
- plain-languageSkill
- pr-descriptionsSkill
- release-notesSkill
- browser-testingSkill
- integration-testingSkill
- load-testingSkill
- test-dataSkill
- test-driven-developmentSkill
- unit-testingSkill
- deep-researchSkill
- feed-digestSkill
- summarizationSkill
- accessibility-reviewSkill
- code-analysisSkill
- code-lintingSkill
- code-reviewSkill
- dependency-auditSkill
- secrets-managementSkill
- security-analysisSkill
- threat-modelingSkill
- capacity-planningSkill
- disaster-recoverySkill
- incident-responseSkill
- monitoring-setupSkill
- root-cause-analysisSkill
- runbooksSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 4 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
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
- Distinctive: line 23
Use the platform's framework, or an identity provider.
- Distinctive: line 31
Done when: every path that can establish a session has been enumerated and secured.
- Distinctive: line 46
Default to server sessions for browser applications.
- Very specific: line 60
Never store a token in localStorage if you can avoid it — any XSS reads it.
- Distinctive: line 83
Done when: no endpoint trusts a client-supplied identifier for an authorization decision.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Auth design
Two separate problems, constantly conflated, with different failure modes:
- Authentication: who is this? Mature, well-solved, and you should use a library
- Authorization: what may they do? Application-specific, and where nearly all real breaches originate
Teams spend most of their effort on the first because it is visible, and most of their vulnerabilities live in the second. Object-level authorization is the one to get right.
1. Do not build authentication from scratch
Password handling, session fixation, timing attacks, reset flows, and MFA are all solved and all easy to get subtly wrong.
Use the platform's framework, or an identity provider. If you are storing passwords yourself, use argon2id or bcrypt with the current cost parameters, never a general-purpose hash, never with a hand-rolled salt.
The flows people forget to secure, which are attacked precisely because they are afterthoughts: password reset, email change, account recovery, and MFA enrolment. A reset flow is a login bypass if the token is guessable, does not expire, or is reusable.
Done when: every path that can establish a session has been enumerated and secured.
2. Choose sessions or tokens deliberately
| Server sessions | JWTs | |
| Revocation | Immediate | Not possible before expiry |
| State | Server-side store | Stateless |
| Best for | Browser apps, anything needing instant logout | Short-lived service-to-service |
The revocation problem is the deciding factor and it is usually underweighted. A JWT valid for 24 hours is valid for 24 hours after you fire someone, after you detect a compromise, after the user clicks "log out everywhere". The usual workaround — a revocation list checked on every request — reintroduces the state JWTs were chosen to avoid.
Default to server sessions for browser applications. Use short-lived tokens with refresh where statelessness genuinely matters, and keep access token lifetime in minutes.
Done when: you can answer "how fast can we revoke this?" with a number you are happy with.
3. Get the cookie and token handling right
HttpOnly: JavaScript must not read the session cookieSecure: HTTPS onlySameSite=Laxor stricter — this is the primary CSRF defence now- A short, sliding expiry, and an absolute maximum
- Rotate the session ID on privilege change: login, password change, role escalation. Not rotating is session fixation
Never store a token in localStorage if you can avoid it — any XSS reads it. A cookie the script
cannot read is meaningfully safer.
Done when: the session cannot be read by script or sent cross-site.
4. Design authorization around objects, not just roles
Roles answer "is this person an editor?" Almost every real breach turns on "may this person edit this object?"
- Check ownership or membership on every request, using the identifier from the session, never one supplied by the client
- Scope the query rather than checking after fetching —
Order.where(id: params[:id], user: session.user). This makes the whole class of bug structurally impossible rather than dependent on remembering a check - Return 404, not 403, for objects the user may not see, so identifiers cannot be enumerated
- Check before the side effect, on every path including error paths
Choose the model deliberately: RBAC (roles) is simple and fits most systems; ABAC (attributes) fits when access depends on context; ReBAC (relationships) fits sharing and hierarchies. Starting with RBAC and bolting on exceptions is how permission logic becomes unmaintainable.
Done when: no endpoint trusts a client-supplied identifier for an authorization decision.
5. Enforce in one place
Authorization scattered across controllers will have gaps — a new endpoint added without the check is the standard way this fails.
Centralise it: middleware, a policy layer, or a query scope applied by default. Make the secure path the default and require an explicit opt-out, so a forgotten check fails closed rather than open.
Deny by default. A new route with no rule must reject, not allow.
Done when: adding an endpoint without an authorization rule causes a failure, not a hole.
6. Make it observable and recoverable
- Log every authentication and authorization decision: who, what, allowed or denied, from where. Denied attempts are the signal that someone is probing
- Rate-limit login, reset, and MFA by account and by source, or you have an account-enumeration and brute-force endpoint
- Do not leak account existence in login or reset responses. Same message, same timing
- Let users see and end their sessions, and end them all on password change
- Notify on security events: new device, password change, MFA change
Done when: a user could detect and end an unauthorised session themselves.
Report
State the authentication method, session or token choice with its revocation time, the authorization model, where enforcement lives, and what a compromised session would grant. Then list the endpoints exempt from authorization — that list should be short, deliberate, and reviewed.
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.

