smithery/itsmealee

managing-advanced-middleware

Advanced middleware logic for security and routing. Use for global rate limiting, security headers, and protection of admin routes.

Installation

$ npx skills add smithery/itsmealee --skill managing-advanced-middleware

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/itsmealee.

npx skills add smithery/itsmealee

Browse all from smithery/itsmealee

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,231 B
  • docs SUMMARY.md 167 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Advanced Middleware and Security Logic

When to use this skill

  • Implementing site-wide security measures.
  • Protecting sensitive routes like /admin/ or /dashboard/.
  • Injecting nonces or CSP headers.

Workflow

  • Create middleware.ts in the root (Next.js 15).
  • Define config.matcher to specify target routes.
  • Implement checks (Auth check, Rate limit, CSP).

Code Pattern (CSP Header)

import { NextResponse } from 'next/server';

export function middleware(request: Request) {
    const nonce = Buffer.from(crypto.randomUUID()).toString('base64');
    const csp = `default-src 'self'; script-src 'self' 'nonce-${nonce}';`;
    
    const response = NextResponse.next();
    response.headers.set('Content-Security-Policy', csp);
    return response;
}

Instructions

  • Performance: Keep middleware logic lightweight to avoid slowing down every request.
  • Auth: Appwrite sessions are stored in cookies; middleware can check for the presence of these cookies for simple protection.