원클릭으로
clerk-nextjs-patterns
Advanced Next.js patterns - middleware, Server Actions, caching with Clerk.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Advanced Next.js patterns - middleware, Server Actions, caching with Clerk.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Rewrite any text as a solemn, slightly absurd 19th-century Civil War field dispatch (Ken Burns documentary voice), then optionally turn it into a multimodal video — period narration via ElevenLabs, the letter in fancy script on aged parchment, a mournful music bed, and a slow Ken Burns pan/zoom of the letter being read. Use when the user types /civilwar, asks to "civil-war-ify" or "Ken Burns" some text, or asks for a documentary-style letter video.
Router / skill-set hub for the 33GOD / DeLoNET project platform. Routes user intent to the right member skill: project bootstrap (33god-projects), pjangler implementation (pjangler-dev), agent hook/skill fan-out (agent-config-fanout), Hermes fleet operations (hermes-fleet-operations), Plane ticket operations (managing-tickets-and-tasks-in-plane), Bloodbank events (bloodbank-integration), host conventions (delonet-conventions), versioning (mise-versioning), task authoring (mise-tasks), and memory (hindsight). Use when the request spans multiple 33GOD components or when you are unsure which member skill owns a 33GOD task. Triggers: 33god, 33GOD, DeLoNET, project platform, pjangler, CommonProject, Hermes, Plane, Bloodbank, agent hooks, skill fan-out, fleet, project bootstrap. Does NOT implement procedures; it loads the member skill that does.
Create, wire, and maintain 33god/DeLoNET projects. Covers pjangler/CommonProject bootstrap, repo-local `.project.json`, Hermes PM and scrum-master/Ticket Sentinel provisioning requests, mise/.env.op, BMAD, Hindsight/Bloodbank hook wiring, and project-scoped hook + skill fan-out adoption. Use when running `pjangler init`, `pjangler hermes-agent`, or `mise run init-project`; adding PM/sentinel agents; wiring mise/op inject; installing BMAD; configuring hooks; or adopting `.agents/local.json`, `defer_to_global`, and `hooks.master.json`. Do NOT use for developing pjangler (pjangler-dev), generic fan-out mechanics (agent-config-fanout), fleet updates/backfills (hermes-fleet-operations), live Plane issues, Bloodbank schemas, or host conventions.
Keep one hand-edited master config and generate per-agent CLI configs from it. Covers SSOT fan-out for agent hooks and skills: master-to-dialect propagation, ambiguity lock files, drift checks, and the Bloodbank services/agent-hooks reference implementation. Use for hooks.master.json, hooks.mappings.lock.json, generated-config drift, fan-out, SSOT, agent hooks, defer_to_global, .agents/local.json, sync.py, project-scoped hooks, skill fan-out, and new agent CLI dialects. Do NOT use for using pjangler to create projects or adoption checklists (33god-projects), event schemas or Bloodbank topology (bloodbank-integration), versioning (mise-versioning), or single-target config.
Integrate services or agent harnesses with the 33GOD Bloodbank event bus. Covers schemas in Bloodbank schemas/ and docs/event-naming.md, producing events (NATS preferred; Dapr, HTTP /publish, hookd_bridge alternatives), consuming events (NATS, Dapr, FastStream, event-toaster), and agent hook wiring. Use for event publish/consume, authoring schemas, integrating harnesses (Claude Code, Copilot CLI, OpenCode, Cursor, Aider, Codex CLI), or debugging missing envelopes. Triggers: bloodbank, event bus, publish, subscribe, NATS subject, holyfields legacy, CloudEvents, hookd, event-toaster, ntfy.delo.sh/bloodbank, agent.session.started, agent.tool.invoked, command.{agent}.{action}. Skip for generic brokers, n8n, hindsight memory, or non-event-bus 33GOD.
Operate and maintain the Hermes agent fleet: shared install, ~/.hermes/fleet.env, ~/.hermes/config.yaml, ~/.hermes/agents-registry.yaml, hermes-agent-template, role profiles and inherited config, runtime repo provisioning, systemd user units, fleet self-checks, template defaults, and PM/template backfills. Use when updating Hermes core, changing fleet defaults, provisioning agents, debugging fleet-wide MCP failures, running a Hermes fleet self-check, or propagating template changes to existing PM agents. Triggers: Hermes fleet, hermes-agent-template, ~/.hermes/fleet.env, ~/.hermes/config.yaml, ~/.hermes/agents-registry.yaml, inherited profile, fleet self-check, systemd hermes-*, template backfill, runtime repo provisioning. Do NOT use for: project bootstrap decisions or repo-local agent requests (→ 33god-projects); Plane ticket operations (→ managing-tickets-and-tasks-in-plane); Bloodbank event contracts (→ bloodbank-integration); generic SSOT config fan-out mechanics (→ agent-config-fanout).
| name | clerk-nextjs-patterns |
| description | Advanced Next.js patterns - middleware, Server Actions, caching with Clerk. |
| license | MIT |
| allowed-tools | WebFetch |
| inputs | [{"name":"NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY","description":"Clerk publishable key from dashboard","required":true},{"name":"CLERK_SECRET_KEY","description":"Clerk secret key for server-side operations","required":true}] |
| references | ["references/server-vs-client.md","references/middleware-strategies.md","references/server-actions.md","references/api-routes.md","references/caching-auth.md"] |
| metadata | {"author":"clerk","version":"2.2.0"} |
Version: Check
package.jsonfor the SDK version — seeclerkskill for the version table. Core 2 differences are noted inline with> **Core 2 ONLY (skip if current SDK):**callouts.
For basic setup, see setup/.
| Task | Reference |
|---|---|
Server vs client auth (auth() vs hooks) | references/server-vs-client.md |
| Configure middleware (public-first vs protected-first) | references/middleware-strategies.md |
| Protect Server Actions | references/server-actions.md |
| API route auth (401 vs 403) | references/api-routes.md |
| Cache auth data (user-scoped caching) | references/caching-auth.md |
| Reference | Impact |
|---|---|
references/server-vs-client.md | CRITICAL - await auth() vs hooks |
references/middleware-strategies.md | HIGH - Public-first vs protected-first, proxy.ts (Next.js <=15: middleware.ts) |
references/server-actions.md | HIGH - Protect mutations |
references/api-routes.md | HIGH - 401 vs 403 |
references/caching-auth.md | MEDIUM - User-scoped caching |
Server vs Client = different auth APIs:
await auth() from @clerk/nextjs/server (async!)useAuth() hook from @clerk/nextjs (sync)Never mix them. Server Components use server imports, Client Components use hooks.
Key properties from auth():
isAuthenticated — boolean, replaces the !!userId patternsessionStatus — 'active' | 'pending', for detecting incomplete session tasksuserId, orgId, orgSlug, has(), protect() — unchangedCore 2 ONLY (skip if current SDK):
isAuthenticatedandsessionStatusare not available. Check!!userIdinstead.
// Server Component
import { auth } from '@clerk/nextjs/server'
export default async function Page() {
const { isAuthenticated, userId } = await auth() // MUST await!
if (!isAuthenticated) return <p>Not signed in</p>
return <p>Hello {userId}</p>
}
Core 2 ONLY (skip if current SDK):
isAuthenticatedis not available. Useif (!userId)instead.
<Show>For client-side conditional rendering based on auth state:
import { Show } from '@clerk/nextjs'
<Show when="signed-in" fallback={<p>Please sign in</p>}>
<Dashboard />
</Show>
Core 2 ONLY (skip if current SDK): Use
<SignedIn>and<SignedOut>components instead of<Show>. Seecustom-ui/core-3/show-component.mdfor the full migration table.
| Symptom | Cause | Fix |
|---|---|---|
undefined userId in Server Component | Missing await | await auth() not auth() |
| Auth not working on API routes | Missing matcher | Add `'/(api |
| Cache returns wrong user's data | Missing userId in key | Include userId in unstable_cache key |
| Mutations bypass auth | Unprotected Server Action | Check auth() at start of action |
| Wrong HTTP error code | Confused 401/403 | 401 = not signed in, 403 = no permission |
setup/orgs/