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".
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Um comando direto ignora o prompt de revisão. Verifique a origem antes de executá-lo.
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, also compatible with Codex and OpenClaw
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.