1{2 "skill_name": "clerk-tanstack-patterns",3 "evals": [4 {5 "id": 1,6 "prompt": "i have a tanstack react start app and want to protect the /dashboard route. unauthenticated users should be redirected to /sign-in. how do i add an auth guard to the route?",7 "expected_output": "Uses beforeLoad with createServerFn that calls auth() and throws redirect for unauthenticated users",8 "scaffold": "tanstack-basic-auth",9 "expectations": [
10 "Creates a createServerFn that calls auth() from @clerk/tanstack-react-start/server",
11 "Throws redirect({ to: '/sign-in' }) when isAuthenticated is false",
12 "Calls the server function in the route's beforeLoad",
13 "Imports are from the correct package paths",
14 "Does NOT use client-only hooks for the auth check"
15 ]
16 },
17 {
18 "id": 2,
19 "prompt": "i need a server function that fetches the current user's orders from my database. it should only work for authenticated users and return the userId alongside the orders.",
20 "expected_output": "Creates a createServerFn that uses auth() to get userId, fetches data, throws if not authenticated",
21 "scaffold": "tanstack-basic-auth",
22 "expectations": [
23 "Uses createServerFn from @tanstack/react-start",
24 "Calls auth() from @clerk/tanstack-react-start/server inside the handler",
25 "Checks isAuthenticated and throws an error or redirect if false",
26 "Returns userId with the data payload",
27 "Server function is called from a route loader or component"
28 ]
29 },
30 {
31 "id": 3,
32 "prompt": "i want a layout route that wraps all /app/* routes and protects them. the layout should check auth once and all child routes inherit the protection without repeating the check.",
33 "expected_output": "Creates a layout route file with beforeLoad auth check that child routes inherit via route context",
34 "scaffold": "tanstack-basic-auth",
35 "expectations": [
36 "Creates a layout route (e.g. src/routes/app.tsx or _layout.tsx pattern)",
37 "Uses beforeLoad at the layout level with auth() check",
38 "Passes userId or auth data through route context for child routes to access",
39 "Child routes can access the auth context without re-fetching",
40 "Throws redirect to /sign-in for unauthenticated access"
41 ]
42 },
43 {
44 "id": 4,
45 "prompt": "my app needs to show org-specific data. when a user has an active org, load org projects in the route loader. if no org is selected, show a message to select one.",
46 "expected_output": "Route loader uses auth() to get orgId, conditionally fetches org data, handles missing org case",
47 "scaffold": "tanstack-basic-auth",
48 "expectations": [
49 "Uses auth() in a createServerFn or loader to get orgId",
50 "Handles null orgId case by returning empty state or redirecting",
51 "Fetches org-scoped data using orgId",
52 "Component handles both states: org selected and no org selected",
53 "Shows OrganizationSwitcher or prompt when no org is active"
54 ]
55 },
56 {
57 "id": 5,
58 "prompt": "i want to build a custom sign-in page using clerk's useSignIn hook instead of the prebuilt component. create a page with email/password fields.",
59 "expected_output": "Creates a sign-in page using useSignIn hook with signIn.create() for email/password authentication",
60 "scaffold": "tanstack-basic-auth",
61 "expectations": [
62 "Uses useSignIn hook from @clerk/tanstack-react-start",
63 "Calls signIn.create({ identifier, password }) to initiate sign-in",
64 "Handles the complete() or firstFactorVerification result",
65 "Shows loading state during sign-in",
66 "Handles errors from the sign-in attempt"
67 ]
68 },
69 {
70 "id": 6,
71 "prompt": "i have a tanstack start api route that needs to verify the user is authenticated before processing a webhook or mutation. show me how to protect it.",
72 "expected_output": "API route handler using auth() from server package to verify auth state, returns 401 if not authenticated",
73 "scaffold": "tanstack-basic-auth",
74 "expectations": [
75 "Uses auth() from @clerk/tanstack-react-start/server in the handler",
76 "Returns a 401 response for unauthenticated requests",
77 "Extracts userId or sessionId from the auth result",
78 "Does NOT use client-side hooks in the server handler",