You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Laravel Boost guidelines are specifically curated by Laravel maintainers for this application. These guidelines should be followed closely to enhance the user's satisfaction building Laravel applications.
10
+
11
+
## Foundational Context
12
+
This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.
13
+
14
+
- php - 8.3.22
15
+
- inertiajs/inertia-laravel (INERTIA) - v2
16
+
- laravel/framework (LARAVEL) - v12
17
+
- laravel/octane (OCTANE) - v2
18
+
- laravel/prompts (PROMPTS) - v0
19
+
- laravel/scout (SCOUT) - v10
20
+
- tightenco/ziggy (ZIGGY) - v2
21
+
- laravel/pint (PINT) - v1
22
+
- @inertiajs/vue3 (INERTIA) - v1
23
+
- tailwindcss (TAILWINDCSS) - v3
24
+
- vue (VUE) - v3
25
+
26
+
27
+
## Conventions
28
+
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, naming.
29
+
- Use descriptive names for variables and methods. For example, `isRegisteredForDiscounts`, not `discount()`.
30
+
- Check for existing components to reuse before writing a new one.
31
+
32
+
## Verification Scripts
33
+
- Do not create verification scripts or tinker when tests cover that functionality and prove it works. Unit and feature tests are more important.
34
+
35
+
## Application Structure & Architecture
36
+
- Stick to existing directory structure - don't create new base folders without approval.
37
+
- Do not change the application's dependencies without approval.
38
+
39
+
## Frontend Bundling
40
+
- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `npm run build`, `npm run dev`, or `composer run dev`. Ask them.
41
+
42
+
## Replies
43
+
- Be concise in your explanations - focus on what's important rather than explaining obvious details.
44
+
45
+
## Documentation Files
46
+
- You must only create documentation files if explicitly requested by the user.
47
+
48
+
49
+
=== boost rules ===
50
+
51
+
## Laravel Boost
52
+
- Laravel Boost is an MCP server that comes with powerful tools designed specifically for this application. Use them.
53
+
54
+
## Artisan
55
+
- Use the `list-artisan-commands` tool when you need to call an Artisan command to double check the available parameters.
56
+
57
+
## URLs
58
+
- Whenever you share a project URL with the user you should use the `get-absolute-url` tool to ensure you're using the correct scheme, domain / IP, and port.
59
+
60
+
## Tinker / Debugging
61
+
- You should use the `tinker` tool when you need to execute PHP to debug code or query Eloquent models directly.
62
+
- Use the `database-query` tool when you only need to read from the database.
63
+
64
+
## Reading Browser Logs With the `browser-logs` Tool
65
+
- You can read browser logs, errors, and exceptions using the `browser-logs` tool from Boost.
66
+
- Only recent browser logs will be useful - ignore old logs.
67
+
68
+
## Searching Documentation (Critically Important)
69
+
- Boost comes with a powerful `search-docs` tool you should use before any other approaches. This tool automatically passes a list of installed packages and their versions to the remote Boost API, so it returns only version-specific documentation specific for the user's circumstance. You should pass an array of packages to filter on if you know you need docs for particular packages.
70
+
- The 'search-docs' tool is perfect for all Laravel related packages, including Laravel, Inertia, Livewire, Filament, Tailwind, Pest, Nova, Nightwatch, etc.
71
+
- You must use this tool to search for Laravel-ecosystem documentation before falling back to other approaches.
72
+
- Search the documentation before making code changes to ensure we are taking the correct approach.
73
+
- Use multiple, broad, simple, topic based queries to start. For example: `['rate limiting', 'routing rate limiting', 'routing']`.
74
+
- Do not add package names to queries - package information is already shared. For example, use `test resource table`, not `filament 4 test resource table`.
75
+
76
+
### Available Search Syntax
77
+
- You can and should pass multiple queries at once. The most relevant results will be returned first.
78
+
79
+
1. Simple Word Searches with auto-stemming - query=authentication - finds 'authenticate' and 'auth'
80
+
2. Multiple Words (AND Logic) - query=rate limit - finds knowledge containing both "rate" AND "limit"
81
+
3. Quoted Phrases (Exact Position) - query="infinite scroll" - Words must be adjacent and in that order
- Make use of all Inertia features from v1 & v2. Check the documentation before making any changes to ensure we are taking the correct approach.
140
+
141
+
### Inertia v2 New Features
142
+
- Polling
143
+
- Prefetching
144
+
- Deferred props
145
+
- Infinite scrolling using merging props and `WhenVisible`
146
+
- Lazy loading data on scroll
147
+
148
+
### Deferred Props & Empty States
149
+
- When using deferred props on the frontend, you should add a nice empty state with pulsing / animated skeleton.
150
+
151
+
152
+
=== laravel/core rules ===
153
+
154
+
## Do Things the Laravel Way
155
+
156
+
- Use `php artisan make:` commands to create new files (i.e. migrations, controllers, models, etc.). You can list available Artisan commands using the `list-artisan-commands` tool.
157
+
- If you're creating a generic PHP class, use `artisan make:class`.
158
+
- Pass `--no-interaction` to all Artisan commands to ensure they work without user input. You should also pass the correct `--options` to ensure correct behavior.
159
+
160
+
### Database
161
+
- Always use proper Eloquent relationship methods with return type hints. Prefer relationship methods over raw queries or manual joins.
162
+
- Use Eloquent models and relationships before suggesting raw database queries
163
+
- Avoid `DB::`; prefer `Model::query()`. Generate code that leverages Laravel's ORM capabilities rather than bypassing them.
164
+
- Generate code that prevents N+1 query problems by using eager loading.
165
+
- Use Laravel's query builder for very complex database operations.
166
+
167
+
### Model Creation
168
+
- When creating new models, create useful factories and seeders for them too. Ask the user if they need any other things, using `list-artisan-commands` to check the available options to `php artisan make:model`.
169
+
170
+
### APIs & Eloquent Resources
171
+
- For APIs, default to using Eloquent API Resources and API versioning unless existing API routes do not, then you should follow existing application convention.
172
+
173
+
### Controllers & Validation
174
+
- Always create Form Request classes for validation rather than inline validation in controllers. Include both validation rules and custom error messages.
175
+
- Check sibling Form Requests to see if the application uses array or string based validation rules.
176
+
177
+
### Queues
178
+
- Use queued jobs for time-consuming operations with the `ShouldQueue` interface.
179
+
180
+
### Authentication & Authorization
181
+
- Use Laravel's built-in authentication and authorization features (gates, policies, Sanctum, etc.).
182
+
183
+
### URL Generation
184
+
- When generating links to other pages, prefer named routes and the `route()` function.
185
+
186
+
### Configuration
187
+
- Use environment variables only in configuration files - never use the `env()` function directly outside of config files. Always use `config('app.name')`, not `env('APP_NAME')`.
188
+
189
+
### Testing
190
+
- When creating models for tests, use the factories for the models. Check if the factory has custom states that can be used before manually setting up the model.
191
+
- Faker: Use methods such as `$this->faker->word()` or `fake()->randomDigit()`. Follow existing conventions whether to use `$this->faker` or `fake()`.
192
+
- When creating tests, make use of `php artisan make:test [options] <name>` to create a feature test, and pass `--unit` to create a unit test. Most tests should be feature tests.
193
+
194
+
### Vite Error
195
+
- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `npm run build` or ask the user to run `npm run dev` or `composer run dev`.
196
+
197
+
198
+
=== laravel/v12 rules ===
199
+
200
+
## Laravel 12
201
+
202
+
- Use the `search-docs` tool to get version specific documentation.
203
+
- Since Laravel 11, Laravel has a new streamlined file structure which this project uses.
204
+
205
+
### Laravel 12 Structure
206
+
- No middleware files in `app/Http/Middleware/`.
207
+
- `bootstrap/app.php` is the file to register middleware, exceptions, and routing files.
208
+
- `bootstrap/providers.php` contains application specific service providers.
209
+
- **No app\Console\Kernel.php** - use `bootstrap/app.php` or `routes/console.php` for console configuration.
210
+
- **Commands auto-register** - files in `app/Console/Commands/` are automatically available and do not require manual registration.
211
+
212
+
### Database
213
+
- When modifying a column, the migration must include all of the attributes that were previously defined on the column. Otherwise, they will be dropped and lost.
214
+
- Laravel 11 allows limiting eagerly loaded records natively, without external packages: `$query->latest()->limit(10);`.
215
+
216
+
### Models
217
+
- Casts can and likely should be set in a `casts()` method on a model rather than the `$casts` property. Follow existing conventions from other models.
218
+
219
+
220
+
=== pint/core rules ===
221
+
222
+
## Laravel Pint Code Formatter
223
+
224
+
- You must run `vendor/bin/pint --dirty` before finalizing changes to ensure your code matches the project's expected style.
225
+
- Do not run `vendor/bin/pint --test`, simply run `vendor/bin/pint` to fix any formatting issues.
226
+
227
+
228
+
=== inertia-vue/core rules ===
229
+
230
+
## Inertia + Vue
231
+
232
+
- Vue components must have a single root element.
233
+
- Use `router.visit()` or `<Link>` for navigation instead of traditional links.
- Use Tailwind CSS classes to style HTML, check and use existing tailwind conventions within the project before writing your own.
283
+
- Offer to extract repeated patterns into components that match the project's conventions (i.e. Blade, JSX, Vue, etc..)
284
+
- Think through class placement, order, priority, and defaults - remove redundant classes, add classes to parent or child carefully to limit repetition, group elements logically
285
+
- You can use the `search-docs` tool to get exact examples from the official documentation when needed.
286
+
287
+
### Spacing
288
+
- When listing items, use gap utilities for spacing, don't use margins.
289
+
290
+
<code-snippet name="Valid Flex Gap Spacing Example" lang="html">
291
+
<div class="flex gap-8">
292
+
<div>Superior</div>
293
+
<div>Michigan</div>
294
+
<div>Erie</div>
295
+
</div>
296
+
</code-snippet>
297
+
298
+
299
+
### Dark Mode
300
+
- If existing pages and components support dark mode, new pages and components must support dark mode in a similar way, typically using `dark:`.
301
+
302
+
303
+
=== tailwindcss/v3 rules ===
304
+
305
+
## Tailwind 3
306
+
307
+
- Always use Tailwind CSS v3 - verify you're using only classes supported by this version.
308
+
309
+
310
+
=== tests rules ===
311
+
312
+
## Test Enforcement
313
+
314
+
- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
315
+
- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test` with a specific filename or filter.
0 commit comments