Session Management
Implement secure session handling with proper token generation, storage, expiry, CSRF protection, and session invalidation.
Install
/plugin marketplace add sethdford/claude-skillsThe repo is a Claude Code plugin marketplace. Run /plugin afterwards to pick the plugin that includes this skill.
npx skills add sethdford/claude-skills --skill session-managementgit 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-managementPersonal 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)
Details
- Skill name
session-management- Repository
- sethdford/claude-skills
- 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
A B Test Design
48sethdford/claude-skills
Design rigorous A/B tests with hypotheses, variants, metrics, and sample size calculations.
A B Test Design Pm
48sethdford/claude-skills
Analytics and experimentation skill for product managers.
Abuse Case Design
48sethdford/claude-skills
Design abuse cases (negative use cases) showing how attackers misuse system features. Use when identifying attacks that exploit intended functionality or business logic flaws.
Solid Principles
48sethdford/claude-skills
SOLID principles (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion) for object-oriented design.
Sequence Diagram
48sethdford/claude-skills
Show interactions and flows over time. Illustrate request paths, asynchronous patterns, error handling. Use when documenting complex flows or onboarding on system behavior.
Spacing System
48sethdford/claude-skills
Create a consistent spacing system based on a base unit with contextual application rules.
Browse the most popular Claude skills, all other skills, or write your own with the skills generator.