jwt-security

jwt-security is a skill for Claude Code from latestaiagents/agent-skills. It costs 54 tokens per session (2,348 once invoked), scanned A, original, MIT.

A guide to securing JSON Web Tokens (JWTs), which are signed strings commonly used to prove a user's identity between services.

In plain words
What is it for?
Use it when building, reviewing, debugging, or migrating JWT authentication, including access tokens and refresh-token rotation.
Why use it?
It helps avoid unsafe token settings, weak secrets, missing expiry times, leaked tokens, and mistakes when validating authentication.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the security-guardian plugin — 10 skills, 2 commands shipped together

Good fit Use it when building, reviewing, debugging, or migrating JWT authentication, including access tokens and refresh-token rotation.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/latestaiagents/agent-skills/jwt-security
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 latestaiagents/agent-skills --skill jwt-security
Clone the repo
git clone --depth 1 https://github.com/latestaiagents/agent-skills

Made for: Claude Code.

Or install security-guardian, the plugin that ships this one along with the rest of its 10 skills, 2 commands.

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 jwt-security

README.md
[![agentmods](https://agentmods.dev/badge/skills/latestaiagents/agent-skills/jwt-security.svg)](https://agentmods.dev/skills/latestaiagents/agent-skills/jwt-security)
Your own site
<a href="https://agentmods.dev/skills/latestaiagents/agent-skills/jwt-security"><img src="https://agentmods.dev/badge/skills/latestaiagents/agent-skills/jwt-security.svg" alt="Measured on agentmods" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,348 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.
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.00054 $0.02348
Opus 5 $0.00027 $0.01174
Sonnet 5 $0.00011 $0.00470
Haiku 4.5 $0.00005 $0.00235

Measured 4d ago against content hash 4b7c6f684078, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

jwt-security 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 4d 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.

plugins/security-guardian/skills/common/jwt-security/SKILL.md · 360 lines

How it starts

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

JWT Security

Secure implementation of JSON Web Tokens for authentication.

When to Use

  • Implementing JWT authentication
  • Reviewing existing JWT code
  • Setting up refresh token rotation
  • Debugging JWT issues
  • Migrating to JWT-based auth

JWT Vulnerabilities

Vulnerability Risk Description
Algorithm None CRITICAL Accepting unsigned tokens
Algorithm Confusion CRITICAL RS256 → HS256 attack
Weak Secret HIGH Brute-forceable secrets
No Expiration HIGH Tokens valid forever
Sensitive Data in Payload MEDIUM JWT payload is base64, not encrypted
Token Leakage HIGH Exposed in logs/URLs

Secure Implementation

1. Token Generation

const jwt = require('jsonwebtoken');

const JWT_CONFIG = {
  accessSecret: process.env.JWT_ACCESS_SECRET,   // 256+ bit random string
  refreshSecret: process.env.JWT_REFRESH_SECRET,
  accessExpiry: '15m',    // Short-lived
  refreshExpiry: '7d',    // Longer-lived
  algorithm: 'HS256',     // Or RS256 for asymmetric
  issuer: 'your-app-name',
  audience: 'your-app-users'
};

function generateAccessToken(user) {
  const payload = {
    sub: user.id,           // Subject (user ID)
    email: user.email,      // Only non-sensitive data
    role: user.role,
    // Don't include: password, SSN, credit card, etc.
  };

  return jwt.sign(payload, JWT_CONFIG.accessSecret, {
    algorithm: JWT_CONFIG.algorithm,
    expiresIn: JWT_CONFIG.accessExpiry,
    issuer: JWT_CONFIG.issuer,
    audience: JWT_CONFIG.audience,
    jwtid: crypto.randomUUID()  // Unique token ID
  });
}

function generateRefreshToken(user) {
  const payload = {
    sub: user.id,
    type: 'refresh',
    family: crypto.randomUUID()  // For refresh token rotation
  };

  return jwt.sign(payload, JWT_CONFIG.refreshSecret, {
    algorithm: JWT_CONFIG.algorithm,
    expiresIn: JWT_CONFIG.refreshExpiry,
    issuer: JWT_CONFIG.issuer
  });
}

2. Token Verification (CRITICAL)

Read the full file on GitHub · 360 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. 4d ago First seen · 360 lines · 54 tokens per session scan A 4b7c6f684078

Subscribe to this mod's changes

jwt-security is a skill published in the GitHub repository latestaiagents/agent-skills (5 stars, last pushed 4mo ago), licensed MIT. It adds 54 tokens to every session and 2,348 once invoked, about $0.0003 per session on Opus 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-09-03.

Related

Other skills, from other repositories

fw-ai-actions-app

Expert-level skill for AI Actions and integrations on Freshworks Platform 3.0. Use when (1) Creating actions.json and SMI functions (flat request, nested response), (2) Request templates and third-party API integration, (3) Pre-build validation (pricing, paywalls, account prerequisites), (4) Failure-case validation…

freshworks-developers/fw-dev-tools · 123 tokens

agent-raft-manager

Agent skill for raft-manager - invoke with $agent-raft-manager.

ruvnet/ruflo · 18 tokens

multi-app-orchestration

Orchestrate workflows across multiple applications and APIs — inter-app coordination, data handoff, and multi-system task completion.

a5c-ai/babysitter · 30 tokens

api-documenter

Auto-generate API documentation from code and comments. Use when API endpoints change, or user mentions API docs. Creates OpenAPI/Swagger specs from code. Triggers on API file changes, documentation requests, endpoint additions.

alirezarezvani/claude-code-tresor · 48 tokens

sinch-porting-api

Port phone numbers from other carriers into Sinch with the Porting API. Automates port-in order creation, portability checks, order tracking, on-demand activation, and webhook notifications. Use when porting numbers, checking portability, creating port-in orders, tracking port status, activating ported numbers…

sinch/skills · 76 tokens

sinch-voice-api

Build voice apps with Sinch Voice REST API. Use for phone calls, text-to-speech (TTS), IVR menus, DTMF input, conference calling, call recording, call forwarding, answering machine detection (AMD), SIP routing, WebSocket audio streaming, and SVAML call control.

sinch/skills · 67 tokens