Create your first authenticated request with Clerk.
Use when making initial API calls, testing authentication,
or verifying Clerk integration works correctly.
Trigger with phrases like "clerk hello world", "first clerk request",
"test clerk auth", "verify clerk setup".
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
A direct command skips the review prompt. Inspect the source before running it.
Create your first authenticated request with Clerk.
Use when making initial API calls, testing authentication,
or verifying Clerk integration works correctly.
Trigger with phrases like "clerk hello world", "first clerk request",
"test clerk auth", "verify clerk setup".
allowed-tools
Read, Write, Edit, Bash(npm:*), Grep
version
1.14.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
["saas","clerk","api","testing","authentication"]
compatibility
Designed for Claude Code
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.
Step 1: Server Component — auth() and currentUser()
// app/dashboard/page.tsximport { auth, currentUser } from'@clerk/nextjs/server'import { redirect } from'next/navigation'exportdefaultasyncfunctionDashboardPage() {
// auth() is lightweight — reads JWT from the session cookie, no API callconst { userId } = awaitauth()
if (!userId) redirect('/sign-in')
// currentUser() makes a Backend API call — use sparingly, counts toward rate limitconst user = awaitcurrentUser()
return (
<div><h1>Hello, {user?.firstName || 'User'}!</h1><p>User ID: {userId}</p><p>Email: {user?.emailAddresses[0]?.emailAddress}
Created: {user?.createdAt ? new Date(user.createdAt).toLocaleDateString() : 'N/A'}
)
}
</p>
<p>
</p>
</div>
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.