Borrowing it
Nothing to install: this file belongs to cohen-liel/hivemind. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/cohen-liel/hivemind/main/.claude/skills/jwt-authentication/SKILL.mdgit clone --depth 1 https://github.com/cohen-liel/hivemindWrote 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/cohen-liel/hivemind/jwt-authentication)<a href="https://agentmods.dev/skills/cohen-liel/hivemind/jwt-authentication"><img src="https://agentmods.dev/badge/skills/cohen-liel/hivemind/jwt-authentication.svg" alt="Measured on agentmods" 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.00029 | $0.01045 |
| Opus 5 | $0.00015 | $0.00522 |
| Sonnet 5 | $0.00006 | $0.00209 |
| Haiku 4.5 | $0.00003 | $0.00104 |
Grade A, and why
jwt-authentication 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 8d 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 — 122 lines — stays where its author put it; the contents beside it link to each section on GitHub.
JWT Authentication Patterns
Token Strategy
- Access token: short-lived (15 min), stateless JWT
- Refresh token: long-lived (7 days), stored in DB for revocation
- Storage: access in memory (JS var), refresh in httpOnly cookie
Implementation (FastAPI + Python-Jose)
# auth/tokens.py
from datetime import datetime, timedelta
from jose import JWTError, jwt
from passlib.context import CryptContext
SECRET_KEY = settings.SECRET_KEY # 32+ char random string from env
ALGORITHM = "HS256"
ACCESS_TOKEN_EXPIRE = timedelta(minutes=15)
REFRESH_TOKEN_EXPIRE = timedelta(days=7)
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
def hash_password(password: str) -> str:
return pwd_context.hash(password)
def verify_password(plain: str, hashed: str) -> bool:
return pwd_context.verify(plain, hashed)
def create_access_token(user_id: int) -> str:
return jwt.encode(
{"sub": str(user_id), "exp": datetime.utcnow() + ACCESS_TOKEN_EXPIRE, "type": "access"},
SECRET_KEY, algorithm=ALGORITHM
)
def create_refresh_token(user_id: int) -> str:
return jwt.encode(
{"sub": str(user_id), "exp": datetime.utcnow() + REFRESH_TOKEN_EXPIRE, "type": "refresh"},
SECRET_KEY, algorithm=ALGORITHM
)
def decode_token(token: str) -> dict:
try:
payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
return payload
except JWTError:
raise HTTPException(status_code=401, detail="Invalid or expired token")
Login Endpoint
@router.post("/login", response_model=TokenResponse)
async def login(form: OAuth2PasswordRequestForm = Depends(), db: AsyncSession = Depends(get_db)):
user = await get_user_by_email(db, form.username)
if not user or not verify_password(form.password, user.hashed_password):
# Same error for both cases — don't reveal which field was wrong
raise HTTPException(status_code=401, detail="Invalid credentials")
# Rate limit check (use Redis counter)
await check_login_rate_limit(user.id)
access_token = create_access_token(user.id)
refresh_token = create_refresh_token(user.id)
# Store refresh token hash in DB for revocation
await store_refresh_token(db, user.id, refresh_token)
response = JSONResponse({"access_token": access_token, "token_type": "bearer"})
response.set_cookie("refresh_token", refresh_token, httponly=True, secure=True, samesite="lax")
return response
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.
- 8d ago First seen · 122 lines · 29 tokens per session scan A 7b4aced6682f
jwt-authentication is a skill published in the GitHub repository cohen-liel/hivemind (108 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 29 tokens to every session and 1,045 once invoked, about $0.0001 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-08-30.
Other skills, from other repositories
sdd-tasks
Break an SDD change into implementation tasks. Trigger: orchestrator launches task planning for a change.
review-delta
Review only changes since last commit using impact analysis. Token-efficient delta review with automatic blast-radius detection.
pre-landing-review
Pre-landing PR review. Analyzes diff against the base branch for SQL safety, LLM trust boundary violations, conditional side effects, and other structural issues. Use when explicitly asked for the specialized pre-landing workflow. Product /review requests are handled by OpenBitFun's unified Review mechanism instead.…
pr-review-canvas
Create a OpenBitFun Canvas for reviewing a pull request, branch diff, or change set with Cursor-style diff cards, review maps, risk callouts, and focused reviewer flow. Use when the user asks for a PR review canvas, diff walkthrough, change-set overview, or visual review summary.
find-simplifications
Use for a periodic repo-wide sweep of qwen-code for accumulated excess surface — dead components and files, orphaned locale keys, exports nothing consumes, added-then-removed scaffolding — filing candidates on a tracking issue and landing only what a maintainer has said yes to. Repo-wide and evidence-first; every…
cross-model-review
A second-opinion code review that asks a different AI model to independently inspect a change, then compares both reviews. It focuses on logic, security, consistency, and omissions.