{
  "skill_name": "laravel-sessions-middleware",
  "evals": [
    {
      "id": 1,
      "prompt": "Configure Redis session driver in Laravel",
      "expected_output": "Set SESSION_DRIVER=redis in .env; configure redis in config/database.php; install predis/predis; use for production/scaled apps; avoid file driver due to I/O lock issues at scale",
      "assertions": [
        { "type": "contains", "value": "SESSION_DRIVER=redis" },
        { "type": "contains", "value": "config/database.php" },
        { "type": "contains", "value": "predis/predis" },
        { "type": "contains", "value": "avoid file driver" }
      ]
    },
    {
      "id": 2,
      "prompt": "Create custom middleware in Laravel",
      "expected_output": "php artisan make:middleware EnsureTokenIsValid; implement handle(Request $request, Closure $next): Response; register in bootstrap/app.php withMiddleware(); keep single responsibility per middleware",
      "assertions": [
        { "type": "contains", "value": "make:middleware" },
        {
          "type": "contains",
          "value": "handle(Request $request, Closure $next): Response"
        },
        { "type": "contains", "value": "bootstrap/app.php" },
        { "type": "contains", "value": "withMiddleware()" }
      ]
    },
    {
      "id": 3,
      "prompt": "Add security headers via middleware in Laravel",
      "expected_output": "Create SecurityHeadersMiddleware; in handle() add HSTS, CSP, X-Frame-Options, X-Content-Type-Options headers to response; register as global middleware in bootstrap/app.php",
      "assertions": [
        { "type": "contains", "value": "HSTS" },
        { "type": "contains", "value": "CSP" },
        { "type": "contains", "value": "X-Frame-Options" },
        { "type": "contains", "value": "X-Content-Type-Options" }
      ]
    },
    {
      "id": 4,
      "prompt": "Regenerate session after login in Laravel",
      "expected_output": "Call $request->session()->regenerate() immediately after successful authentication; prevents session fixation attacks; call $request->session()->invalidate() on logout",
      "assertions": [
        { "type": "contains", "value": "session()->regenerate()" },
        { "type": "contains", "value": "session fixation" },
        { "type": "contains", "value": "session()->invalidate()" }
      ]
    },
    {
      "id": 5,
      "prompt": "Apply global middleware in Laravel bootstrap/app.php",
      "expected_output": "Use withMiddleware(fn($m) => $m->append(MyMiddleware::class)) in bootstrap/app.php; use prepend() for highest priority; avoid heavy computation in global middleware — offload to Services",
      "assertions": [
        { "type": "contains", "value": "withMiddleware(fn($m) => $m->append" },
        { "type": "contains", "value": "prepend()" },
        { "type": "contains", "value": "avoid heavy computation" }
      ]
    },
    {
      "id": 6,
      "prompt": "Fix session config not reading from config file in Laravel",
      "expected_output": "Never access env('SESSION_DRIVER') in code; always use config('session.driver'); clear config cache with php artisan config:clear; set values in .env, read via config() helper",
      "assertions": [
        { "type": "contains", "value": "Never access env('SESSION_DRIVER')" },
        { "type": "contains", "value": "config('session.driver')" },
        { "type": "contains", "value": "config:clear" }
      ]
    }
  ],
  "should_not_trigger": [
    "Set up session storage in Next.js",
    "NestJS middleware pipeline setup",
    "Go HTTP middleware with chi",
    "Spring Boot filter chain configuration"
  ]
}
