agentleFS
Ghost7802Ghost7802/awesome-api-skills/skills/jwt/SKILL.md

jwt

Skill13 starsChanged 27 days agoMITView on GitHub

Compact, URL-safe means of representing claims to be transferred between two parties. - oauth2 (Score: 0.92) Why: Direct relationship, Both are Authentication, Shared ecosystem (security), Can deploy to any, Similar network profile - openid-connect (Score: 0.92) Why: Direct relationship, Both are Authentication, Shared ecosystem (security), Can deploy to any, Similar network profile - redis (Score: 0.5) Why: Direct relationship

  • Installs packages

8 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use xxe, ssti and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • sunilgentyalaSkill

    xxe

    XML External Entity injection expert methodology. Covers classic XXE, blind OOB XXE, XXE via file upload, XXE to SSRF, and XXE in PDF/DOCX parsers.

    Also in 3 projects that use this

  • SubhiSecSkill

    ssti

    Hunt Server-Side Template Injection (SSTI) in Jinja2, Twig, Freemarker, Velocity, Smarty, ERB, Handlebars, Mustache, and Spring (SpEL). Use when input is reflected in a way that suggests template rendering — error pages, email templates, PDF generators, dynamic content systems.

    Also in 3 projects that use this

  • VercelSkill

    oauth

    Configure OAuth providers (Google, Apple, Microsoft, Facebook, GitHub, etc.) to work with portless local dev URLs. Use when setting up OAuth redirect URIs, fixing "redirect_uri_mismatch" or "invalid redirect" errors, configuring sign-in providers for local development, or when a provider rejects .localhost subdomains. Triggers include "OAuth not working with portless", "redirect URI mismatch", "Google/Apple/Microsoft sign-in fails locally", "configure OAuth for local dev", or any task involving OAuth callback URLs with portless domains.

    Also in 4 projects that use this

  • SubhiSecSkill

    xss

    Hunt reflected, stored, and DOM-based Cross-Site Scripting (XSS) including CSP bypass, polyglot payloads, mutation XSS (mXSS), markdown XSS, and template XSS. Use when the user has identified a parameter or input that reflects to the page, or wants to test for XSS in a specific input.

    Also in 3 projects that use this

  • xfstudioSkill

    graphql

    GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.

    Also in 3 projects that use this

  • +1 more from SubhiSec

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Always wrap jwt.verify() in a try/catch block.

    line 42
  2. Very specific:

    Never accept tokens where the algorithm (alg) is set to none.

    line 45
  3. Distinctive:

    Use this when your agent works with jwt — structured patterns beat pasted docs and prevent common hallucinations.

    line 51

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

JSON Web Tokens Skill

Compact, URL-safe means of representing claims to be transferred between two parties.

Ecosystem Graph Preview

graph LR
  jwt["jwt"]:::core
  classDef core fill:#f9f,stroke:#333,stroke-width:4px;
  jwt -- "works well with" --> oauth2
  jwt -- "integrates with" --> redis
  oauth2 -- "works well with" --> jwt
  openid-connect -- "integrates with" --> jwt

Recommended Next Skills

  • oauth2 (Score: 0.92) Why: Direct relationship, Both are Authentication, Shared ecosystem (security), Can deploy to any, Similar network profile
  • openid-connect (Score: 0.92) Why: Direct relationship, Both are Authentication, Shared ecosystem (security), Can deploy to any, Similar network profile
  • redis (Score: 0.5) Why: Direct relationship

Quick Start

JWTs allow you to cryptographically sign a JSON payload (claims). The backend can verify this signature locally without needing to query a database for every API request.

npm install jsonwebtoken

Production Patterns

The Invalidation Problem

Because JWTs are stateless and verified locally, you cannot instantly revoke a stolen JWT before it expires. Keep expiration times (exp) extremely short (e.g., 15 minutes) and issue long-lived Refresh Tokens that are checked against the database.

Architecture & Scaling

Header, Payload, Signature

A JWT is simply Base64Url encoded. The payload is NOT encrypted. Anyone who intercepts the token can read the data. Do not store sensitive information (like SSNs or passwords) inside the JWT payload.

Error Recovery

Always wrap jwt.verify() in a try/catch block. It will throw specific errors for TokenExpiredError and JsonWebTokenError (invalid signature), which should map to a 401 HTTP response.

Security Notes

Never accept tokens where the algorithm (alg) is set to none. Attackers use this to bypass signature verification. Always explicitly define the allowed algorithms in your verification function.

References

Why use this skill

Use this when your agent works with jwt — structured patterns beat pasted docs and prevent common hallucinations.

AI pitfalls

  • Using outdated SDK or API versions from training data
  • Inventing environment variable names
  • Omitting error handling and retry logic

Production checklist

  • Secrets in environment variables, not source code
  • Error handling and logging in place
  • Rate limits and timeouts configured

Related skills

  • oauth2 — works well with
  • redis — integrates with

Last Verified: 2026-07-02

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.