auth
Skill4 starsChanged 32 days agoMITView on GitHub
This skill should be used when adding authentication or authorization to an app or SaaS — login, signup, sessions, tokens, roles, permissions, multi-tenant access, SSO, or social login. Trigger phrases include "add login", "add auth", "sign in with Google", "protect this route", "user roles", "admin permissions", "JWT or sessions", "which auth provider", "RBAC", "multi-tenant access", "who can see what", "magic link", "SSO". It picks the right provider and pattern instead of rolling auth from scratch.
20 other projects use a version of this.
Adopted by
Most recently taken up by
- crbnos/carbontheir own version, first seen Nov 7, 2026
- marcusbelz/di2-starter-kittheir own version, first seen Oct 31, 2026
- jars-demo/jars-skillstheir own version, first seen Oct 25, 2026
- nurmdrafi/pi-nativetheir own version, first seen Oct 25, 2026
- openai/pluginstheir own version, first seen Oct 13, 2026
- build-dezineer/skills-nuxt4-tw-webapptheir own version, first seen Oct 13, 2026
Used with
Projects with it also use ci-cd, error-handling and 7 more.
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.
JohnJBorenSkillci-cd
CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies
Also in 4 projects that use this
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 5 projects that use this
diego-tobalinaSkilllogging
Logging best practices for Java (SLF4J/Logback) and Node.js (Winston/Pino). Use for structured logging, log levels, and avoiding sensitive data exposure.
Also in 3 projects that use this
SentrySkillgithub-issues
Create, update, comment on, label, and inspect GitHub issues with concise, evidence-backed content. Use when users ask to open, edit, view, close, reopen, or triage GitHub issues — including tracking bugs, features, or tasks. Prefer this skill over generic repository tools for issue operations; do not use for pull requests, branches, pushes, or PR creation order questions.
Also in 3 projects that use this
wrsmith108Skilldocker
Container-based development for isolated, reproducible environments. Use when running npm commands, installing packages, executing code, or managing project dependencies. Trigger phrases include "npm install", "run the build", "start the server", "install package", or any code execution request.
Also in 3 projects that use this
MicrosoftSkilltypescript
TypeScript best practices for this monorepo. Use this skill when: (1) writing new TypeScript code, (2) reviewing TypeScript code, (3) working with API responses, fetch calls, or JSON parsing, (4) adding or modifying types and interfaces.
Also in 3 projects that use this
- +1 more from microsoft
Other versions20 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 20
- openai/plugins★ 7.8ksame name
- epicenter-md/epicenter★ 4.8ksame name
- EpicenterHQ/epicenter★ 4.8ksame name
- danielmeppiel/apm★ 4.2ksame name
- microsoft/apm★ 4.2ksame name
- crbnos/carbon★ 2.8ksame name
- vercel/vercel-plugin★ 328same name
- kagenti/kagenti★ 303same name
- kid-sid/claude-spellbook★ 190same name
- YepAPI/skills★ 8same name
10 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 repository21 other files it gives its agents.
- accessibilitySkill
- ai-featuresSkill
- api-designSkill
- architecture-primerSkill
- data-modelingSkill
- deploymentSkill
- design-taste-frontendSkill
- frontend-performanceSkill
- image-to-codeSkill
- integrationsSkill
- landing-pageSkill
- multi-tenancySkill
- paymentsSkill
- pre-ship-securitySkill
- product-discoverySkill
- pwaSkill
- rls-auditSkill
- saas-routerSkill
- secure-codingSkill
- technical-seoSkill
- ui-designSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 17 edited versions we read keep these.
5
Distinctive
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 19
Do you need enterprise SSO (SAML/OIDC) for buyers — now or soon?
- Distinctive: line 39
Keep authorization out of the JWT body beyond coarse role hints — baked-in roles go stale until expiry and can't be revoked.
- Very specific: line 44
Add ABAC/policy rules: only when access depends on attributes: resource owner, department, plan tier, time.
- Distinctive: line 51
Use OAuth/OIDC via the provider for social + SSO logins — never handle raw third-party password flows yourself.
- Distinctive: line 65
Log out, then replay the old refresh token: If it still mints access tokens, logout is cosmetic.
- Distinctive: line 66
Test in Safari: when the backend is on a different domain: its refresh cookie is a third-party cookie.
“Common” is measured: kept by at least 6 in 10 of the 17 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
Auth
This skill makes the two decisions every SaaS gets wrong: which auth provider and how to model permissions. It picks a vetted provider over hand-rolled auth, and a permission model that fits the product.
Analogy: auth is the lock and the guest list for your building. You don't forge your own lock (you'd leave it pickable) — you buy a good one and decide who gets which key.
The one rule
Don't roll your own auth. Password hashing, session rotation, OAuth flows, and reset tokens are where subtle, catastrophic bugs live. Use a provider or a battle-tested library. (Pairs with the secure-coding skill, which covers the OWASP auth-failure defenses.)
Discovery (max 3 questions, only if unknown)
- Is this B2C (individual users) or B2B (organizations/teams with members)?
- Do you need enterprise SSO (SAML/OIDC) for buyers — now or soon?
- What's the stack/backend — Supabase, plain Vercel + Postgres, or full-stack TypeScript?
Step 1 — Pick the provider (decision tree)
| Situation | Use | Why |
| Building with an agent / on InsForge | InsForge Auth | Agentic-native — the agent wires auth + RLS through its own skills/MCP; every query scopes to the user in SQL. |
| Already on Supabase | Supabase Auth | Free, RLS-native — every query scopes to the user in SQL. Most-proven ecosystem. |
| Want the best React DX / drop-in components, not tied to a backend | Clerk | Best components, orgs/teams built in. ~$0.02/MAU after a free tier. |
| Full-stack TypeScript, want self-hosted control | Better Auth (~28k⭐) | TS-native, framework-agnostic, orgs/RBAC/passkeys/SSO. |
| Enterprise SSO is a buyer requirement | Auth0 / WorkOS | SAML/OIDC, directory sync, the enterprise checkboxes. |
Default for a fresh React + Vite + Postgres SaaS with no SSO need: InsForge Auth if you're building agent-first, Supabase Auth if on Supabase, or Clerk otherwise. All three scope to the user via RLS — match the auth host to the DB host from the data-modeling skill.
Step 2 — Sessions vs JWT
- Classic web app → server-side sessions in an httpOnly, Secure, SameSite cookie. Easy revocation, no token-in-JS exposure.
- Stateless API / mobile / microservices → short-lived JWT access token + refresh token.
- Never store JWTs in
localStorage(XSS-readable). Cookie or in-memory only. - Keep authorization out of the JWT body beyond coarse role hints — baked-in roles go stale until expiry and can't be revoked. Check permissions server-side per request.
Step 3 — Model authorization (RBAC by default)
- Default to RBAC: a small set of roles —
owner / admin / member / viewer. Covers most SaaS. - Add ABAC/policy rules only when access depends on attributes: resource owner, department, plan tier, time. Example: "edit invoice only if
role=managerAND samedepartment." - Centralize the check in one middleware/guard or policy layer. Never scatter
if (role === 'admin')across handlers — that's how a forgotten check becomes a breach.
Step 4 — Multi-tenant scoping (B2B)
- Scope every authz check by
tenant_id/org_id. A valid user of org A must never read org B. - Let Postgres Row-Level Security be the backstop (see the
data-modelingskill) so even a missed app-layer check can't leak across tenants. - Use OAuth/OIDC via the provider for social + SSO logins — never handle raw third-party password flows yourself.
Delegation & fallback
- Provider available → wire it (InsForge/Supabase/Clerk/Better Auth) and configure roles/orgs through it. On InsForge, its
insforgeandinsforge-integrationsskills wire auth — including external providers (Clerk/Auth0/WorkOS) into JWT-based RLS — so the agent sets it up end to end. - No provider chosen / offline → fall back to a well-known library (Better Auth or Lucia), httpOnly cookie sessions, bcrypt/argon2 password hashing, and the RBAC pattern above. Never block on a missing provider.
Step 5 — Verify the guard from outside
Auth that has not been attacked with curl is assumed, not known. Before calling it done:
- Request every protected route with no session and look at the response body size, not just the status. A redirect can carry the fully rendered page.
- Put the guard where it runs before rendering (middleware), not in a layout — and confirm the middleware file is in the location your framework actually loads.
- The server validates the session token with the provider. A readable cookie is not identity.
- Log out, then replay the old refresh token. If it still mints access tokens, logout is cosmetic.
- Test in Safari when the backend is on a different domain: its refresh cookie is a third-party cookie.
- OAuth callback is a public route that exchanges the code; redirect parameters accept only paths starting with a single
/.
Field notes
references/field-notes.md holds 15 auth failures from production apps. The three that cost the most:
- A 307 redirect to login that carried 441 KB of customer data in its body.
- A middleware file in the wrong directory that never executed.
- Blank screens with no error: queries running as anonymous and RLS returning empty lists.
Output
Deliver: the provider recommendation with a one-line reason, the session/token decision, a concrete role model for this product, the protected-route guard wired in, and the multi-tenant scoping rule if B2B.
Reference
InsForge Auth (~5k⭐, agentic-native), Better Auth (~28k⭐), Auth.js/next-auth (~28k⭐), Clerk, Supabase Auth (part of supabase ~104k⭐).
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.

