clerk-nextjs-patterns
БесплатноБез исполняемых скриптовНе проверенAdvanced Next.js patterns - middleware, Server Actions, caching with Clerk.
от vvedantb★ 100 звёзд на GitHubОб этом скилле
Next.js Patterns
For basic setup, see setup/.
Impact Levels
- CRITICAL - Breaking bugs, security holes
- HIGH - Common mistakes
- MEDIUM - Optimization
References
| Reference | Impact |
|---|---|
references/server-vs-client.md |
CRITICAL - await auth() vs hooks |
references/middleware-strategies.md |
HIGH - Public-first vs protected-first |
references/server-actions.md |
HIGH - Protect mutations |
references/api-routes.md |
HIGH - 401 vs 403 |
references/caching-auth.md |
MEDIUM - User-scoped caching |
Mental Model
Server vs Client = different auth APIs:
- Server:
await auth()from@clerk/nextjs/server(async!) - Client:
useAuth()hook from@clerk/nextjs(sync)
Never mix them. Server Components use server imports, Client Components use hooks.
Minimal Pattern
// Server Component
import { auth } from '@clerk/nextjs/server'
export default async function Page() {
const { userId } = await auth() // MUST await!
if (!userId) return <p>Not signed in</p>
return <p>Hello {userId}</p>
}
Common Pitfalls
| Symptom | Cause | Fix |
| -------------------------------------- | ------------------------- | ---------------------------------------- | -------------------------- |
| undefined userId in Server Component | Missing await | await auth() not auth() |
| Auth not working on API routes | Missing matcher | Add '/(api | trpc)(.\*)' to middleware |
| 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 |
See Also
setup/managing-orgs/
Docs
Установить clerk-nextjs-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
WebFetchВложенные файлы
FAQ
Что делает скилл clerk-nextjs-patterns?
Advanced Next.js patterns - middleware, Server Actions, caching with Clerk.
Как установить скилл clerk-nextjs-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл clerk-nextjs-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic