/quality-gates:login-and-accessfrom quality-gates
Guides implementation and review of authentication, authorization, sessions, and access control patterns including passwords, OAuth, MFA, JWTs, and role-based permissions.
Ships in quality-gates. 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.
Three questions decide every login bug: who signs in (authentication), how long they stay in (sessions) and what each person can see (authorisation). When writing code, follow the rules. When reviewing, run Review.
Use the auth library or provider the repo already has (Auth.js, Clerk, Supabase Auth, Better Auth, Devise, Django auth, Spring Security, ...). Do not write your own sessions, JWT handling, password hashing or crypto. In a repo with none, or when a rule here would change the session model, provider or role model, give the options in one line each and ask; do not choose silently.
state and nonce. Register exact redirect URIs (no wildcards, no open redirect after login). Verify the ID token's signature, iss, aud and exp. Identify the user by provider plus sub, not by email.Host header. A successful reset signs out every other session.HttpOnly, Secure, SameSite=Lax (Strict for admin), Path=/, ideally the __Host- prefix. Never in localStorage or sessionStorage, never in a URL.none and HS/RS confusion). Check exp, nbf, iss and aud with small clock skew. Never put secrets or personal data in the payload; anyone can read it.SameSite plus a CSRF token or an Origin check. GET never changes state.where id = ? and org_id = session.orgId. An id from the request is a guess until the scope confirms it. Answer 404 for rows the caller may not see, so ids cannot be probed.can(user, action, resource), CASL, Pundit, Django permissions). If there is none, write one function rather than scattering role checks across handlers.Cache-Control: private or no-store. Signed file URLs are created after the permission check and expire within minutes.Log sign-in success and failure, MFA and password changes, role changes, impersonation and session revocation: who, when, from where, and the result. Never log passwords, codes, tokens or session ids.
Every new protected route or action gets at least these tests, using the repo's test setup:
git diff plus staged) or the files named, plus the auth config, middleware and permission helper they rely on.Report findings in the security-code-audit format (<file>:<line> [SEVERITY] <weakness>, Path, Exploit, Fix) and severities. Start with the access matrix:
## Verdict: PASS | FIX BEFORE MERGE | BLOCK
| Entry point | Anonymous | User | Owner | Other tenant | Admin |
|---|---|---|---|---|---|
| `POST /api/projects/:id` | 401 | 404 | ok | 404 | ok |
### Findings
### Missing tests
### Not checked
.env or key files. Never sign in to, or test against, a live system or real account.Key decisions in this skill: choosing or changing the auth provider, the session model (server session or JWT), timeout values, the role or tenant model, and a BLOCK verdict.
Before acting on one, get a second opinion: call the Agent tool with model: "opus" (subagent_type Plan, read-only). Give it the decision, each option in one line, the evidence (file:line, measurements, the diff) and the constraints. Ask for a pick, the main risk of that pick, and what would change its mind. Do not send secrets or .env contents.
Advisor: <decision> -> <pick> (<agreed | overruled because ...>).Spend the strong models on judgment and the cheap ones on volume. When this skill spawns subagents with the Agent tool, set model by role:
| Role | Model | Use for |
|---|---|---|
| Think | fable (Fable 5.2), or opus when limits are tight | Plan, decompose, pick an approach. One call, read-only (subagent_type: "Plan"). |
| Execute | sonnet (Sonnet 5.5) | Write and edit code, run checks, produce the deliverable. |
| Review | opus (Opus 5.5) | Check the finished work before reporting: correctness, security, money, data loss. |
| Swarm | haiku (Haiku 5.5) | Many small parallel jobs: search, read, extract, classify, per-file scans. |
mcp__ccd_session_mgmt__get_usage (load it with ToolSearch if deferred). Use fable only when every window has room: 5-hour limit under 70% used, "Weekly · all models" under 80%, and "Weekly · Fable" (if listed) under 80%. Otherwise use opus. If the tool is missing, or its status is unavailable or not_applicable (API key, Bedrock, Vertex), use opus. Say the pick in one line: Think: <model> (5h <n>%, weekly <n>%, Fable <n>%).Lessons from earlier runs live in two files: ~/.claude/skill-lessons/login-and-access.md (any repo) and .claude/skill-lessons/login-and-access.md at the repo root (this repo only).
- <YYYY-MM-DD>: <do or avoid X> because <Y>. (seen: 1). When a line already says the same thing, raise its seen count and date instead of adding one. Facts about this repo go in the repo file, everything else in the user file. Keep each file under 30 lines by merging or dropping stale lessons.seen: 3: if the ashish-claude-skills source repo is open, propose the edit to plugins/quality-gates/skills/login-and-access/SKILL.md as a diff and wait for a yes, then delete the lesson once it lands; otherwise say Lesson ready to promote: <line> in the report.Learned: <the line written | nothing>.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub ashishyd/ashish-claude-skills --plugin quality-gates10 skills in this plugin
/claude-md-syncUse after changing business logic, domain rules, data models, APIs, architecture, commands, config or dependencies, before calling the work done, to keep CLAUDE.md true to the code. Also when the user says "update CLAUDE.md", "sync the docs" or "is CLAUDE.md still right"./design-auditUse when a UI component, page or stylesheet has just been built or changed and its visual quality needs checking, when the user asks whether a screen looks right, consistent or polished, or before shipping front-end work./personal-dataUse when writing, changing or reviewing code that stores, reads, sends, logs, exports or deletes information about people (users, customers, clients, patients, children, employees), including new database columns or tables, migrations, forms, analytics or tracking events, error reporting, third-party APIs, AI prompts, data exports, account deletion, consent, cookie banners, retention jobs, or questions about GDPR, CCPA, LGPD, DPDP or other privacy laws./playwright-testsUse when writing, generating or fixing Playwright end-to-end tests, covering a user journey in a real browser, choosing locators, handling login state or test data, or when an e2e test is flaky, slow or times out./security-code-auditUse when writing, changing or reviewing code that handles user input, forms, auth, passwords, sessions, tokens, API keys, secrets, env vars, permissions, database queries, file uploads, webhooks, payments or a new API route, or when the user asks for a security review of a diff, a file or a feature./threat-modelUse when planning or designing a feature, service or integration that adds a new entry point, before a launch or a major release, when changing deploy, infrastructure, CI/CD, hosting or network config, when asked where an attacker could break in, for a threat model, attack surface review, launch security checklist, penetration test plan or scope, or when setting up security scanning.Other plugins' skills for the same job