Simple yet useful AI prompts for developers using React and Next.js

Simple yet useful AI prompts for developers using React and Next.js

Here are some of the most common and useful prompts I use with Cursor when working with apps built on React/Next.js. Although I use Cursor for my work, these prompts should work just fine with any AI-powered Code Editor or IDE.

I usually leave Cursor’s Agent mode with the model setting on Auto, but I felt like these prompts performed better with Sonnet 4.5 as the model, the few times I used it.

Now, on to the prompts.

Prompt #1: Fixing Build Errors.

The prompt:

Fix all build errors, ignore any warnings, and repeat this until a build is successful. Use: npm run build.

I used npm run build but you can write whichever one you use. Also, Cursor usually figures out which one to use.

This is a very simple prompt. However, this is probably my most used prompt. Every time i ask Cursor to write a feature or an entire application (mostly on top of starterkit template that i use to build my apps), most times, it uses things like any and other errors that you wouldn’t notice unless you run your build command because they don’t show up in your development server. It think this is a very common problem when you’re vibe coding.

It is really boring to try and fix them all by myself. So, once I’m satisfied with the state of the application’s working, I generally run this prompt and review the changes it made. It is just super convenient to do it like this.

Note: The auto mode does just fine for most cases, unless you one shotted a massive application and it’s not even running properly (in which case, I’d suggest using Sonnet 4.5 explicitly).

Prompt #2: Generating a PR message

The prompt:

Generate a technical and concise PR message for the last {x} commits.

Replace {x} with the number of commits you want to generate the PR message for.

I find this useful because sometimes I refer back to my pull requests to see what I did and how I did certain things in the past. Over time, I had multiple variations of this prompt before I finally arrived at this. I know it feels like I’m talking too much about a super tiny prompt like this but, believe me when I say it, I used use a prompt that was a bit more detailed than this, and the results were mostly jargon & often times over-estimated than what actually was there.

So, at least in my opinion, this yields a PR message that kinda does a fine job at recording all the changes that were made, described in good developer lingo.

Note: Only Sonnet 4.5 Thinking seems to be doing a good job with this prompt. The auto mode’s results are unpredictable and sometimes not very useful.

And… that’s it!

Yeah really. I just wanted to leave them here as my notes, and for anyone that comes across this. Figured I might as well hear some thoughts on this. You can reach out to me on X (CharanMNX) or on my LinkedIn profile. I’m happy to chat!

Happy Coding/Vibe-coding!