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 agentmods add rules/tugkanboz/awesome-cursorrules/app-router-patternsgit clone --depth 1 https://github.com/tugkanboz/awesome-cursorrulesWrote 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/tugkanboz/awesome-cursorrules/app-router-patterns)<a href="https://agentmods.dev/rules/tugkanboz/awesome-cursorrules/app-router-patterns"><img src="https://agentmods.dev/badge/rules/tugkanboz/awesome-cursorrules/app-router-patterns.svg" alt="Measured on agentmods" 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 | $0.02554 | $0.02554 |
| Opus 5 | $0.01277 | $0.01277 |
| Sonnet 5 | $0.00511 | $0.00511 |
| Haiku 4.5 | $0.00255 | $0.00255 |
Grade A, and why
app-router-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 4d 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 — 374 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Next.js App Router Excellence
Server Components vs Client Components
- Default is Server Component — every file in
app/is a Server Component unless marked otherwise - Add
"use client"only at the boundary where you need browser APIs, event handlers, or React state - Keep
"use client"components as leaf nodes; wrap them in Server Components for data fetching - Never fetch data inside a Client Component when a Server Component parent can pass it as a prop
// ✅ Server Component — async, direct DB/API access, no "use client"
// app/products/page.tsx
import { db } from '@/lib/db'
export default async function ProductsPage() {
const products = await db.product.findMany({ orderBy: { createdAt: 'desc' } })
return (
<main>
<h1>Products</h1>
{products.map((product) => (
<ProductCard key={product.id} product={product} />
))}
</main>
)
}
// ✅ Client Component — only for interactivity
// components/add-to-cart-button.tsx
'use client'
import { useState } from 'react'
interface AddToCartButtonProps {
productId: string
}
export function AddToCartButton({ productId }: AddToCartButtonProps) {
const [loading, setLoading] = useState(false)
const handleAdd = async () => {
setLoading(true)
await addToCart(productId)
setLoading(false)
}
return (
<button onClick={handleAdd} disabled={loading}>
{loading ? 'Adding…' : 'Add to Cart'}
</button>
)
}
App Router File Conventions
app/
├── layout.tsx # Root layout — wraps all routes, runs once
├── page.tsx # Route UI rendered at /
├── loading.tsx # Automatic Suspense boundary for this segment
├── error.tsx # Error boundary ("use client" required)
├── not-found.tsx # Rendered by notFound() or unmatched routes
├── global-error.tsx # Error boundary for root layout
├── route.ts # API Route Handler (no page.tsx in same segment)
├── template.tsx # Like layout but re-mounts on navigation
└── products/
├── page.tsx # Renders at /products
├── [id]/
│ └── page.tsx # Renders at /products/:id
└── (marketing)/ # Route group — ignored in URL path
└── page.tsx
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.
- 4d ago First seen · 374 lines · 2,554 tokens per session scan A 01656ff9b25e
app-router-patterns is a cursor rule published in the GitHub repository tugkanboz/awesome-cursorrules (20 stars, last pushed yesterday), licensed MIT. It adds 2,554 tokens to every session, about $0.0128 per session on Opus 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-08-30.
Other cursor rules, from other repositories
cursorrules
You are building an AI/ML project with Python. The project uses PyTorch for model training, handles data pipelines with proper validation, tracks experiments systematically, and follows production ML engineering practices. Code is type-hinted, tested, and reproducible.
refactoring
Refactoring: systematic approach, extract/inline, guard clauses, early returns.
unity-input
Guidelines for working with the New Input System in Unity 6.2.
unity-ui
Assets/ ├── UI/ │ ├── Runtime/ │ │ ├── Controllers/ │ │ │ └── MainMenuController.cs │ │ ├── Views/ │ │ │ └── MainMenuView.cs │ │ ├── ViewModels/ │ │ │ └── HealthViewModel.cs │ │ ├── UXML/ │ │ │ └── MainMenu.uxml │ │ └── USS/ │ │ └── MainMenu.uss │ └── Editor/ │ └── UIBuilderExtensions.cs.
code-organization
Assets/ ├── !Project/ # Main project content (! keeps it at top) │ ├── Art/ │ │ ├── Materials/ │ │ ├── Models/ │ │ ├── Textures/ │ │ └── Animations/ │ ├── Audio/ │ │ ├── Music/ │ │ ├── SFX/ │ │ └── Mixers/ │ ├── Prefabs/ │ │ ├── Characters/ │ │ ├── Environment/ │ │ ├── UI/ │ │ └── Effects/ │ ├── Scenes/ │ │ ├──…
unity-core
// ✅ DO: PascalCase public class PlayerController : MonoBehaviour { }.