Claude Code Prompts for Laravel Projects

Copy-paste Claude Code prompts for Laravel 11 — Eloquent models, FormRequests, queued jobs, Pest tests, and Filament admin. Matches Laravel conventions out of the box.

💥 50p impulse-buy: Power Prompts PDF (first 10 buyers) 30 battle-tested Claude Code prompts · 8-page PDF · paste into CLAUDE.md and never re-type a prompt again · 50p impulse-buy, no commitment

Laravel's conventions are well-represented in Claude's training, but production Laravel apps have opinions: FormRequests vs validate(), Service classes, Filament resources, Octane workers. Tell Claude which patterns you use and the output drops in cleanly.

Prompt 1 — Add an Eloquent resource with policies

Add a 'Tickets' resource.

Schema:
- id (uuid, primary)
- user_id (foreign key, indexed)
- subject (string, 255, not null)
- body (text, not null)
- status (string, default 'open', indexed)
- priority (string, default 'normal')
- assigned_to (foreign key, nullable)
- timestamps + soft deletes

Constraints:
- Read app/Models/Order.php first as the template.
- Eloquent model with relationships: user(), assignee(), comments() — match Order's style.
- Migration uses Schema::create with the modern fluent syntax.
- FormRequests: StoreTicketRequest, UpdateTicketRequest — auth via gate, rules in array.
- Controller: TicketController extends Controller, uses route-model binding,
  authorize('view', $ticket) on show/update/destroy.
- Policy: TicketPolicy with view/update/delete returning Response::allow()/deny().
- Routes: Route::apiResource added to routes/api.php with auth:sanctum middleware.
- Factory + 1 happy-path Pest test for store/index.
- Do NOT run php artisan migrate.

Prompt 2 — Queued job with retry/backoff

Write a queued job ProcessTicketAttachmentJob that:
- Implements ShouldQueue, on the 'media' connection, queue 'attachments'
- Has $tries = 5 with backoff() returning [10, 60, 300, 900, 3600]
- Has $timeout = 120 and uniqueId() returning the attachment id (ShouldBeUnique)
- Uses Storage::disk('s3') to download, runs Image::make on it, uploads thumbnails
- On final failure: dispatches a TicketAttachmentFailed event and writes to
  the audit log (App\Services\AuditLogger)

Constraints:
- Use constructor property promotion (PHP 8.2 syntax).
- Type hints on everything.
- Spec via Pest with Queue::fake() and Storage::fake('s3') — assert the
  thumbnail variant was uploaded.

Prompt 3 — Add a Filament Resource for an existing model

Add a Filament v3 Resource for the existing Order model.

Constraints:
- Read app/Filament/Resources/CustomerResource.php first — match its column
  widths, filters, and table actions.
- Form: TextInput for order_number (disabled, displayed), Select for status
  (enum-backed), MoneyInput for total_cents.
- Table: order_number, customer.name (Tables\Columns\TextColumn with searchable),
  status (badge with colour per enum), total (money), created_at (since).
- Filter: status filter, date range filter on created_at.
- Actions: ViewAction, EditAction. No DeleteAction (we soft-delete from a job).
- Relation manager for OrderItems showing item_name, quantity, line_total.
- Place at app/Filament/Resources/OrderResource.php with the Pages subdirectory.

CLAUDE.md anchor block for Laravel

## Stack
Laravel 11, PHP 8.3, Octane (Swoole), Filament 3, Pest 2 for tests, Sanctum for auth.

## Conventions
- FormRequests for all writes; never validate() in the controller.
- Policies for authorisation; always authorize() in controllers.
- No business logic in models. Use Services in app/Services.
- Money stored as integer cents; never float.
- Filament resources are the admin UI; don't build custom Blade admin pages.

Related: Claude API from PHP, testing prompts.

Frequently asked questions

Does Claude know Laravel 11 (no Kernel.php, streamlined bootstrap)?
Yes — Claude knows the Laravel 11 structure (bootstrap/app.php, no app/Console/Kernel.php). If your project is still on 10.x, say so in CLAUDE.md to avoid mixed structures.
Pest or PHPUnit?
Claude picks whichever pattern it sees in your tests/ directory. To force one, write `Tests use Pest, never PHPUnit class-based syntax` in CLAUDE.md.
Will Claude use Filament for admin screens?
Only if you say so. Add `Admin screens are Filament v3 resources under app/Filament/Resources` and Claude will generate Resources, RelationManagers, and Pages in that pattern.

Free tools

Cost Calculator → API Cookbook → Diff Summarizer → Skills Browser →

More examples

Claude API Python QuickstartClaude API Node.js / TypeScript QuickstartClaude API Streaming in PythonClaude API Streaming in Node.js / TypeScriptClaude API Tool Use in PythonClaude API Tool Use in Node.js / TypeScript