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.
npx skills add iwritec0de/app-dev --skill auth-patternsgit clone --depth 1 https://github.com/iwritec0de/app-devWrote 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.
[](https://agentmods.dev/skills/iwritec0de/app-dev/auth-patterns)<a href="https://agentmods.dev/skills/iwritec0de/app-dev/auth-patterns"><img src="https://agentmods.dev/badge/skills/iwritec0de/app-dev/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.
<a href="https://agentmods.dev/skills/iwritec0de/app-dev/auth-patterns"><img src="https://agentmods.dev/badge/skills/iwritec0de/app-dev/auth-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00129 | $0.01795 |
| Opus 5.5 | $0.00052 | $0.00718 |
| Sonnet 5.5 | $0.00026 | $0.00359 |
| Haiku 4.5 | $0.00013 | $0.00179 |
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 3mo ago.
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.
How it starts
The opening of the file, as written. The whole thing — 236 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Authentication & Authorization Patterns
JWT Authentication
Token Structure
Header.Payload.Signature
Header: { "alg": "RS256", "typ": "JWT" }
Payload: { "sub": "user-123", "iss": "myapp", "aud": "myapp-api", "exp": 1700000000, "iat": 1699999000 }
Signature: RS256(header + "." + payload, privateKey)
Access + Refresh Token Pattern
Login → Access Token (15 min) + Refresh Token (30 days)
│ │
├── Use for API calls ├── Use to get new access token
├── Short-lived ├── Long-lived
├── Stateless ├── Stored in DB (revocable)
└── In httpOnly cookie └── In httpOnly cookie (separate)
Implementation Checklist
| Check | Details |
|---|---|
| Algorithm | Use RS256 for multi-service, HS256 for single service |
| Secret/Key | ≥256 bits, stored in env var, rotatable |
| Expiration | Access: 15-60 min. Refresh: 7-30 days |
| Storage | httpOnly + secure + sameSite cookies |
| Validation | Verify signature, exp, iss, aud on every request |
| Refresh | Rotate refresh token on use (invalidate old one) |
| Revocation | Store revoked tokens or use token version in DB |
| Logout | Invalidate refresh token, clear cookies |
Token Storage Comparison
| Method | XSS Safe | CSRF Safe | Recommendation |
|---|---|---|---|
| httpOnly cookie | Yes | Need SameSite/token | Recommended |
| localStorage | No | Yes | Never for auth tokens |
| sessionStorage | No | Yes | Never for auth tokens |
| Memory (variable) | Yes | Yes | OK for SPAs (lost on refresh) |
Password Security
Hashing
// CORRECT — bcrypt with sufficient rounds
import bcrypt from 'bcrypt';
const hash = await bcrypt.hash(password, 12);
const valid = await bcrypt.compare(password, hash);
// CORRECT — argon2 (preferred for new projects)
import argon2 from 'argon2';
const hash = await argon2.hash(password);
const valid = await argon2.verify(hash, password);
// NEVER — these are NOT for password hashing
// MD5, SHA-1, SHA-256 (even with salt)
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.
- 3mo ago First seen · 236 lines · 129 tokens per session scan A dcde8dfd2f92
auth-patterns is a skill published in the GitHub repository iwritec0de/app-dev (3 stars, last pushed 7mo ago), licensed MIT. It adds 129 tokens to every session and 1,795 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.
auth-patterns compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| auth-patternsiwritec0de/app-dev | Skill | 3 | 7mo ago | MIT | A | 129 | Claude Code |
| api-designcbrock84/headcount | Skill | 2.6k | today | MIT | A | 64 | Claude Code |
| ash-frameworkoliver-kriska/claude-elixir-phoenix | Skill | 578 | 3d ago | MIT | A | 48 | Claude Code |
| liveview-patternsoliver-kriska/claude-elixir-phoenix | Skill | 578 | 3d ago | MIT | A | 51 | Claude Code |
| obanoliver-kriska/claude-elixir-phoenix | Skill | 578 | 3d ago | MIT | A | 51 | Claude Code |
| perfoliver-kriska/claude-elixir-phoenix | Skill | 578 | 3d ago | MIT | A | 50 | Claude Code |
| tidewave-integrationoliver-kriska/claude-elixir-phoenix | Skill | 578 | 3d ago | MIT | A | 38 | Claude Code |