Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add sutchan/Agent-Skills-Hub --skill clerk-nextjs-patternsgit clone --depth 1 https://github.com/sutchan/Agent-Skills-HubWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/sutchan/agent-skills-hub/clerk-nextjs-patterns)<a href="https://agentmods.dev/skills/sutchan/agent-skills-hub/clerk-nextjs-patterns"><img src="https://agentmods.dev/badge/skills/sutchan/agent-skills-hub/clerk-nextjs-patterns/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/sutchan/agent-skills-hub/clerk-nextjs-patterns"><img src="https://agentmods.dev/badge/skills/sutchan/agent-skills-hub/clerk-nextjs-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00041 | $0.03085 |
| Opus 5.5 | $0.00016 | $0.01234 |
| Sonnet 5.5 | $0.00008 | $0.00617 |
| Haiku 4.5 | $0.00004 | $0.00309 |
Grade A, and why
clerk-nextjs-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 25d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
88% identical to clerk-nextjs-patterns — 137 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 290 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Next.js Patterns
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 clerk-setup skill.
Route protection: call
await auth.protect()in each page, Route Handler, and Server Function. KeepclerkMiddleware()bare.createRouteMatcheris deprecated in@clerk/nextjs7 and will be removed in the next major version. Don't add it. If a project already uses it, leave it working and point the user to the migration guide.
What Do You Need?
| Task | Reference |
|---|---|
Server vs client auth (auth() vs hooks) |
references/server-vs-client.md |
| Protect routes (check in each page, handler, and Server Function) | 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 |
Fix next build errors under Cache Components |
Cache Components |
References
| Reference | Description |
|---|---|
references/server-vs-client.md |
await auth() vs hooks |
references/middleware-strategies.md |
auth.protect() in each resource, bare clerkMiddleware() in proxy.ts (Next.js <=15: middleware.ts) |
references/server-actions.md |
Protect mutations |
references/api-routes.md |
401 vs 403 |
references/caching-auth.md |
User-scoped caching with 'use cache' |
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.
Key properties from auth():
isAuthenticated— boolean, replaces the!!userIdpatternsessionStatus—'active'|'pending', for detecting incomplete session tasksuserId,orgId,orgSlug,has(),protect()— unchanged
What ships with it
12 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- evals/evals.json 5.3 KB
- references/api-routes.md 1.4 KB
- references/caching-auth.md 3.0 KB
- references/middleware-strategies.md 7.8 KB
- references/server-actions.md 1.6 KB
- references/server-vs-client.md 3.0 KB
- templates/nextjs-basic-auth/app/layout.tsx 659 B
- templates/nextjs-basic-auth/app/page.tsx 58 B
- templates/nextjs-basic-auth/next.config.ts 155 B runs code
- templates/nextjs-basic-auth/package.json 392 B
- templates/nextjs-basic-auth/proxy.ts 280 B runs code
- templates/nextjs-basic-auth/tsconfig.json 612 B
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 25d ago Changed · -1 lines · +41 tokens per session 8129bb2fe27f
- 26d ago Changed · +34 lines · -41 tokens per session 5c56348ba9c6
- 1mo ago Changed · +4 lines 77d897e3ee70
- 1mo ago Changed · +20 tokens per session 92b8935fe2f0
- 2mo ago Changed · -2 lines · -20 tokens per session 51a833e5f5ed
- 3mo ago First seen · 255 lines · 41 tokens per session scan A d8d1c45f42c1
clerk-nextjs-patterns is a skill published in the GitHub repository sutchan/Agent-Skills-Hub (3 stars, last pushed 6d ago), licensed MIT. It adds 41 tokens to every session and 3,085 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 88% identical to clerk-nextjs-patterns, differing in 137 lines, and is treated as a copy.
clerk-nextjs-patterns compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| clerk-nextjs-patternssutchan/Agent-Skills-Hub | Skill | 3 | 6d ago | MIT | A | 41 | Claude Code |
| frontend-best-practicesWade-DevCode/awesome-coding-skills-cn | Skill | 7 | 5mo ago | MIT | A | 29 | Claude Code, Codex |
| slide-authoringshennawardana23/skillme | Skill | 4 | 1mo ago | Apache-2.0 | A | 146 | Claude Code |
| afrexai-react-productionLeoYeAI/openclaw-master-skills | Skill | 2.2k | 8d ago | MIT | A | 32 | Claude Code, Codex |
| remotion-best-practicesguanyang/open-agent-hub | Skill | 1.0k | yesterday | MIT | A | 116 | Claude Code |
| skill-index-updaterluongnv89/asm | Skill | 976 | yesterday | MIT | B | 59 | Claude Code |
| react-native-expoWrongStack/WrongStack | Skill | 444 | yesterday | MIT | A | 95 | Claude Code |