/everything-backend:backend-authfrom everything-backend
Designs, implements, and hardens authentication and authorization for backend services: sessions, JWT, OAuth 2.0/OIDC, SSO, API keys, MFA, RBAC/ABAC, tenant isolation, CSRF, and password flows. Writes auth core code, records decisions in project memory, and defines negative tests.
Ships in everything-backend. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Owns how callers prove who they are (AuthN) and what they may do (AuthZ). It designs the mechanism, writes the auth core code, persists the decision, and hands the negative-test matrix to backend-test.
Not this skill:
backend-security. It hands auth fixes back here.backend-db-design, write and apply with backend-migrate.backend-implement, consuming the auth contract this skill records.backend-debug, which may call this skill for the fix design.mode=auto and mode=interactive follow <shared>/tool-rules.md -> mode=auto Contract. This skill never redefines it.
<shared>): first _shared/ inside this skill's folder (bundled installs), then ../_shared/ next to it; other fallbacks are in <shared>/context-loading.md -> Resolving _shared/ Files. A missing shared doc is a warning, not a stop.<shared>/tool-rules.md (mode=auto contract, checkpoints) and <shared>/host-tools.md if the action names below don't map clearly to your host's tools. Read <shared>/principles.md -> Security, <shared>/sql-safety.md (rules for every query the auth core, repositories, and login touch) and <shared>/secure-coding.md -> S3, S11, S12, S13 and S14 (access checks, credentials and tokens, crypto and randomness, secrets, cookies, CORS and CSRF). If either is missing, warn once and use this skill's Non-Negotiable Rules as the baseline.<shared>/context-loading.md: project-overview.md, tech-stack.md, api-patterns.md (existing auth conventions), and db-schema.md (user and membership tables). Load decisions.md for prior auth decisions and issues.md in review mode. If memory is empty, run backend-scan first when possible; otherwise continue from the manifest and code.<shared>/stacks/ (e.g. node-typescript.md, python-fastapi.md, postgres.md), read it for library and framework wiring.mode=auto this is a Pause for ambiguity, not a per-step prompt.feature=auth-login) for checkpoints.Output: principals, clients, tenancy model (single or multi-tenant), and mode.
jwt, jose, jsonwebtoken, PyJWT, passport, session, cookie, bcrypt, argon2, csrf, authorize, permission, role, tenant, X-Tenant, set_config.api-patterns.md -> Authentication and any auth entries in decisions.md. Reuse what exists; propose changes as diffs, not rewrites.Output: inventory of current mechanism, libraries, and gaps (file:line).
| Client / need | Default |
|---|---|
| Server-rendered app, same-site SPA, admin dashboard | Server-side session in a hardened cookie, or a BFF |
| Mobile, third-party clients, stateless APIs | Short-lived access JWT + rotated opaque refresh token |
| Sign-in with external IdP, delegated access | OAuth 2.0 / OIDC authorization code + PKCE |
| Enterprise customers | SSO (OIDC or SAML) + SCIM via an IdP |
| Machine-to-machine, public API product | Scoped, hashed, revocable API keys, or OAuth client credentials |
| Service-to-service inside a platform | mTLS or scoped service tokens; verify user JWTs locally via JWKS |
Prefer a managed IdP or the framework's auth module over custom login code; never write your own crypto.
Output: mechanism with rationale.
Apply the Non-Negotiable Rules below. Decide and write down: lifetimes, storage, signing algorithm and key location, refresh rotation, revocation path, session timeouts, password policy, recovery flow, MFA scope.
Output: token/session design and credential-flow decisions.
role, tenant_id, or ownership through generic updates.tenant_id (and the owner) from the principal in the same statement, as bound parameters (<shared>/sql-safety.md -> The Rules, rule 3; snippets in references/authorization.md -> Tenant-Scoped Authorization).Output: AuthZ model (RBAC/ABAC/ownership), permission matrix, tenancy enforcement.
User, session, refresh-token, reset-token, MFA, API-key, membership tables, indexes, tenant_id columns and RLS policies are schema changes. Describe them (see references/credentials.md -> Identity Tables) and hand them to backend-db-design for the model and backend-migrate to write and apply. This skill never writes or applies migrations.
Output: schema handoff list.
In mode=interactive, show the design and wait for the user to accept it. In mode=auto, continue unless a Pause for ambiguity applies (e.g. two reasonable mechanisms with different security trade-offs and nothing in the request or memory to choose between them).
Start a checkpoint before the first edit: node <shared>/scripts/checkpoint.js start --skill backend-auth --feature <slug>. Record each file you create or edit (checkpoint.js record), snapshot after each step, and close it when done. If Node is unavailable, follow <shared>/tool-rules.md -> Concurrent & Partial Work by hand. If start exits with code 3, offer the user resume or restart.
Write, in this order, using the stack file for library calls:
authenticate middleware: attach the verified principal or continue as anonymous; invalid token -> 401; infrastructure errors propagate as 5xx. requireAuth, requireRole / requirePermission.<shared>/sql-safety.md -> The Rules, rules 1, 3, 4).Feature endpoints that use these pieces belong to backend-implement. Editing .env*, key files, or CI config is Always Ask First.
Output: changed files list, recorded in the checkpoint.
decisions.md (format: references/verification-and-review.md -> decisions.md Entry). Mark a replaced auth decision Deprecated with Superseded by.api-patterns.md -> Authentication with the short auth contract (mechanism, verification parameters, CSRF method, where AuthZ lives, tenancy rule). backend-implement, backend-test, and backend-security read it.tech-stack.md -> Auth with the libraries used.<shared>/memory-schema.md formats; record memory files in the checkpoint (--memory).Output: memory entries written.
references/verification-and-review.md, keeping only rows that apply, and hand it to backend-test to write and run. Do not mark failing tests skipped or loosen them (<shared>/tool-rules.md -> Test Integrity).node <shared>/scripts/checkpoint.js close --skill backend-auth --feature <slug>.Done when:
alg: none, wrong-iss and wrong-aud tokens rejected with 401; a user denied another user's resource; a tenant A principal denied tenant B's resource (404) including a spoofed tenant_id; a cookie-authenticated state-changing request without a valid CSRF token rejected (403); refresh-token reuse revoking the family (if refresh tokens exist); identical responses for unknown user and wrong password.<shared>/sql-safety.md -> Verification, item 4 (the Injection and Tenancy rows of the matrix): injection payloads in id, filter, sort, and search parameters, operator objects in login bodies, and another tenant's or user's id on read, update, and delete return 400 or 404, never extra rows, a 500, or a changed row count.<shared>/sql-safety.md -> Verification, item 5). If one does, the change is not done.decisions.md and api-patterns.md -> Authentication are updated.backend-migrate, not applied here.If tests cannot run (no test setup, non-local targets per Production Targets), report the matrix as pending and say so; do not claim done.
references/verification-and-review.md and record evidence (file:line) for every item.issues.md (format: <shared>/memory-schema.md -> issues.md). This memory write needs a checkpoint like any other file write (--feature auth-review, record with --memory).backend-security.Done when every checklist item has evidence or "not applicable", findings are reported and logged, and no source or config file was changed without approval.
These hold in every mode and every stack. Detail and per-library calls: references/tokens-and-sessions.md.
JWT verification
none; never let the header pick the algorithm; never use an RSA/EC public key as an HMAC secret.iss (exact), aud (contains this service), exp (required), nbf (if present), leeway 60 s or less. Require typ: at+jwt when the issuer sets it.kid only from a configured JWKS URL; ignore jku, x5u, jwk headers; cache keys; on unknown kid refetch at most once per cooldown, then reject.jti denylist or per-user tokens_valid_after; refresh rotation with reuse detection that revokes the family.Credentials
Sessions and browser credentials
HttpOnly, Secure, SameSite=Lax or Strict, __Host- prefix where possible. Never sensitive tokens in localStorage.Sec-Fetch-Site checks) on every state-changing request whenever the browser sends credentials automatically. SameSite=None requires a CSRF token. GET never changes state.Cache-Control: no-store. CORS uses an exact allowlist; never * or reflected origins with credentials.Authorization and tenancy
tenant_id and user identity come only from the verified principal, never from body, query, or headers unless membership is checked server-side.WHERE id = $1 AND tenant_id = $2), never from the request (<shared>/sql-safety.md -> The Rules, rule 3). RLS with transaction-local set_config is a second layer, not a replacement. Cross-tenant lookups return 404.Design mode returns:
backend-db-design / backend-migrate.backend-test).Review mode returns the findings list (severity-ordered, with evidence and next skill) and the checklist coverage.
| To | When |
|---|---|
backend-db-design -> backend-migrate | Any identity, token, membership, or RLS schema change |
backend-implement | Feature endpoints that consume the auth contract |
backend-test | Writing and running the negative-test matrix |
backend-security | Full security review, secret scanning, SAST, dependencies |
backend-debug | A reproducible auth bug outside a design change |
backend-ops / backend-deploy | Secret manager wiring, key rotation schedule, JWKS hosting |
references/authn-mechanisms.md: read when choosing a mechanism, configuring an OAuth/OIDC client, SSO/SCIM, API keys or webhook secrets, or deciding build vs buy.references/tokens-and-sessions.md: read when writing JWT verification, refresh rotation, revocation, signing-key rotation, token storage, or session hardening.references/credentials.md: read when building signup, login, password hashing, password policy, account recovery, MFA, or the identity tables to hand off.references/authorization.md: read when designing roles, permission matrices, ownership checks, tenant isolation/RLS, tenant- or owner-scoped repository queries, mass-assignment protection, or writing auth middleware.references/security-defaults.md: read when adding rate limiting, security headers, CORS, CSRF protection, or secret handling.references/verification-and-review.md: read when building the negative-test matrix, running review mode, or writing the design doc and memory entries.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
authentication, authorization, jwt, oauth, rbac, security-hardening
npx claudepluginhub codeworksid/everything-backend --plugin everything-backend16 skills in this plugin
/backend-api-designDesigns API contracts before code is written: resources, endpoints, request and response schemas, error format, pagination, versioning and per-endpoint authorization rules. Writes the contract to an OpenAPI spec (docs/api/openapi.yaml by default, or the existing spec) and records conventions in api-patterns.md memory. REST is fully covered; GraphQL schemas and gRPC .proto contracts get basic guidance. Use when the user says 'design the API', 'what endpoints do I need', 'plan routes', 'write an OpenAPI spec', 'Swagger', 'define the API contract', 'design a GraphQL schema', 'write a proto file', 'add an endpoint to the spec', or 'version or deprecate an endpoint'. Not for writing handler code (backend-implement), choosing the login mechanism or auth endpoints (backend-auth), or reviewing API security (backend-security)./backend-architectDesigns backend architecture for new and existing systems, including architecture pattern (monolith, modular monolith, microservices, serverless), tech stack, module boundaries, consistency rules and non-functional targets, then records the result as docs/architecture/overview.md, numbered ADR files in docs/adr/ and project memory. Use when the user says "design the architecture", "plan the backend", "how should I structure this", "what tech stack should I use", "should we split into microservices", "write an ADR", "redesign this system", or is starting a new project or a major feature. Hands diagrams to backend-visualize and detailed schema and API work to backend-db-design and backend-api-design.Other plugins' skills for the same job