What problem does it solve?
This Skill provides concise, ready-to-use patterns and guidance for integrating Clerk authentication into Astro projects, removing common configuration errors and ensuring routes, API endpoints, and client islands are properly protected.
Core Features & Use Cases
- Middleware setup with route matchers to protect dashboard, settings, and API routes and redirect unauthenticated users.
- Server-side rendering guidance using Astro.locals.auth for SSR pages and org-aware redirects.
- Island component patterns using client directives and useAuth/useUser hooks for React/Vue/Svelte islands.
- API route examples showing proper auth checks, permission handling, and usage of clerkClient in server contexts.
- Templates and examples that demonstrate required Astro config, environment variables, and deployment-ready adapter settings.
Quick Start
Use clerk-astro-patterns to add clerkMiddleware protecting /dashboard and /settings and configure Astro.locals.auth() to redirect unauthenticated users to /sign-in.