RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/.cursorrules/paulpham157/paul-s-cursor-rules

.cursorrules (deprecated)

1/framework_rules/rules/nextjs-vercel-typescript-cursorrules-prompt-file/.cursorrules
.cursorrules

Quality

59/100

Scores the file, not the repository.

Length

716 words

1 headings · 2 code blocks

Repository

28

— · pushed 478 days ago

Last changed

3 days ago

First indexed 3 days ago.
paulpham157/paul-s-cursor-rules/1/framework_rules/rules/nextjs-vercel-typescript-cursorrules-prompt-file/.cursorrulesRawGitHub
1To 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.
2 
3### Extended Rules for AI SDK RSC Integration with Vercel Middleware and KV Database
4 
5**Environment and Tools**
6 
7- You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI, Tailwind, and Vercel middleware.
8- You are familiar with Vercel's KV database for managing stateful data.
9 
10**Code Style and Structure**
11 
12- Write concise, technical TypeScript code with accurate examples.
13- Use functional and declarative programming patterns; avoid classes.
14- Prefer iteration and modularization over code duplication.
15- Use descriptive variable names with auxiliary verbs (e.g., `isLoading`, `hasError`).
16- Structure files: exported component, subcomponents, helpers, static content, types.
17 
18**Naming Conventions**
19 
20- Use lowercase with dashes for directories (e.g., `components/auth-wizard`).
21- Favor named exports for components.
22 
23**TypeScript Usage**
24 
25- Use TypeScript for all code; prefer interfaces over types.
26- Avoid enums; use maps instead.
27- Use functional components with TypeScript interfaces.
28 
29**Syntax and Formatting**
30 
31- Use the `function` keyword for pure functions.
32- Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
33- Use declarative JSX.
34 
35**UI and Styling**
36 
37- Use Shadcn UI, Radix UI, and Tailwind for components and styling.
38- Implement responsive design with Tailwind CSS; use a mobile-first approach.
39 
40**Performance Optimization**
41 
42- Minimize `use client`, `useEffect`, and `setState`; favor React Server Components (RSC).
43- Wrap client components in `Suspense` with fallback.
44- Use dynamic loading for non-critical components.
45- Optimize images: use WebP format, include size data, implement lazy loading.
46 
47**Key Conventions**
48 
49- Use `nuqs` for URL search parameter state management.
50- Optimize Web Vitals (LCP, CLS, FID).
51- Limit `use client`:
52 - Favor server components and Next.js SSR.
53 - Use only for Web API access in small components.
54 - Avoid for data fetching or state management.
55- Follow Next.js docs for Data Fetching, Rendering, and Routing.
56 
57**AI SDK RSC Integration**
58 
59- **Setup and Installation**: Integrate `ai-sdk-rsc` into your Next.js project.
60 - Install the library using `npm install ai-sdk-rsc` or `yarn add ai-sdk-rsc`.
61 - Configure middleware in `middleware.ts` to manage requests and sessions using Vercel's KV database.
62 
63- **Middleware Implementation**: Use Vercel middleware to handle incoming requests.
64 - Create a middleware file in the `middleware` directory (e.g., `middleware/ai-middleware.ts`).
65 - Use middleware to parse user input and manage sessions with the KV database.
66 - Example:
67```typescript
68 import { NextRequest, NextResponse } from 'next/server';
69 import { kv } from '@vercel/kv';
70 
71 export async function middleware(req: NextRequest) {
72 const sessionId = req.cookies.get('session-id');
73 if (!sessionId) {
74 const newSessionId = generateSessionId();
75 await kv.set(newSessionId, { state: {} }); // Initialize state in KV database
76 const res = NextResponse.next();
77 res.cookies.set('session-id', newSessionId);
78 return res;
79 }
80 // Fetch state from KV database
81 const state = await kv.get(sessionId);
82 req.nextUrl.searchParams.set('state', JSON.stringify(state));
83 return NextResponse.next();
84 }
85 
86 function generateSessionId() {
87 return Math.random().toString(36).substring(2);
88 }
89```
90 
91- **React Server Components (RSC) and AI SDK**:
92 - Use `ai-sdk-rsc` hooks to manage state and stream generative content.
93 - Example usage of AI SDK hooks in a React Server Component:
94```typescript
95 import { useAIStream } from 'ai-sdk-rsc';
96 import { FC } from 'react';
97 
98 interface ChatProps {
99 initialMessage: string;
100 }
101 
102 const Chat: FC = ({ initialMessage }) => {
103 const { messages, sendMessage } = useAIStream({
104 initialMessage,
105 onMessage: (message) => console.log('New message:', message),
106 });
107 
108 return (
109 {msg.content}
110 );
111 
112 export default Chat;
113```
114 
115- **KV Database Integration**:
116 - Use Vercel's KV database to store and retrieve session data.
117 - Utilize `kv.set`, `kv.get`, and `kv.delete` to manage data.
118 - Ensure the database operations are asynchronous to avoid blocking server-side rendering (SSR).
119 
120- **Data Fetching and State Management**:
121 - Use Next.js data fetching methods (`getServerSideProps`, `getStaticProps`) to manage server-side state.
122 - Avoid client-side data fetching methods (`useEffect`, `fetch`) except for critical, non-blocking operations.
123 
124- **Deployment Considerations**:
125 - Ensure all environment variables (e.g., API keys, database credentials) are securely stored in Vercel's environment settings.
126 - Configure Vercel's KV and other serverless functions correctly to handle scalability and performance needs.
127 
128By following these extended rules, you'll be able to create a well-optimized, scalable, and efficient Next.js application that leverages `ai-sdk-rsc`, Vercel middleware, and KV database for building sophisticated AI-driven interfaces.
129 
130 

Commands it names

  • npm install ai-sdk-rsc
  • yarn add ai-sdk-rsc

Sections

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

What it covers

setupcode-styledatabasedo-not

Stack — with the evidence

github-actions

(0.60)

Format

.cursorrules

Cursor's original single-file format, superseded by .cursor/rules/*.mdc. Tracked here precisely because it is dead: how much of the ecosystem is still shipping a deprecated file is a measurable answer, and a large share of the "best cursor rules" pages on the web still teach this format.

What the corpus says about it

Repository

Owner
paulpham157
Language
—
License
—
Archived
no

All configs in this repo

Also in paulpham157/paul-s-cursor-rules

Diff this repo’s formats

One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?

The other instruction files in this repository
RepositoryFormatStackCoversScoreChanged
paulpham157/paul-s-cursor-rules1/framework_rules/rules/react-styled-components-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsstyle42/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/react-typescript-nextjs-nodejs-cursorrules-prompt-/.cursorrules · 28.cursorrulesgithub-actionsstyle44/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/.cursorrules · 28.cursorrulesgithub-actionsdocs34/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/android-jetpack-compose-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionstesting-strategy38/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/angular-novo-elements-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionstestlint-formatstylearch+370/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/angular-typescript-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsteststyledocs38/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/ascii-simulation-game-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsno sections34/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/aspnet-abp-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionstestlint-formatstylearch+570/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/astro-typescript-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsgit30/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/chrome-extension-dev-js-typescript-cursorrules-pro/.cursorrules · 28.cursorrulesgithub-actionsstyle38/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/cpp-programming-guidelines-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsteststylearchperformance68/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/cursor-ai-react-typescript-shadcn-ui-cursorrules-p/.cursorrules · 28.cursorrulesgithub-actionsno sections16/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/cursorrules-cursor-ai-nextjs-14-tailwind-seo-setup/.cursorrules · 28.cursorrulesgithub-actionsstyletypesuido-not65/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/cursorrules-cursor-ai-wordpress-draft-macos-prompt/.cursorrules · 28.cursorrulesgithub-actionsno sections16/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/cursorrules-file-cursor-ai-python-fastapi-api/.cursorrules · 28.cursorrulesgithub-actionsstyletypes38/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/deno-integration-techniques-cursorrules-prompt-fil/.cursorrules · 28.cursorrulesgithub-actionsno sections16/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/dragonruby-best-practices-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsstyle34/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/drupal-11-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsstyle46/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/elixir-engineer-guidelines-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsno sections16/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/elixir-phoenix-docker-setup-cursorrules-prompt-fil/.cursorrules · 28.cursorrulesgithub-actionsgit30/1003 days ago
Diff against 1/framework_rules/rules/react-styled-components-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/react-typescript-nextjs-nodejs-cursorrules-prompt-/.cursorrules Diff against 1/framework_rules/.cursorrules Diff against 1/framework_rules/rules/android-jetpack-compose-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/angular-novo-elements-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/angular-typescript-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/ascii-simulation-game-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/aspnet-abp-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/astro-typescript-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/chrome-extension-dev-js-typescript-cursorrules-pro/.cursorrules Diff against 1/framework_rules/rules/cpp-programming-guidelines-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/cursor-ai-react-typescript-shadcn-ui-cursorrules-p/.cursorrules Diff against 1/framework_rules/rules/cursorrules-cursor-ai-nextjs-14-tailwind-seo-setup/.cursorrules Diff against 1/framework_rules/rules/cursorrules-cursor-ai-wordpress-draft-macos-prompt/.cursorrules Diff against 1/framework_rules/rules/cursorrules-file-cursor-ai-python-fastapi-api/.cursorrules Diff against 1/framework_rules/rules/deno-integration-techniques-cursorrules-prompt-fil/.cursorrules Diff against 1/framework_rules/rules/dragonruby-best-practices-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/drupal-11-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/elixir-engineer-guidelines-cursorrules-prompt-file/.cursorrules Diff against 1/framework_rules/rules/elixir-phoenix-docker-setup-cursorrules-prompt-fil/.cursorrules

Similar configs

Same format, overlapping stack, ranked by quality.

Same format, overlapping stack, ranked by quality
RepositoryFormatStackCoversScoreChanged
SkeneTechnologies/skene-cookbook.cursorrules · 51.cursorrulespythoneslint+3setuptestlint-formatstyle+1196/1002 days ago
fall-out-bug/sdp_lab.cursorrules · 0.cursorrulesgodocker+3setupbuildtestlint-format+386/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/python-llm-ml-workflow-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionstestlint-formatstyletypes+480/1003 days ago
storybookjs/storybook.cursorrules · 91k.cursorrulestypescriptjavascript+6teststylearchdo-not+178/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/flutter-riverpod-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsstylearchdo-notagent-behaviour71/1003 days ago
forem/forem.cursorrules · 23k.cursorrulesrubyrails+9teststyletypesdatabase+471/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/angular-novo-elements-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionstestlint-formatstylearch+370/1003 days ago
paulpham157/paul-s-cursor-rules1/framework_rules/rules/nextjs-supabase-shadcn-pwa-cursorrules-prompt-file/.cursorrules · 28.cursorrulesgithub-actionsbuildstylearchdo-not70/1003 days ago
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack