Skip to content
aj-geddes avatar

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
View on GitHub

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 -y

Installs 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

Similar to Session Management

More Backend & APIs