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.
git clone --depth 1 https://github.com/nedcodes-ok/cursorrules-collectionWrote 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/rules/nedcodes-ok/cursorrules-collection/clerk)<a href="https://agentmods.dev/rules/nedcodes-ok/cursorrules-collection/clerk"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/clerk/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/rules/nedcodes-ok/cursorrules-collection/clerk"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursorrules-collection/clerk.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.00611 | $0.00611 |
| Opus 5.5 | $0.00244 | $0.00244 |
| Sonnet 5.5 | $0.00122 | $0.00122 |
| Haiku 4.5 | $0.00061 | $0.00061 |
Grade A, and why
clerk 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 2mo 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.
How it starts
The opening of the file, as written. The whole thing — 56 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Clerk Cursor Rules
You are an expert in Clerk authentication. Follow these rules:
Setup
- Wrap the app with ClerkProvider at the root layout
- Set publishableKey from env: NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY
- Configure sign-in/sign-up routes in env: NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
- Use Clerk's pre-built components (, ) unless custom UI is required
Middleware
- Use clerkMiddleware() in middleware.ts for all auth protection
- Protect routes with createRouteMatcher: const isProtected = createRouteMatcher(['/dashboard(.*)'])
- Call auth().protect() inside the middleware for protected routes
- Public routes (marketing, auth pages) don't need explicit configuration — they're unprotected by default
- Place middleware.ts at project root (or src/ if using src directory)
Server-Side Auth
- Use auth() in server components and API routes to get { userId, sessionId, orgId }
- Use currentUser() when you need the full user object (name, email, metadata)
- Check auth().userId — it's null for unauthenticated requests
- Never trust client-sent user IDs — always derive from auth() server-side
Client-Side Auth
- Use useAuth() for { userId, isSignedIn, isLoaded } in client components
- Use useUser() for full user object in client components
- Always check isLoaded before rendering auth-dependent UI
- Use and components for conditional rendering
User Management
- Store Clerk userId as the foreign key in your database — not email
- Sync user data via webhooks (user.created, user.updated) not on every request
- Use publicMetadata for role/permissions (readable by client, writable only by backend)
- Use privateMetadata for sensitive flags (server-only, never sent to client)
- Use unsafeMetadata only for user-editable preferences
Organizations
- Use useOrganization() for current org context
- Check orgId in middleware for org-scoped routes
- Use org roles for permission checks: auth().orgRole === 'admin'
- Create org-scoped data by storing orgId alongside records
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.
- 2mo ago First seen · 56 lines · 611 tokens per session scan A 1f27e16be262
clerk is a cursor rule published in the GitHub repository nedcodes-ok/cursorrules-collection (38 stars, last pushed 9mo ago), licensed MIT. It adds 611 tokens to every session, about $0.0024 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
clerk compared with cursor rules from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| clerknedcodes-ok/cursorrules-collection | Cursor rule | 38 | 9mo ago | MIT | A | 611 | Cursor |
| expressnedcodes-ok/cursor-lint-rules | Cursor rule | 1 | 9mo ago | none | A | 101 | Cursor |
| 10-backend-fastapiaiagentwithdhruv/ai-dev-stack | Cursor rule | 11 | 5mo ago | MIT | A | 0 | Cursor |
| 23-app-startuporbitalsonic/AndroidPilot | Cursor rule | 1 | 1mo ago | none | A | 0 | Cursor |
| 29-screen-startuporbitalsonic/AndroidPilot | Cursor rule | 1 | 1mo ago | none | A | 0 | Cursor |
| 21-ads-billingorbitalsonic/AndroidPilot | Cursor rule | 1 | 1mo ago | none | A | 0 | Cursor |
| 22-platform-firebaseorbitalsonic/AndroidPilot | Cursor rule | 1 | 1mo ago | none | A | 0 | Cursor |