Member-only story
My Laravel 12 Project Rule to Stop Hallucinations in Cursor (Inertia + React)
Stop the hallucinations and get the most out of Laravel 12 from Cursor
Why Make a Laravel Project Rule?
Without a Cursor rule tailored for my Laravel projects, I often found myself battling the agent to prevent it from adding deprecated Laravel features. This is especially painful if you are using Inertia with React, as the agent would tend to forget we were in a Laravel project and begin treating it like a Next.js or Node project. Since the Laravel 12 release is so new, it would seem LLMs may not have much information about it and struggle to understand the connection between Laravel 12, Inertia, and React.
Below is my list of common paint points that led me to create my own Laravel 12 project rule. I’d love to hear from you in the comments if you faced similar issues.
- Cursor often doesn’t utilize Inertia w/ React, ignoring useful Inertia features in
.tsx
files like the<Link>
element or Inertia forms. - Cursor often forgets that
api.php
is an opt-in feature since Laravel 11, and often ignoresweb.php
as a result, preferring to create theapi.php
file instead. - Cursor ignores AppServiceProvider and makes new service providers fairly haphazardly.