NestJS anti-hallucination Cursor rules
NestJS Anti-Hallucination Rules is a Cursor rule file that stops the assistant from generating NestJS code with imports, decorators, providers, modules or test setups that do not exist or are deprecated. It is for NestJS developers tired of fixing phantom packages and outdated patterns in AI suggestions.
What it does
The file says it overrides all other generation behavior and asks Cursor to check every generated line. It lists banned imports and phantom packages next to the correct import paths, then names deprecated patterns, such as getRepository() outside providers, @nestjs/bull where @nestjs/bullmq should be used, Express middleware mistakes and wrong decorator combinations.
How to use it
Its globs are **/*, so keeping it in your rules folder covers modules, services, controllers and spec files alike.
Requirements and limits
It corrects known mistakes; it is not a full NestJS style guide.
More in Rules and the Cursor library.
What it covers
- Banned Imports & Phantom Packages
- NEVER import these - they don't exist or are deprecated:
- Correct import paths:
- Deprecated Patterns - NEVER Generate These
- 1. getRepository outside providers
- 2. @nestjs/bull use @nestjs/bullmq
- 3. Express-specific middleware mistakes
- 4. Wrong decorator combinations
- 5. class-validator / class-transformer mistakes
- 6. Async module pitfalls
The full text is in the members library
Book a call and we will give you access to the full Cursor library: every entry in full, search by meaning, copy and download.
Source and license
Author: PatrickJS, Awesome cursorrules. License: CC0-1.0.