Session Management
Secure session management with JWT tokens, refresh cycles, session storage, logout handling, and CSRF protection.
- CCM score
- 38 of 100
- skills.sh installs
- 470
- GitHub stars
- 396
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers token generation, validation, and refresh, plus session persistence and logout across backend frameworks
- Includes 7 reference guides for JWT handling, Node.js/Express, Redis session storage, CSRF protection, middleware chains, refresh endpoints, and cleanup
- Enforces httpOnly, sameSite, and secure cookie flags, and rejects token storage in localStorage
- Designed for backend developers securing user authentication state, token lifecycle, and expiration handling
Install
$ npx -y skills add aj-geddes/useful-ai-prompts --skill session-management -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Session Management
Table of Contents
Overview
Implement comprehensive session management systems with secure token handling, session persistence, token refresh mechanisms, proper logout procedures, and CSRF protection across different backend frameworks.
When to Use
- Implementing user authentication systems
- Managing session state and user context
- Handling JWT token refresh cycles
- Implementing logout functionality
- Protecting against CSRF attacks
- Managing session expiration and cleanup
Quick Start
Minimal working example:
# Python/Flask Example
from flask import current_app
from datetime import datetime, timedelta
import jwt
import os
class TokenManager:
def __init__(self, secret_key=None):
self.secret_key = secret_key or os.getenv('JWT_SECRET')
self.algorithm = 'HS256'
self.access_token_expires_hours = 1
self.refresh_token_expires_days = 7
Details
- Repository
- github.com/aj-geddes/useful-ai-prompts
- Categories
- Backend & APIs, Security
- First seen
- Jun 3, 2026
Questions
What does the session-management skill do?
The session-management skill helps an agent build secure session handling with JWT tokens, session storage, token refresh, logout handling and CSRF protection. It covers managing user authentication state, handling token lifecycle and securing sessions across backend frameworks. Its SKILL.md includes a Python Flask quick start and reference guides for Node.js, Redis and CSRF.
How do I install the session-management skill?
Run npx -y skills add aj-geddes/useful-ai-prompts --skill session-management -y in your project. Once installed, session-management lets the agent write JWT generation, refresh endpoints and logout code that follow its best practices, such as httpOnly cookies and CSRF tokens for state-changing requests.
Where does session-management stand in the Backend and APIs category?
session-management sits in the Backend and APIs category on Claude Marketplaces, alongside entra-app-registration, neon, firebase-basics, firebase-auth-basics and workers-best-practices. Unlike those, session-management focuses on the session layer itself, including token refresh cycles, session cleanup and protection against CSRF attacks.
More from aj-geddes/useful-ai-prompts
All 258- Idempotency Handling469
- Network Analysis468
- Query Caching Strategies468
- Risk Assessment468
- Error Tracking467
- Clustering Analysis465
- Code Metrics Analysis465
- Spring Boot Application465
- Webhook Integration465
- Health Check Endpoints464
- Serverless Architecture464
- Classification Modeling463
- Transaction Management463
- Secrets Rotation462
- Deployment Documentation461
- Natural Language Processing461
- Runbook Creation461
- Autoscaling Configuration459
- Security Documentation459
- Stored Procedures459
- Profiling Optimization458
- Property Based Testing458
- Cpu Profiling457
- Frontend Routing457
Similar to Session Management
More Backend & APIsapi-authenticationaj-geddes/useful-ai-prompts614 installsSecure API authentication guide covering JWT, OAuth 2.0, API keys, and session management with best practices.
csrf-protectionaj-geddes/useful-ai-prompts480 installsPractical CSRF defense using synchronizer tokens, SameSite cookies, and origin checks for forms and state changes.
jwt-securitymindrally/skills1.7K installsGuidelines for JWT authentication covering token creation, validation, storage, and refresh, with concrete security rules.
security-patternscloudai-x/claude-workflow-v2136 installsPractical security patterns for authentication, authorization, password handling, and secrets management, with wrong-versus-correct examples.
auth-security-reviewerpatricio0312rev/skills359 installsStructured review of authentication and authorization code covering sessions, JWTs, CSRF, passwords, MFA, and access control.
api-security-best-practicesdavila7/claude-code-templates471 installsComprehensive guide for building secure REST, GraphQL, and WebSocket APIs with auth, validation, and rate limiting.