Session Management

Implement secure session handling with proper token generation, storage, expiry, CSRF protection, and session invalidation.

48 stars 10 forksOther Plugin marketplace

Install

Claude Code plugin
/plugin marketplace add sethdford/claude-skills

The repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add sethdford/claude-skills --skill session-management
Manual install
git clone --depth 1 https://github.com/sethdford/claude-skills.git /tmp/claude-skills
mkdir -p ~/.claude/skills
cp -r /tmp/claude-skills/security/secure-development/skills/session-management ~/.claude/skills/session-management

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Session Management

Implement secure session handling to maintain authenticated state and prevent session hijacking and fixation.

## Context

You are a senior security architect designing session management for $ARGUMENTS. Sessions bridge the gap between stateless HTTP and the need to maintain authenticated state.

## Domain Context

- **Session State**: Maintain authenticated user state across HTTP requests
- **Session Tokens**: Cryptographically random, high-entropy identifiers; never sequential or predictable
- **Storage**: HTTPOnly cookies (for web browsers), Bearer tokens (for APIs), or both
- **Expiry**: Short-lived tokens reduce window of compromise; refresh tokens enable longer sessions without exposing long-lived credentials

## Instructions

1. **Session Token Generation**:
   - Use cryptographic randomness (at least 128 bits entropy; 256 bits preferred)
   - Never sequential or predictable (not timestamp-based, not incremental)
   - Libraries: Python `secrets.token_urlsafe()`, Node `crypto.randomBytes()`, Go `crypto/rand`
   - Example: 32-byte random = 256-bit entropy = ~2^256 possible tokens; safe against brute force

2. **Cookie Configuration** (for web):
   - **HTTPOnly**: Prevent JavaScript access (limits XSS impact)
   - **Secure**: HTTPS-only; not sent over HTTP
   - **SameSite=Strict** (ideal) or **SameSite=Lax**: Prevent CSRF attacks
   - **Domain/Path**: Restrict to specific domain/path (not broader than necessary)
Read the full skill on GitHub

Details

Skill name
session-management
Path
security/secure-development/skills/session-management/SKILL.md
License
MIT
Repo updated
11 March 2026

FAQ

What does the Session Management skill do?

Implement secure session handling with proper token generation, storage, expiry, CSRF protection, and session invalidation.

How do I install the Session Management skill?

Claude Code plugin: /plugin marketplace add sethdford/claude-skills. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Session Management popular?

It lives in sethdford/claude-skills, which has 48 GitHub stars and 10 forks.

Related skills

Browse the most popular Claude skills, all other skills, or write your own with the skills generator.