auth-implementation-patterns

auth-implementation-patterns is a skill for Claude Code, Codex from HermeticOrmus/LibreUIUX-Claude-Code. It costs 46 tokens per session (4,015 once invoked), scanned A, a copy of auth-implementation-patterns, MIT.

A guide to verifying user identities and controlling what authenticated users are allowed to do, covering passwords, sessions, tokens, social login, and roles.

In plain words
What is it for?
Use it to build login systems, secure REST or GraphQL APIs, add OAuth2 or social login, manage sessions, and implement role-based permissions.
Why use it?
It helps avoid common mistakes when protecting applications and APIs or deciding which users can access specific resources.

Skill for Claude CodeCodex

Part of the developer-essentials plugin — 8 skills shipped together

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.

agentmods
npx agentmods add skills/hermeticormus/libreuiux-claude-code/auth-implementation-patterns
Any agent
npx skills add HermeticOrmus/LibreUIUX-Claude-Code --skill auth-implementation-patterns
Clone the repo
git clone --depth 1 https://github.com/HermeticOrmus/LibreUIUX-Claude-Code

Made for: Claude Code, Codex.

Or install developer-essentials, the plugin that ships this one along with the rest of its 8 skills.

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-implementation-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/hermeticormus/libreuiux-claude-code/auth-implementation-patterns.svg)](https://agentmods.dev/skills/hermeticormus/libreuiux-claude-code/auth-implementation-patterns)
Your own site
<a href="https://agentmods.dev/skills/hermeticormus/libreuiux-claude-code/auth-implementation-patterns"><img src="https://agentmods.dev/badge/skills/hermeticormus/libreuiux-claude-code/auth-implementation-patterns.svg" alt="Measured on agentmods" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,015 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 84% copy Near-identical to another mod 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 $0.00046 $0.04015
Opus 5 $0.00023 $0.02008
Sonnet 5 $0.00009 $0.00803
Haiku 4.5 $0.00005 $0.00402

Measured 2d ago against content hash bbc8c8de4a53, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

auth-implementation-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 2d 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.

Origin

This is a copy

84% identical to auth-implementation-patterns — 565 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugins/developer-essentials/skills/auth-implementation-patterns/SKILL.md · 635 lines

How it starts

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

Authentication & Authorization Implementation Patterns

Build secure, scalable authentication and authorization systems using industry-standard patterns and modern best practices.

When to Use This Skill

  • Implementing user authentication systems
  • Securing REST or GraphQL APIs
  • Adding OAuth2/social login
  • Implementing role-based access control (RBAC)
  • Designing session management
  • Migrating authentication systems
  • Debugging auth issues
  • Implementing SSO or multi-tenancy

Core Concepts

1. Authentication vs Authorization

Authentication (AuthN): Who are you?

  • Verifying identity (username/password, OAuth, biometrics)
  • Issuing credentials (sessions, tokens)
  • Managing login/logout

Authorization (AuthZ): What can you do?

  • Permission checking
  • Role-based access control (RBAC)
  • Resource ownership validation
  • Policy enforcement

2. Authentication Strategies

Session-Based:

  • Server stores session state
  • Session ID in cookie
  • Traditional, simple, stateful

Token-Based (JWT):

  • Stateless, self-contained
  • Scales horizontally
  • Can store claims

OAuth2/OpenID Connect:

  • Delegate authentication
  • Social login (Google, GitHub)
  • Enterprise SSO

JWT Authentication

Pattern 1: JWT Implementation

// JWT structure: header.payload.signature
import jwt from 'jsonwebtoken';
import { Request, Response, NextFunction } from 'express';

interface JWTPayload {
    userId: string;
    email: string;
    role: string;
    iat: number;
    exp: number;
}

// Generate JWT
function generateTokens(userId: string, email: string, role: string) {
    const accessToken = jwt.sign(
        { userId, email, role },
        process.env.JWT_SECRET!,
        { expiresIn: '15m' }  // Short-lived
    );

    const refreshToken = jwt.sign(
        { userId },
        process.env.JWT_REFRESH_SECRET!,
        { expiresIn: '7d' }  // Long-lived
    );

    return { accessToken, refreshToken };
}

// Verify JWT
function verifyToken(token: string): JWTPayload {
    try {
        return jwt.verify(token, process.env.JWT_SECRET!) as JWTPayload;
    } catch (error) {
        if (error instanceof jwt.TokenExpiredError) {
            throw new Error('Token expired');
        }
        if (error instanceof jwt.JsonWebTokenError) {
            throw new Error('Invalid token');
        }
        throw error;
    }
}

// Middleware
function authenticate(req: Request, res: Response, next: NextFunction) {
    const authHeader = req.headers.authorization;
    if (!authHeader?.startsWith('Bearer ')) {
        return res.status(401).json({ error: 'No token provided' });
    }

    const token = authHeader.substring(7);
    try {
        const payload = verifyToken(token);
        req.user = payload;  // Attach user to request
        next();
    } catch (error) {
        return res.status(401).json({ error: 'Invalid token' });
    }
}

// Usage
app.get('/api/profile', authenticate, (req, res) => {
    res.json({ user: req.user });
});

Read the full file on GitHub · 635 lines

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. 2d ago First seen · 635 lines · 46 tokens per session scan A bbc8c8de4a53

Subscribe to this mod's changes

auth-implementation-patterns is a skill published in the GitHub repository HermeticOrmus/LibreUIUX-Claude-Code (101 stars, last pushed 3mo ago), licensed MIT. It adds 46 tokens to every session and 4,015 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 84% identical to auth-implementation-patterns, differing in 565 lines, and is treated as a copy.

Related

Other skills, from other repositories

figma-generate-component-doc

Generate complete Markdown documentation for a Figma component — anatomy/layer tree, design tokens (colors, spacing, typography), states/variants matrix, accessibility notes, content guidelines, and optional code-parity + YAML frontmatter. Use when the user wants a docs page or handoff spec for a component or…

southleft/figma-console-mcp-skills · 150 tokens

figma-version-history

List a Figma file's version history, snapshot the file at any past version, and diff two versions (added/removed/renamed pages plus deep per-component changes). Use when the user wants to inspect Figma history — triggers: 'list Figma versions', 'what versions does this file have', 'show version history', 'snapshot…

southleft/figma-console-mcp-skills · 181 tokens

figma-comments

Read, post, reply to, and delete comments on a Figma file via the REST API — including pinning a comment to a specific node and threading replies. Use when the user wants to work with Figma comments programmatically — triggers: 'get Figma comments', 'read comments on this file', 'post a comment in Figma', 'leave a…

southleft/figma-console-mcp-skills · 151 tokens

figma-import-tokens

Push design tokens from code INTO Figma as variables — DTCG / tokens.json / a token object → Figma variable collections, modes, and values. Use when the user wants to sync tokens code→Figma: triggers 'import tokens into Figma', 'create Figma variables from my tokens.json / DTCG / Tailwind config', 'sync design tokens…

southleft/figma-console-mcp-skills · 139 tokens

figma-scan-code-accessibility

Scan generated/authored HTML for accessibility violations with axe-core (Deque) running over JSDOM — structural and semantic rules: ARIA attributes and roles, accessible names, alt text, form labels, heading order, landmarks, semantic HTML, tabindex, duplicate IDs, lang attribute, and 50 more. Use on the CODE side of…

southleft/figma-console-mcp-skills · 200 tokens

figma-analyze-component-set

Analyze a Figma COMPONENTSET as a state machine for code generation — extract variant axes (state/size/etc.), map state variants to CSS pseudo-classes (hover→:hover, focus→:focus-visible, disabled→:disabled, error→[aria-invalid]), and compute per-variant visual diffs (only what changes per state). Use when generating…

southleft/figma-console-mcp-skills · 179 tokens