authentication
Skill59 starsChanged 2 months agoMITView on GitHub
Establish who the caller is — session cookies, bearer tokens, refresh, and OAuth/OIDC flows — and put each where it belongs. Use when adding or changing login, logout, signup, session handling, token issuance or refresh, an identity-provider integration, or when a request arrives with a credential nobody validates. Not for deciding what an authenticated caller may then do (that is authorization), not for the login screen's design, and not for hand-rolling crypto.
12 other projects use a version of this.
Adopted by
Most recently taken up by
- jkaninda/okapi-skillstheir own version, first seen Aug 16, 2026
- Kur1sulab/blackboxtheir own version, first seen Aug 12, 2026
- CheehooLabs/SpureeSkillstheir own version, first seen Aug 7, 2026
- codewithmukesh/dotnet-claude-kittheir own version, first seen Jul 22, 2026
- dpearson2699/swift-ios-skillstheir own version, first seen Jul 13, 2026
- joabgonzalez/ai-agents-skillstheir own version, first seen Jun 8, 2026
Used with
Projects with it also use api-security.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
jefflesterSkillapi-security
API security best practices and common vulnerability prevention. Enforces security checks for authentication, input validation, SQL injection, XSS, and OWASP Top 10 vulnerabilities. Use when building or modifying APIs.
Also in 3 projects that use this
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- dpearson2699/swift-ios-skills★ 1.2ksame name
- codewithmukesh/dotnet-claude-kit★ 750same name
- transilienceai/communitytools★ 555same name
- autosendhq/email-skills★ 18same name
- CheehooLabs/SpureeSkills★ 18same name
- joabgonzalez/ai-agents-skills★ 9same name
- pluginagentmarketplace/custom-plugin-backend★ 4same name
- jkaninda/okapi-skills★ 3same name
- Kur1sulab/blackbox★ 3same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
2 more not listed
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 repository79 other files it gives its agents.
- agent-dispatcherSkill
- agent-designSkill
- agent-evalsSkill
- context-engineeringSkill
- llm-observabilitySkill
- mcp-designSkill
- memory-designSkill
- model-routingSkill
- prompt-engineeringSkill
- prompt-injection-defenseSkill
- retrieval-ragSkill
- structured-outputSkill
- tool-designSkill
- api-contract-verificationSkill
- api-designSkill
- authorizationSkill
- background-jobsSkill
- cachingSkill
- idempotency-and-retriesSkill
- webhooksSkill
- database-migration-verificationSkill
- data-integritySkill
- data-pipelinesSkill
- data-qualitySkill
- migrationsSkill
- postgresSkill
- query-optimizationSkill
- schema-designSkill
- accessibilitySkill
- accessibility-verificationSkill
- design-systemsSkill
- design-to-codeSkill
- frontend-designSkill
- motion-designSkill
- responsive-designSkill
- ui-auditSkill
- ux-writingSkill
- ci-cdSkill
- deploymentSkill
- dockerSkill
- github-actionsSkill
- incident-responseSkill
- observabilitySkill
- release-verificationSkill
- rollbackSkill
- component-architectureSkill
- frontend-performanceSkill
- shadcn-uiSkill
- stack-detectionSkill
- tailwindSkill
- visual-verificationSkill
- competitive-analysisSkill
- copywritingSkill
- data-analysisSkill
- deep-researchSkill
- documentation-verificationSkill
- positioningSkill
- seoSkill
- source-evaluationSkill
- technical-writingSkill
- The first 60 shown.
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 9 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
- could be automatic: a setting could enforce it
- Distinctive: line 28
Use the framework's or provider's implementation: Do not write password hashing, token signing, or an OAuth flow yourself.
- Distinctive: line 42
Refresh and revocation are one design, not two: Keep refresh tokens in server-side state so they can be revoked, rotate them on each use, …
- Distinctive: line 58
Secrets come from the environment or a secret manager: Never a committed file, never a default baked into code.
“Common” is measured: kept by at least 6 in 10 of the 9 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.
Files
Authentication
Authentication answers one question: who is making this request? Every answer it produces is an input to authorization, never a substitute for it. A skill that conflates the two produces an app where being logged in is the only permission that exists.
When this fires
A credential is issued, accepted, refreshed or revoked. Adding login, wiring an identity provider, introducing an API key or token, changing session lifetime or cookie flags. It does not fire for "this user should not see that" — that is authorization.
Procedure
- Find the mechanism that already exists before adding one. Grep for session middleware, an
auth library in the dependency manifest, existing cookie names, a provider SDK,
Authorizationheader handling. Most "add auth" tasks are "extend auth". Two parallel auth systems is how a bypass gets built. - Name the client type, in writing, before any code. First-party browser app → server session
with a cookie. Third-party, native or mobile client → bearer token. Service to service →
client-credentials token or mutual TLS. This choice determines everything below; making it
implicitly is how a browser app ends up storing a long-lived token in
localStorage. - Use the framework's or provider's implementation. Do not write password hashing, token signing, or an OAuth flow yourself. If passwords are stored at all, hash with a memory-hard algorithm (argon2id, scrypt, bcrypt) through a maintained library — never a bare SHA, never a homemade salt scheme. When the library's current API matters, look it up rather than recalling it; auth APIs change and a stale call silently weakens the result.
- Sessions: identifier from a CSPRNG, state held server-side or in a signed cookie you can
invalidate. Cookie flags
HttpOnly,Secure,SameSite, a scopedPath, and an explicit expiry — all four, not three. Rotate the session identifier on login and on any privilege change. Logout deletes server-side state, not just the cookie. - Tokens: validate signature, issuer, audience and expiry on every request, and pin the
accepted algorithm on your side — never take the algorithm from the token's own header, and
reject
none. Verify against the provider's published key set, fetched and cached with rotation in mind. Short access-token lifetime is the containment; a stateless token cannot be recalled once issued. - Refresh and revocation are one design, not two. Keep refresh tokens in server-side state so they can be revoked, rotate them on each use, and treat reuse of a rotated token as theft: invalidate the family and force re-login. If you cannot revoke, say so plainly rather than implying you can.
- OAuth / OIDC: authorization code with PKCE for anything user-facing. Implicit flow and
resource-owner password grant are not options. Validate
stateon the callback, validatenoncein the ID token, and exact-match the redirect URI against an allowlist — prefix matching is an open redirect. The client secret never reaches a browser or a shipped binary; code is exchanged for tokens server-side. - Resolve identity at one choke point. Middleware turns a request into a principal or into anonymous, once. Handlers read that principal; they never parse the raw credential themselves. Scattered credential parsing guarantees one handler parses it differently.
- Fail closed and fail uniformly. Missing or bad credential → 401, generic message. Do not reveal whether an account exists, and keep the response shape and timing identical for unknown user and wrong password. Rate-limit and back off on credential endpoints, including password reset and token exchange.
- Secrets come from the environment or a secret manager. Never a committed file, never a default baked into code. Before rotating a signing key, changing a cookie name or shortening session lifetime on a running system, stop and ask — each of those logs every user out.
- Prove it by executing it. An auth change is verified by requests actually sent: valid
credential, absent credential, malformed credential, expired credential, and the refresh path.
Reading the diff is a review. Hand the proof to
api-contract-verification.
Checklist
- Existing mechanism found and extended, or its absence confirmed
- Client type named, and the session/token choice follows from it
- No hand-written crypto; library and its current API confirmed
- Cookie flags set, or token validation pins issuer, audience, expiry and algorithm
- Session identifier rotates on login and privilege change
- Refresh tokens revocable and rotated, or the absence of revocation stated
- OAuth: PKCE,
state,nonce, exact redirect-URI match, secret server-side only - One resolution point; handlers read a principal, not a credential
- Unauthenticated responses uniform, generic, rate-limited
- Secrets out of the repository; anything that logs users out was asked about first
- Valid, missing, malformed, expired and refresh paths executed, not reasoned about
Failure handling
- Login works but the session does not persist — read the actual
Set-Cookieon the wire before touching code. Domain,Path,Secureover plain HTTP, andSameSiteon a cross-site callback account for most of these, and none of them are visible in the source. - Token validates in one service and not another — compare issuer, audience and clock skew before suspecting the key. Shared secrets that "work locally" usually mean validation is being skipped somewhere.
- The provider's flow does not behave as documented — capture the exact callback parameters and error code and report them. Do not loosen redirect-URI matching, disable state checks, or skip signature verification to get past it. That is not a workaround, it is the vulnerability.
- No way to test the provider without production credentials — say the flow is unverified and name which step is unproven. Do not report an OAuth integration as working because the code compiles.
Evidence to report
Which mechanism is in use and why that client type chose it; the cookie flags or the exact token claims validated; where identity is resolved, as a file and function; the requests actually executed and their statuses, including the failure and refresh paths; anything that could not be executed, named. "Auth added" with none of that is a claim, not evidence.
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.

