Cheat Sheet for Code Generation with Cursor AI
๐ง Cursor AI Prompt Cheat Sheetโ
๐ Generate MVP Appโ
- Generate a Next.js 14 app with TypeScript, Tailwind, and a login page.
- Create a SaaS dashboard layout with sidebar and top nav using ShadCN.
- Scaffold a CRUD interface for managing courses using Prisma and React.
โจ Refactor Codeโ
- Refactor this component to use custom hooks and make it cleaner.
- Split this file into smaller reusable components.
- Refactor this API route using async/await and proper error handling.
๐ ๏ธ Fix Bugs / Debugโ
- Why is this useEffect running infinitely?
- Fix this TypeScript error and explain why it happened.
- Debug this form validation issue.
๐งฑ Generate Components/UIโ
- Create a reusable modal component with open/close logic.
- Generate a responsive card layout using Tailwind.
- Build a date picker with disabled past dates.
๐ง Understand / Learn Codeโ
- Explain what this Zustand store does.
- Describe how this middleware handles authentication.
- What is the purpose of this Prisma query?
๐ Generate Documentationโ
- Generate a README.md for this project.
- Add JSDoc comments to these functions.
- Document this API endpoint using OpenAPI format.
๐ Auth & Role Managementโ
- Add Firebase Auth with email/password and role-based access.
- Protect this API route so only admins can access it.
๐ฆ Backend / Databaseโ
- Create Prisma models for students, tutors, and classes.
- Generate API routes for CRUD operations on courses.
- Write a seed script for this database.
๐งช Testingโ
- Write a unit test for this function using Vitest.
- Generate integration tests for this login flow.
- Test this API route for error and success cases.
๐ Optimization & Cleanupโ
- Optimize this loop for performance.
- Clean up unused imports and variables.
- Convert this component to a server component (Next.js 14).