DEV Community

mohamedp09
mohamedp09

Posted on

The .cursorrules file I wish I had when building my SaaS

I've been using Cursor to build a Node.js + TypeScript SaaS,
and it's genuinely impressive — until it isn't.

The frustrations were always the same:

  • Silent catch blocks with no logging
  • any types slipping through everywhere
  • Inconsistent API responses (sometimes data, sometimes result)
  • Prisma queries without proper error handling
  • Hardcoded secrets instead of environment variables

I kept correcting the same mistakes over and over.
So I did what any developer would do — I wrote rules.

What is .cursorrules?

A .cursorrules file sits in your project root and tells
Cursor how to behave in YOUR codebase. Think of it as a
style guide that the AI actually reads and follows.

The difference is dramatic.

Without rules:


typescript
// Cursor generates this
try {
  const user = await db.user.findFirst({ where: { id } });
  return user;
} catch (e) {
  // silent catch — the bug graveyard
}
👉 Available here: https://mohamedp2.gumroad.com/l/ruxmq
Drop it in your project root and Cursor starts following
your conventions immediately. No npm install, no config —
just copy the file.
What rules do you have in your .cursorrules?
Would love to see what others are doing.
Enter fullscreen mode Exit fullscreen mode

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.