What problem does it solve? Integrating Clerk authentication into Astro apps is tricky because Astro has two rendering modes (SSR and static prerender) plus island components, and Clerk behaves differently in each. This Skill provides correct, tested patterns so you avoid common pitfalls like undefined auth objects, skipped middleware, and non-reactive islands. ## Core Features & Use Cases - Middleware Configuration: Set up clerkMiddleware with createRouteMatcher to protect routes like /dashboard and redirect unauthenticated users to sign-in. - SSR & API Route Auth: Access Astro.locals.auth() in server-rendered pages and API endpoints, with proper 401/403 status codes and org-scoped checks. - Island Components: Use useAuth, UserButton, and SignInButton from @clerk/astro/react in hydrated React islands with the correct client directives. - Use Case: You are building an Astro dashboard with mixed static and dynamic pages. Use this Skill to configure middleware, protect SSR pages, and add a client-side header that shows a sign-in button or user menu based on auth state. ## Quick Start Set up Clerk middleware in my Astro app to protect the /dashboard route and redirect unauthenticated users to /sign-in.