auth-patterns

auth-patterns is a skill for Claude Code, Codex from kouroshez/coding-os. It costs 118 tokens per session (4,095 once invoked), scanned A, original, Apache-2.0.

A guide to authentication, which verifies who users are, and authorization, which controls what they are allowed to do.

In plain words
What is it for?
Use it when adding or reviewing sessions, JWTs, OAuth login, magic links, passkeys, two-factor authentication, password resets, cookies, and role or relationship-based permissions.
Why use it?
It helps avoid insecure sign-in, token, password-reset, multi-factor authentication, and permission designs.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it when adding or reviewing sessions, JWTs, OAuth login, magic links, passkeys, two-factor authentication, password resets, cookies, and role or relationship-based permissions.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kouroshez/coding-os/auth-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add kouroshez/coding-os --skill auth-patterns
Clone the repo
git clone --depth 1 https://github.com/kouroshez/coding-os

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for auth-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/kouroshez/coding-os/auth-patterns/github.svg)](https://agentmods.dev/skills/kouroshez/coding-os/auth-patterns)
Your own site
<a href="https://agentmods.dev/skills/kouroshez/coding-os/auth-patterns"><img src="https://agentmods.dev/badge/skills/kouroshez/coding-os/auth-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for auth-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/kouroshez/coding-os/auth-patterns"><img src="https://agentmods.dev/badge/skills/kouroshez/coding-os/auth-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,095 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 13 findings, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Data Exfiltration · line 28
    Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.
    Fix: Read only explicitly required environment variables by name. Avoid enumerating or copying the full environment, and never log or transmit credentials to untrusted destinations.
  • high Privilege Escalation · line 57
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 281
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 283
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 284
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 285
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 286
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 289
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 292
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 87
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 88
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 231
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
  • high Privilege Escalation · line 281
    Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
    Fix: Remove references to credential paths. Use environment variables or secrets managers. For docs, use placeholder paths (e.g., /path/to/config). Never load .env or token files in production code paths.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00118 $0.04095
Opus 5.5 $0.00047 $0.01638
Sonnet 5.5 $0.00024 $0.00819
Haiku 4.5 $0.00012 $0.00409

Measured 1mo ago against content hash ca5b1c7002ed, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

auth-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/cookie-flag-check.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

src/core/skills/auth-patterns/SKILL.md · 353 lines

How it starts

The opening of the file, as written. The whole thing — 353 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Auth Patterns — Sessions, Tokens, Identity

Practical authentication + authorization patterns for the project's stack: React Native client → Go+Fiber business backend → Python+FastAPI AI adapter → PostgreSQL. Designed around 2026-current best practices and the realistic threat model of a consumer mobile app.

When to Use This Skill

  • Adding sign-in to a new service.
  • Choosing JWT vs opaque sessions for the RN ↔ Go ↔ FastAPI token chain.
  • Designing refresh-token rotation + revocation.
  • Integrating a hosted identity provider (Better-Auth, Clerk, Auth0, WorkOS).
  • Implementing magic-link / OTP / passkey flows.
  • Adding 2FA (TOTP + backup codes).
  • Defining the permissions model — RBAC vs ABAC vs ReBAC.
  • Designing the password reset flow (it's the most-broken thing in most apps).
  • Hardening an existing auth surface — cookie flags, CSRF, header rules.

Default Stack — One Sentence

Server-side opaque sessions stored in Postgres + a short-lived signed access JWT for service-to-service hops. The RN app holds the opaque session token in Keychain/Keystore. The Go backend exchanges that for a 5-minute service JWT when it needs to call the FastAPI AI adapter. No long-lived JWTs anywhere on the client.

This combines the revocability of sessions, the statelessness of JWTs where it matters (between services), and the robust mobile storage of native secure stores.

For the alternatives and when each is right, see references/sessions-vs-jwt.md.

Core Decision: Session vs JWT

Factor Server sessions (opaque token) JWT (signed claims)
Revocation Instant — delete row Hard — needs blocklist or short TTL
Read cost per request DB lookup (or Redis) Verify signature (cheap)
Cross-service auth Need to share session store or call back Self-contained, just verify
Mobile-friendly Trivial (any opaque token) Same
Browser-friendly Cookies + CSRF protection Cookies, header, or localStorage (each with risks)
Auditable Easy — table of active sessions per user Hard unless you track usage
Logout-from-all-devices DELETE WHERE user_id = X Only with a per-user revocation versioning trick

Read the full file on GitHub · 353 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 353 lines · 118 tokens per session scan A ca5b1c7002ed

Subscribe to this mod's changes

auth-patterns is a skill published in the GitHub repository kouroshez/coding-os (6 stars, last pushed 5d ago), licensed Apache-2.0. It adds 118 tokens to every session and 4,095 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

potpie-repo-baseline

Use when establishing, refreshing, or deeply understanding a repository's baseline memory in Potpie: purpose, application type, features, services/modules, environments, deploy shape, dependencies, API contracts, datastores, integrations, ownership, and explicit preferences. The harness reads authored and…

potpie-ai/potpie · 75 tokens

potpie-infra-architecture

Use for project infra and architecture context: environments, adapters, runtime configuration, deployments, service dependencies, datastores, API contracts, ownership, incidents, and dependency blast radius.

potpie-ai/potpie · 43 tokens

potpie-project-preferences

Use before writing, modifying, reviewing, refactoring, or testing code so repo/project preferences surface: error handling, file structure, frameworks, logging, dependency choices, testing, security, API style, and naming. Also use after code work when a reusable project preference should be recorded.

potpie-ai/potpie · 63 tokens

bi-causal-attribution

A business-analysis skill that links business events in reports, plans, release notes, or conversations with an unusual metric change. It produces and ranks possible causes supported by the available evidence.

agentscope-ai/QwenPaw-Data · 76 tokens

browser-2471a991

An HTTP request builder for assembling a GET request with a host and headers. HTTP is the standard format browsers and servers use to exchange web requests and responses.

FuRongJun-1999/dsh-memory · 90 tokens

browser-e947a564

An HTTP cache pattern using ETags, which are server-provided identifiers for a response version. The browser sends the ETag back to ask whether the resource has changed.

FuRongJun-1999/dsh-memory · 97 tokens