middleware-protection
Installation
SKILL.md
Middleware Route Protection
Check auth once, protect routes declaratively.
When to Use This Skill
- Need to protect multiple routes
- Want centralized auth checking
- Tired of repeating auth logic in every route
- Need role-based access control
Core Concepts
- Middleware intercepts - All requests pass through middleware
- Declarative routes - Define protected/public routes in config
- Session refresh - Keep sessions alive automatically
- Consistent errors - API routes get JSON, pages get redirects