nextjs-vercel-typescript-cursorrules-prompt-file

nextjs-vercel-typescript-cursorrules-prompt-file is a cursor rule for Cursor from PatrickJS/awesome-cursorrules. It costs 1,239 tokens per session, scanned A, original, CC0-1.0.

A set of Cursor rules for a Next.js and TypeScript application deployed with Vercel. The rules also cover React Server Components, an AI user interface library, middleware, and Vercel KV, a hosted key-value data store.

In plain words
What is it for?
Use it when developing a Next.js application with server-rendered React, AI-generated interface elements, Vercel middleware, and KV-backed state.
Why use it?
It gives the coding agent conventions for structure, naming, functional TypeScript, and stateful data handling. This helps generated code fit the application’s server, interface, and deployment setup.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc). Also seen: mentions Cursor.

About the project

PatrickJS/awesome-cursorrules is a collection of Markdown rule files that give Cursor AI editor project-specific instructions about code, frameworks, workflows, and standards. Developers use it to find reusable guidance for shaping Cursor’s behavior in different kinds of software projects.

PatrickJS/awesome-cursorrules · 40,732 stars · on GitHub

Install

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.

agentmods
npx agentmods add rules/patrickjs/awesome-cursorrules/nextjs-vercel-typescript-cursorrules-prompt-file
Clone the repo
git clone --depth 1 https://github.com/PatrickJS/awesome-cursorrules

Made for: Cursor.

Wrote 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.

agentmods badge for nextjs-vercel-typescript-cursorrules-prompt-file

README.md
[![agentmods](https://agentmods.dev/badge/rules/patrickjs/awesome-cursorrules/nextjs-vercel-typescript-cursorrules-prompt-file.svg)](https://agentmods.dev/rules/patrickjs/awesome-cursorrules/nextjs-vercel-typescript-cursorrules-prompt-file)
Your own site
<a href="https://agentmods.dev/rules/patrickjs/awesome-cursorrules/nextjs-vercel-typescript-cursorrules-prompt-file"><img src="https://agentmods.dev/badge/rules/patrickjs/awesome-cursorrules/nextjs-vercel-typescript-cursorrules-prompt-file.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,239 This file is loaded in full into every session.
When invoked 1,239 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.01239 $0.01239
Opus 5 $0.00620 $0.00620
Sonnet 5 $0.00248 $0.00248
Haiku 4.5 $0.00124 $0.00124

Measured 3d ago against content hash 0f8b2f65c9a4, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

nextjs-vercel-typescript-cursorrules-prompt-file 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 3d 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.

rules/nextjs-vercel-typescript-cursorrules-prompt-file.mdc · 134 lines

How it starts

The opening of the file, as written. The whole thing — 134 lines — stays where its author put it; the contents beside it link to each section on GitHub.

To extend the provided rules to include usage of the ai-sdk-rsc library and integrate it with Vercel middleware and a KV database, here's an updated set of instructions tailored for use with Cursor IDE. These instructions are designed to help you effectively implement generative user interfaces using React Server Components (RSC) with the AI SDK.

Extended Rules for AI SDK RSC Integration with Vercel Middleware and KV Database

Environment and Tools

  • You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI, Tailwind, and Vercel middleware.
  • You are familiar with Vercel's KV database for managing stateful data.

Code Style and Structure

  • Write concise, technical TypeScript code with accurate examples.
  • Use functional and declarative programming patterns; avoid classes.
  • Prefer iteration and modularization over code duplication.
  • Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
  • Structure files: exported component, subcomponents, helpers, static content, types.

Naming Conventions

  • Use lowercase with dashes for directories (e.g., components/auth-wizard).
  • Favor named exports for components.

TypeScript Usage

  • Use TypeScript for all code; prefer interfaces over types.
  • Avoid enums; use maps instead.
  • Use functional components with TypeScript interfaces.

Syntax and Formatting

  • Use the function keyword for pure functions.
  • Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
  • Use declarative JSX.

UI and Styling

  • Use Shadcn UI, Radix UI, and Tailwind for components and styling.
  • Implement responsive design with Tailwind CSS; use a mobile-first approach.

Performance Optimization

  • Minimize use client, useEffect, and setState; favor React Server Components (RSC).
  • Wrap client components in Suspense with fallback.
  • Use dynamic loading for non-critical components.
  • Optimize images: use WebP format, include size data, implement lazy loading.

Key Conventions

  • Use nuqs for URL search parameter state management.
  • Optimize Web Vitals (LCP, CLS, FID).
  • Limit use client:
    • Favor server components and Next.js SSR.
    • Use only for Web API access in small components.
    • Avoid for data fetching or state management.
  • Follow Next.js docs for Data Fetching, Rendering, and Routing.

AI SDK RSC Integration

  • Setup and Installation: Integrate ai-sdk-rsc into your Next.js project.

    • Install the library using npm install ai-sdk-rsc or yarn add ai-sdk-rsc.
    • Configure middleware in middleware.ts to manage requests and sessions using Vercel's KV database.
  • Middleware Implementation: Use Vercel middleware to handle incoming requests.

    • Create a middleware file in the middleware directory (e.g., middleware/ai-middleware.ts).
    • Use middleware to parse user input and manage sessions with the KV database.
    • Example:
      import { NextRequest, NextResponse } from 'next/server';
      import { kv } from '@vercel/kv';
      
      export async function middleware(req: NextRequest) {
        const sessionId = req.cookies.get('session-id');
        if (!sessionId) {
          const newSessionId = generateSessionId();
          await kv.set(newSessionId, { state: {} }); // Initialize state in KV database
          const res = NextResponse.next();
          res.cookies.set('session-id', newSessionId);
          return res;
        }
        // Fetch state from KV database
        const state = await kv.get(sessionId);
        req.nextUrl.searchParams.set('state', JSON.stringify(state));
        return NextResponse.next();
      }
      
      function generateSessionId() {
        return Math.random().toString(36).substring(2);
      }
      
  • React Server Components (RSC) and AI SDK:

    • Use ai-sdk-rsc hooks to manage state and stream generative content.
    • Example usage of AI SDK hooks in a React Server Component:
      import { useAIStream } from 'ai-sdk-rsc';
      import { FC } from 'react';
      
      interface ChatProps {
        initialMessage: string;
      }
      
      const Chat: FC = ({ initialMessage }) => {
        const { messages, sendMessage } = useAIStream({
          initialMessage,
          onMessage: (message) => console.log('New message:', message),
        });
      
        return (
          {msg.content}
        );
      
      export default Chat;
      

Read the full file on GitHub · 134 lines

Changes

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.

  1. 3d ago First seen · 134 lines · 1,239 tokens per session scan A 0f8b2f65c9a4

Subscribe to this mod's changes

nextjs-vercel-typescript-cursorrules-prompt-file is a cursor rule published in the GitHub repository PatrickJS/awesome-cursorrules (40,732 stars, last pushed 3mo ago), licensed CC0-1.0. It adds 1,239 tokens to every session, about $0.0062 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-09-03.