muuucho's avatar

Cursor can't follow given instructions

I told Cursor AI to copy a Livewire Crud that I made, named Pubs and create Cars, Pets, you name it. I am very clear that I want it to use the exactly same blade components as in Users:

New CRUD

  • I have created a Livewire CRUD named Pubs to show you the layout and components I like you to use when I ask you to create a new Crud.
  • Note that the table Pubs is searchable, filterable, paginated and uses flux free components, blade components, Sweet Alert 2, Tom Select and Font Awesome.
  • ALWAYS use existing button components from resources/views/components/button/ instead of creating custom buttons or using Alpine.js for interactions.
  • ALWAYS use LivewireAlert with toast configuration ('position' => 'top-end', 'timer' => 3000, 'toast' => true) for success messages, exactly like in Pubs.

But Cursor keeps failing, it skips the component and uses their own inline stuff over and over again. I have to correct almost every single line of code. Isn't that very surprising? Not a even a button looks the same as in my sample code.

Conclusion: Cursor don't like instructions.

I just wanted to cry out to you real humans. Thanks.

1 like
3 replies
LaryAI's avatar
Level 58

It’s definitely frustrating when AI tools don’t follow your framework conventions or replicate code with your exact component structure. Tools like Cursor can generate generic code fast, but they often need careful guidance and sometimes still ignore architectural/organizational details—especially when it comes to custom Blade and UI component use.

Here's how you can get closer to “copy exact” results:

1. Provide Sample Files Explicitly

AI tools need clear references. Rather than telling it to “do like Users,” try pasting or linking to the relevant parts:

  • The Pubs Livewire component class
  • The Pubs Blade view, especially the table and button code
  • The button Blade components (resources/views/components/button/)
  • Example use of LivewireAlert

For example:

Please generate a Livewire CRUD for `Cars`. Use exactly the same structure as below for the table and actions. 
Table extract from `Pubs`:
<x-table>
    <x-slot name="head">
        <x-table.heading sortable>...</x-table.heading>
        <x-table.heading>Actions</x-table.heading>
    </x-slot>
    <x-slot name="body">
        @foreach ($pubs as $pub)
            <x-table.row>
                ...
                <x-table.cell>
                    <x-button.edit wire:click="edit({{ $pub->id }})" />
                    <x-button.delete wire:click="delete({{ $pub->id }})" />
                </x-table.cell>
            </x-table.row>
        @endforeach
    </x-slot>
</x-table>

Be explicit: “DO NOT create buttons inline, use the above Blade components like x-button.edit etc.”

2. Demand Rewrites For Non-Conformant Output

If Cursor produces inline or custom HTML, ask:

  • “Rewrite using only Blade buttons from resources/views/components/button/ for all actions.”

3. SweetAlert and LivewireAlert

Again, show how you trigger success:

$this->emit('alert', [
    'type' => 'success',
    'message' => 'Car added successfully.',
    'position' => 'top-end',
    'timer' => 3000,
    'toast' => true,
]);

Then: “Always use this alert pattern from now on.”

4. Prepare a Skeleton File for Cursor to Fill

Instead of asking for a whole new file, paste a copy of your Pubs CRUD and say,
“Rename model and properties for ‘Cars’ (or Pets), but keep all structure and component usage identically.”

5. Manual Tweaks are (For Now) Unavoidable

AI helpers save time, but they rarely output code in your exact Blade/Livewire flavor without heavy prompting and refactoring, especially if your stack uses a lot of componentization.


Summary:
You’re not alone! Even with the best prompts, custom Blade components and strict UI frameworks outpace AI’s “generic Laravel” code. The best approach is to give very concrete code samples, demand compliance, and never hesitate to ask for partial rewrites (“fix the action buttons to use x-button.edit only”). For now—some tweaking is inevitable, but you can minimize it by supplying as much literal example code as possible.

Let me know if you want a simple template to copy from for future CRUDs!

vincent15000's avatar

Is it your prompt ?

If yes, I recommend you to improve it, it's not optimized.

For example : note that the table pubs is searchable, filterable, ... is not the right way to tell an AI what you need.

FeatureCreepKing's avatar

Have you tried Boost? I've been looking at 'vibe' coding recently and found Laravel Boost makes a good difference with the quality of my code, though I use Claude mainly.

1 like

Please or to participate in this conversation.