一键导入
auth-middleware
Generates authentication and authorization middleware for Express/Fastify/Hono
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Generates authentication and authorization middleware for Express/Fastify/Hono
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Analyzes the current session's token usage, pinpoints where tokens were wasted, and produces concrete optimization actions
Generates API documentation from route definitions (Express, Fastify, Hono, etc.)
Adds caching to expensive operations - Redis, in-memory, HTTP cache headers
Staged değişiklikleri analiz edip Conventional Commits formatında commit mesajı oluşturur
Reports cyclomatic complexity hotspots and refactoring suggestions
Finds unused functions, variables, exports, and dependencies across the codebase
| name | auth-middleware |
| description | Generates authentication and authorization middleware for Express/Fastify/Hono |
Strategy: $1 (jwt | session | api-key | oauth)
cat package.json | grep -E '"express"|"fastify"|"hono"|"jsonwebtoken"|"jose"|"passport"'
grep -rn "middleware\|authenticate\|authorize" src/ --include="*.ts" -l | head -5
Read existing auth code if present.
Generate the middleware for the requested strategy:
JWT example:
export async function authenticate(req: Request, res: Response, next: NextFunction) {
const token = req.headers.authorization?.split(' ')[1]
if (!token) return res.status(401).json({ error: 'Unauthorized' })
try {
const payload = await verifyJWT(token)
req.user = payload
next()
} catch {
return res.status(401).json({ error: 'Invalid token' })
}
}
export function authorize(...roles: Role[]) {
return (req: Request, res: Response, next: NextFunction) => {
if (!roles.includes(req.user?.role)) return res.status(403).json({ error: 'Forbidden' })
next()
}
}
Include:
Generate tests for all auth scenarios.