npx agentspec-cli install 916d666e-7b57-409f-8d9c-74f46758b8fd --file-type cursorrules→ .cursor/rules/
# ShipKit Rules
You are an expert in TypeScript, Node.js, Next.js App Router, React, Shadcn UI, Radix UI and Tailwind.
This is a Next.js project using App Router, Shadcn/UI, Tailwind, Resend, Builder.io, Payload CMS 3, NextAuth/AuthJS@v5, TypeScript, using PNPM as the package manager.
Be aware of the latest versions of all libraries.
Your plans should be documented into a ai.mdx file. Check to see if it exists. If it does, pick up where you left off. Mark completed steps with a checkbox. Update the file as you work, so another AI can continue from where you left off.
## Key Principles
- 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, 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.
## Don't
Don't delete environment variables.
Don't nest server components in client components unless passed through props.
Don't forget to add `use client` to the top of the file if you are using client-side code like hooks.
Don't use `use client` in server components.
Don't fetch data with server actions. AGAIN, DO NOT FETCH DATA WITH SERVER ACTIONS.
## Comments
pre-emptively add comments to explain "why" behind the code.
do not modify comments or functionality unrelated to the prompt unless you have a very good reason.
You will preserve all existing comments unless specifically asked to modify them
When showing code changes, use comments like // ... to indicate unchanged sections of code
We like comments with callouts and examples, like:
```
/*
* Logging configuration
* @see https://nextjs.org/docs/app/api-reference/next-config-js/logging
*/
```
## File structure
Prefer `hyphen-case.ext` over `CamelCase.ext`.
Use `@/server/actions` for all server actions.
Use `@/server/services` for all internal services.
## Coding conventions
pre-emptively ask questions if you are unsure about the requirements.
pre-emptively optimize code for production.
pre-emptively add types to all functions and variables.
pre-emptively fix any typescript errors or warnings.
Use open-source libraries when they would enhance the user/developer experience.
Use best practices, write production-ready code.
Fix bugs and improve performance.
Comment any complex or hard-to-read code.
fix all typescript errors and warnings.
## React
Use functional components and hooks for state management.
Ensure components are reusable and maintainable.
Prefer server actions for internal API requests.
Maintain a separation of concerns between client and server components.
Prefer arrow functions for React components:
✅ export const Component = () => { ... }
❌ export function Component() { ... }
❌ export default function Component() { ... }
## Next.js
Don't use server actions to fetch data. Use Server Components instead.
Server code belongs in services, server action code belongs in actions if an action needs server-side code it should call services. So, a server component may load data using a service, then manipulate data using a server action, which then calls a service.
## When interacting with the database
1. Ensure all required fields are provided when interacting with the database.
2. Check for potential undefined values and handle them appropriately.
3. Use TypeScript's type system to enforce correct data structures.
4. Implement error handling for database operations and API requests.
5. Validate input data to prevent runtime errors and ensure data integrity.
6. Add comments to explain complex logic or important decisions in the code.
7. Regularly review and test code to catch and fix errors early.
8. Use the `db.transaction` method to ensure atomicity when performing multiple database operations.
9. don't use boolean values for anything, use dates instead. (e.g. isActive: boolean -> activeAt: Date)
## API Integration
- Use environment variables for sensitive data like API keys.
- Handle API errors gracefully and provide user feedback.
- Use async/await for asynchronous operations to improve readability.
- Document API interactions and expected responses.
## UI/UX Design
- Follow Tailwind CSS conventions for styling.
- Ensure responsive design for all components.
- Use Shadcn/UI components for consistency in UI elements.
- Prioritize accessibility in UI design.
## Performance Optimization
- Optimize images and assets for faster load times.
- Use lazy loading for components and images where applicable.
- Minimize the use of heavy libraries and dependencies.
- Regularly audit and improve performance metrics.
Typescript Nodejs Nextjs React Ui Css Cursorrules Rules
Cursor IDE rules and conventions for AI-assisted development.
by AgentHub Crawler
Chadnext Configuration
Windsurf IDE rules and conventions for AI-assisted development.
by AgentHub Crawler
Typescript Nodejs Nextjs App Cursorrules Prompt Fi Rules
Cursor IDE rules and conventions for AI-assisted development.
by AgentHub Crawler
Erxes Next Configuration
Windsurf IDE rules and conventions for AI-assisted development.
Sign in to leave a comment.
by AgentHub Crawler