fjrg2007/enigma/clerk-astro-patterns
Claude Code and agent skill by fjrg2007/enigma
Trust tier 3
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
'Astro patterns with Clerk — middleware, SSR pages, island components,
Install
npx vskill@latest install fjrg2007/enigma/clerk-astro-patternsSKILL.md
The same SKILL.md was published earlier as midudev/autoskills/clerk-astro-patterns.
Astro Patterns
SDK: @clerk/astro v3+. Requires Astro 4.15+.
What Do You Need?
| Task | Reference | |
|---|---|---|
| Configure middleware | references/middleware.md | |
| Protect SSR pages | references/ssr-pages.md | |
| Use Clerk in island components | references/island-components.md | |
| Auth in API routes | references/api-routes.md | |
| Use Clerk with React in Astro | references/astro-react.md |
Mental Model
Astro has two rendering modes per page: SSR and static prerender. Clerk works differently in each:
- SSR pages — use
Astro.locals.auth()which is populated by the middleware - Static pages (
export const prerender = true) — Clerk middleware skips them; use client-side hooks in islands - Islands — React/Vue/Svelte components; use
useAuth()and other hooks from@clerk/astro/react
Setup
astro.config.mjs
src/middleware.ts
SSR Page Auth
Common Pitfalls
| Symptom | Cause | Fix | |
|---|---|---|---|
Astro.locals.auth is undefined | Missing middleware | Add clerkMiddleware to src/middleware.ts | |
| Auth works in dev but not production | output: 'static' globally | Set output: 'server' or hybrid for protected pages | |
| Static page has no auth | Prerendered pages skip middleware | Use export const prerender = false or move to island | |
| Island not reactive to sign-in | Missing client:load directive | Add client:load to the island component |
Import Map
| What | Import From | |
|---|---|---|
clerkMiddleware, createRouteMatcher | @clerk/astro/server | |
useAuth, useUser, UserButton | @clerk/astro/react | |
Astro components (<SignIn>, etc.) | @clerk/astro/components |
Env Variables
Astro uses PUBLIC_ prefix for client-exposed variables (not NEXT_PUBLIC_).
See Also
clerk-setup- Initial Clerk installclerk-custom-ui- Custom flows & appearanceclerk-orgs- B2B organizations
Docs
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingassets/skills-registry/clerk-astro-patterns/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/fjrg2007/enigma/clerk-astro-patterns)