Session Management
Secure session management guide covering JWT access and refresh tokens, Redis storage, and cookie hardening.
- CCM score
- 50 of 100
- skills.sh installs
- 441
- GitHub stars
- 257
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers token-based sessions with 1-hour access tokens and 7-day refresh tokens signed with separate secrets
- Includes Redis-backed session storage with create and invalidate-all methods plus a 7-day key expiry
- Enforces httpOnly, secure-in-production, and sameSite strict cookie settings, plus a refresh flow that rejects wrong token types
- Designed for teams building authentication systems that need logout and per-user session invalidation
Install
$ npx -y skills add secondsky/claude-skills --skill session-management -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Session Management
Implement secure session management with proper token handling and storage.
Token-Based Sessions
const jwt = require('jsonwebtoken');
function generateTokens(user) {
const accessToken = jwt.sign(
{ userId: user.id, role: user.role, type: 'access' },
process.env.JWT_SECRET,
{ expiresIn: '1h' }
);
const refreshToken = jwt.sign(
{ userId: user.id, type: 'refresh' },
process.env.REFRESH_SECRET,
{ expiresIn: '7d' }
);
return { accessToken, refreshToken };
}
Redis Session Storage
const redis = require('redis');
const client = redis.createClient();
class SessionStore {
async create(userId, sessionData) {
const sessionId = crypto.randomUUID();
await client.hSet(`sessions:${userId}`, sessionId, JSON.stringify({
...sessionData,
createdAt: Date.now()
}));
await client.expire(`sessions:${userId}`, 86400 * 7);
return sessionId;
}
async invalidateAll(userId) {
await client.del(`sessions:${userId}`);
}
}
Cookie Configuration
Details
- Repository
- github.com/secondsky/claude-skills
- Categories
- Backend & APIs, Security
- First seen
- Jun 3, 2026
Questions
What does the session-management skill do?
The session-management skill implements secure sessions with JWT access and refresh tokens, Redis session storage, and cookie settings such as httpOnly, secure and sameSite. It also covers a token refresh route and invalidating all sessions for a user on logout.
How do I install the session-management skill?
Run npx -y skills add secondsky/claude-skills --skill session-management -y in your project to install it. Once installed, the agent can build authentication systems, manage user sessions and add secure logout using these session-management patterns.
Which category is session-management in, and what sets it apart?
session-management is listed in the Backend & APIs category on Claude Marketplaces. Within its own skill, it focuses on token-based sessions with Redis storage and refresh flows, rather than on the hosted backend services that neighboring skills cover.
Does session-management need any extra tools or keys?
The SKILL.md examples expect a JWT library such as jsonwebtoken, a Redis client, and secret values such as JWT_SECRET, REFRESH_SECRET and SESSION_SECRET set per environment. It also assumes HTTPS in production.
More from secondsky/claude-skills
All 116- Defense In Depth Validation440
- Bun Runtime438
- Nuxt Production435
- Ultracite435
- Bun Docker434
- Bun Tanstack Start434
- Nuxt Ui V4432
- Oauth Implementation432
- Api Gateway Configuration431
- Health Check Endpoints431
- Bun Test Mocking430
- Mobile Offline Support428
- Bun Test Coverage427
- Api Changelog Versioning426
- Dependency Upgrade426
- Idempotency Handling426
- Nuxt Server426
- Bun Cloudflare Workers425
- Bun Workers425
- Bun Http Server424
- Bun Bundler423
- Turborepo423
- Api Versioning Strategy421
- Recommendation System421
Similar to Session Management
More Backend & APIsapi-authenticationsecondsky/claude-skills563 installsSecure API authentication guide covering JWT, OAuth 2.0, and API keys with token handling and security headers.
auth-implementation-patternssickn33/agentic-awesome-skills418 installsSecure authentication and authorization guidance covering token, session, and resource-access boundaries for implementation or review.
jwt-securitymindrally/skills1.7K installsGuidelines for JWT authentication covering token creation, validation, storage, and refresh, with concrete security rules.
jwt-authenticationpluginagentmarketplace/custom-plugin-nodejs227 installsNode.js JWT authentication with access and refresh tokens, plus role-based access control middleware.
csrf-protectionsecondsky/claude-skills488 installsLayered CSRF defenses covering synchronizer tokens, double-submit cookies, and SameSite cookie attributes.
security-patternscloudai-x/claude-workflow-v2136 installsPractical security patterns for authentication, authorization, password handling, and secrets management, with wrong-versus-correct examples.