Agent skill · software engineering · jeremylongshore
clerk-hello-world
Create your first authenticated request with Clerk.
Why this skill is useful
Provides specific API integration patterns and authentication flows for Clerk that the AI wouldn't reliably generate on its own.
What it needs
Requires clerk installed locally. Requires clerk account access. About 4k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.
What this skill does
Clerk Hello World Overview Make your first authenticated requests using Clerk across server components, client components, API routes, and server actions. Validates your Clerk integration end-to-end. Prerequisites Clerk SDK installed (clerk-install-auth completed) Environment variables configured (NEXTPUBLICCLERKPUBLISHABLEKEY, CLERKSECRETKEY) ClerkProvider wrapping application root Middleware configured at project root Instructions Step 1: Server Component — auth() and currentUser() Key distinction: auth() is cheap (JWT parsing, no network). currentUser() is expensive (Backend API call, rate-limited). Prefer auth() when you only need userId, orgId, or sessionClaims. Step 2: Protected API Route Step 3: Client Component with Hooks Step 4: Server Action with Auth Step 5: Express.js Hello World Error Handling Error Cause Solution ------- ------- ---------- userId is null User not authenticated Redirect to /sign-in or check middleware covers route currentUser() returns null Session expired or invalid Refresh page; ensure middleware is running 401 from API route Token missing or expired Include Authorization: Bearer <token> header Hydration mismatch Server/client state differs Guard client components with isLoaded check auth() was called but Clerk can't detect clerkMiddleware() Middleware not in project root Move middleware.ts out of app/ to project root Enterprise Considerations Use auth() over currentUser() in hot paths to avoid Backend API rate limits Deduplicate currentUser() calls with React's cache() function across server components in the same request For microservices, pass Clerk JWTs between services and verify with @clerk/backend or @clerk/express Session token v2 (default since April 2025) uses a more compact format -- ensure downstream JWT consumers are updated Custom session claims can be set in Dashboard > Sessions > Customize session token (limit: 1.2KB) Resources auth() Reference currentUser() Reference useUser() Hook Express getAuth() Next Steps Proceed …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills jeremylongshore/clerk-hello-world--0b471a