midudev/autoskills/clerk-tanstack-patterns
Claude Code and agent skill by midudev/autoskills
Trust tier 2
- community
Source check pending
Checking that the SKILL.md file is still in the repository.
'TanStack React Start auth patterns with @clerk/tanstack-react-start
Install
npx vskill@latest install midudev/autoskills/clerk-tanstack-patternsSKILL.md
TanStack React Start Patterns
What Do You Need?
| Task | Reference | |
|---|---|---|
| Protect routes with beforeLoad | references/router-guards.md | |
| Auth in createServerFn | references/server-functions.md | |
| Pass auth to loaders | references/loaders.md | |
| Configure Vite + Clerk middleware | references/server-setup.md |
References
| Reference | Description | |
|---|---|---|
references/router-guards.md | beforeLoad auth redirect | |
references/server-functions.md | createServerFn with auth() | |
references/loaders.md | Auth context in loaders | |
references/server-setup.md | Vite and request middleware setup |
Setup
.env:
src/start.ts (request middleware):
src/routes/__root.tsx — wrap with <ClerkProvider>:
Mental Model
TanStack Start uses the tanstackStart() Vite plugin. Register CSRF protection before Clerk request middleware in src/start.ts; auth then flows through two layers:
- Server layer —
createServerFn+auth()from@clerk/tanstack-react-start/server - Router layer —
beforeLoadon route definitions, throwsredirectfor unauthenticated
Both layers are server-executed. Client hooks (useAuth, useUser) are React hooks for the browser side.
Minimal Pattern
Common Pitfalls
| Symptom | Cause | Fix | |
|---|---|---|---|
auth() throws "without configuring the middleware" | Missing clerkMiddleware in start.ts | Add it after CSRF middleware in requestMiddleware | |
redirect not thrown | Using return instead of throw | throw redirect(...) in TanStack | |
Wrong import for auth | Mixing client/server imports | Server: @clerk/tanstack-react-start/server | |
| Loader context missing userId | Not passing from beforeLoad | Return from beforeLoad, access via context | |
ClerkProvider missing | Forgot root wrapping | Add to __root.tsx shell component |
See Also
clerk-setup- Initial Clerk installclerk-custom-ui- Custom flows & appearanceclerk-orgs- B2B organizations
Docs
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpackages/autoskills/skills-registry/clerk-tanstack-patterns/SKILL.md
Popularity
- Repository stars
- 6,099
- Repository forks
- 561
- 7-day trend score
- 44
Stars and forks are for the whole GitHub repository, not this skill alone. 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/midudev/autoskills/clerk-tanstack-patterns)