Skip to content

Commit 66bb8b2

Browse files
committed
guidelines: standardise & improve guidelines
1 parent 0648e43 commit 66bb8b2

File tree

12 files changed

+152
-51
lines changed

12 files changed

+152
-51
lines changed

.ai/boost/core.blade.php

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,34 @@
1-
# URLs
2-
Whenever you create a URL use the `get-absolute-url` tool to ensure you're using the correct scheme, domain / IP, and port.
1+
## Boost
2+
- Boost MCP comes with powerful tools designed specifically for this application. Use them.
33

4-
# Artisan
5-
Use the `list-artisan-commands` tool when you need to call an artisan command to triple check the available parameters.
4+
## URLs
5+
- 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.
66

7-
# Tinker / Debugging
8-
You should use the `tinker` tool from Boost MCP when you need to run PHP to debug code or query Eloquent models directly.
7+
## Artisan
8+
- Use the `list-artisan-commands` tool when you need to call an artisan command to triple check the available parameters.
99

10-
Use the `database-query` tool when you only need to read from the database.
10+
## Tinker / Debugging
11+
- You should use the `tinker` tool from Boost MCP when you need to run PHP to debug code or query Eloquent models directly.
12+
- Use the `database-query` tool when you only need to read from the database.
1113

12-
# Reading browser logs
13-
Only recent browser logs will be useful, discard any that are older than two hours or so.
14+
@if(config('boost.browser_logs', true) !== false || config('boost.browser_logs_watcher', true) !== false)
15+
## Reading browser logs with the `browser-logs` tool
16+
- You can read browser logs, errors, and exceptions with the `browser-logs` tool from Boost.
17+
- Only recent browser logs will be useful, ignore old logs.
18+
@endif
1419

15-
# Searching documentation
16-
Check the docs before making code changes to ensure we are approaching this in the correct way. Use multiple simple topic based queries.
20+
## Searching documentation (critically important)
21+
- 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 docs on if you know you need docs for particular packages.
22+
- The 'search-docs' tool is perfect for all Laravel related packages. Laravel, Inertia, Pest, Livewire, Nova, Nightwatch, etc..
23+
- You must use this tool to search for Laravel-ecosystem docs before falling back to other approaches.
24+
- Search the docs before making code changes to ensure we are approaching this in the correct way.
25+
- Use multiple broad simple topic based queries to start, i.e. `rate limiting##routing rate limiting##routing`.
1726

18-
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 docs on if you know you need docs for particular packages.
19-
20-
The 'search-docs' tool is perfect for all Laravel related packages. Laravel, Inertia, Pest, Livewire, Nova, Nightwatch, and more.
21-
22-
You must use this tool to search for Laravel-ecosystem docs before falling back to other approaches.
23-
24-
## Available search syntax
25-
You can and should pass multiple queries at once, the most relevant will be returned first. Start specific, broaden after.
27+
### Available search syntax
28+
- You can and should pass multiple queries at once, the most relevant results will be returned first.
2629

2730
1. Simple Word Searches with auto-stemming - query=authentication - finds 'authenticate' and 'auth'
28-
2. Multiple Words (AND Logic) - query=rate limit - finds knowledge containing both "queue" AND "worker"
31+
2. Multiple Words (AND Logic) - query=rate limit - finds knowledge containing both "rate" AND "limit"
2932
3. Quoted Phrases (Exact Position) - query="infinite scroll - Words must be adjacent and in that order
3033
4. Mixed Queries - query=middleware "rate limit" - "middleware" AND exact phrase "rate limit"
3134
5. Multiple Queries - queries=["authentication", "middleware"] - ANY of these terms

.ai/enforce-tests.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
- Every change must be programmatically tested. Write a new test, or update an existing test, then run the tests to make sure they pass.
1+
- 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.
2+
- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test` with a specific filename or filter.

.ai/folio/core.blade.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
- `pages/auth/login.blade.php` → `/auth/login`
77
- List available Folio routes using `artisan folio:list` or using Boost's `list-routes` tool.
88

9-
### New pages & routes
9+
### Folio: New pages & routes
1010
- Always create new `folio` pages and routes using `artisan folio:page [name]` following existing naming conventions.
1111

1212
@verbatim
1313
<code-snippet name="Example folio:page commands for automatic routing" lang="shell">
14+
// Creates: resources/views/pages/products.blade.php → /products
1415
php artisan folio:page 'products'
15-
# Creates: resources/views/pages/products.blade.php → /products
1616

17+
18+
// Creates: resources/views/pages/products/[id].blade.php → /products/{id}
1719
php artisan folio:page 'products/[id]'
18-
# Creates: resources/views/pages/products/[id].blade.php → /products/{id}
1920
</code-snippet>
2021
@endverbatim
2122

@@ -29,7 +30,7 @@
2930
@endverbatim
3031

3132

32-
### Support & Docs
33+
### Folio: Support & Docs
3334
- Folio supports: middleware, serving pages from multiple paths, subdomain routing, named routes, nested routes, index routes, route parameters, and route model binding.
3435
- If available, use Boost's `search-docs` tool to use Folio to its full potential and help the user effectively.
3536

.ai/herd/core.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
- The site is made available by Herd, and will be available at: https?://[kebab-case-project-dir].test. Use the `get-absolute-url` tool to generate URLs.
1+
- The site is made available by Herd, and will be available at: https?://[kebab-case-project-dir].test. Use the `get-absolute-url` tool to generate URLs for the user to ensure user satisfaction and valid URLs.
22
- You must not run any commands to make the site available via HTTP(s). It is _always_ available through Herd.

.ai/inertia-laravel/core.blade.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
## Inertia Core
22

3-
- Inertia.js components should be placed in the `resources/js/Pages` directory.
3+
- Inertia.js components should be placed in the `resources/js/Pages` directory, unless specified differently in the JS bundler (ie. vite.config.js).
44
- Use `Inertia::render()` for server-side routing instead of traditional Blade views.
55
<code-snippet lang="php" name="Inertia::render example">
6-
// routes/web.php example
7-
Route::get('/users', function () {
6+
// routes/web.php example
7+
Route::get('/users', function () {
88
return Inertia::render('Users/Index', [
9-
'users' => User::all()
9+
'users' => User::all()
1010
]);
11-
});
11+
});
1212
</code-snippet>

.ai/laravel/10/core.blade.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
## Laravel 10 Core
1+
## Laravel 10
2+
- Use `search-docs` tool, if available, to get version specific documentation.
3+
4+
- Middleware typically lives in `app/Http/Middleware/` and service providers in `app/Providers/`.
5+
- There is no `bootstrap/app.php` application configuration in Laravel 10:
6+
- Middleware registration happens in `app/Http/Kernel.php`
7+
- Exception handling is in `app/Exceptions/Handler.php`
8+
- Console commands and schedule register in `app/Console/Kernel.php`
9+
- Rate limits likely exist in `RouteServiceProvider` or `app/Http/Kernel.php`
10+
- Model Casts: you must use `protected $casts = [];` not the `casts()` method. The `casts()` method isn't available on models in Laravel 10.

.ai/laravel/11/core.blade.php

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
1-
## Laravel 11 Core
1+
## Laravel 11
2+
- Use `search-docs` tool, if available, to get version specific documentation.
23

3-
- **No app\Console\Kernel.php** - use `bootstrap/app.php` for console configurations.
4+
@if (file_exists(base_path('app/Http/Kernel.php')))
5+
{{-- Migrated from L10 to L11, but did't migrate to the new L11 Structure --}}
6+
- This project upgraded from Laravel 10 without migrating to the new streamlined Laravel 11 file structure.
7+
- This is **perfectly fine** and recommended by Laravel. Follow the existing structure from Laravel 10. We do not to need migrate to the Laravel 11 structure unless the user explicitly requests that.
8+
9+
### Laravel 10 Structure
10+
- Middleware typically lives in `app/Http/Middleware/` and service providers in `app/Providers/`.
11+
- There is no `bootstrap/app.php` application configuration in a Laravel 10 structure:
12+
- Middleware registration happens in `app/Http/Kernel.php`
13+
- Exception handling is in `app/Exceptions/Handler.php`
14+
- Console commands and schedule register in `app/Console/Kernel.php`
15+
- Rate limits likely exist in `RouteServiceProvider` or `app/Http/Kernel.php`
16+
@else
17+
{{-- Laravel 11 project anew, or upgraded & migrated structure --}}
18+
- Laravel 11 brought a new streamlined file structure which this project uses.
19+
20+
### Laravel 11 Structure
21+
- No middleware files in `app/Http/Middleware/`.
22+
- `bootstrap/app.php` is the file to register middleware, exceptions, and routing files.
23+
- `bootstrap/providers.php` for project specific service providers.
24+
- **No app\Console\Kernel.php** - use `bootstrap/app.php` or `routes/console.php` for console configurations.
425
- **Commands auto-register** - files in `app/Console/Commands/` are automatically available.
26+
@endif
27+
28+
### Database
29+
- 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.
30+
- Laravel 11 allows limiting eagerly loaded records natively, without external packages: `$query->latest()->limit(10);`
31+
32+
### Models
33+
- Casts can/should be set in a `casts()` method on a model, rather than the `$casts` property. Follow existing conventions from other models.
34+
35+
### New artisan commands
36+
- List artisan commands using Boost's MCP tool, if available. New commands:
37+
- `php artisan make:enum`
38+
- `php artisan make:class`
39+
- `php artisan make:interface`

.ai/laravel/12/core.blade.php

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
1-
## Laravel 12 Core
1+
## Laravel 12
2+
- Use `search-docs` tool, if available, to get version specific documentation.
3+
4+
@if (file_exists(base_path('app/Http/Kernel.php')))
5+
{{-- Migrated from L10 to L12, but did't migrate to the new L11 Structure --}}
6+
- This project upgraded from Laravel 10 without migrating to the new streamlined Laravel file structure.
7+
- This is **perfectly fine** and recommended by Laravel. Follow the existing structure from Laravel 10. We do not to need migrate to the new Laravel structure unless the user explicitly requests that.
8+
9+
### Laravel 10 Structure
10+
- Middleware typically lives in `app/Http/Middleware/` and service providers in `app/Providers/`.
11+
- There is no `bootstrap/app.php` application configuration in a Laravel 10 structure:
12+
- Middleware registration happens in `app/Http/Kernel.php`
13+
- Exception handling is in `app/Exceptions/Handler.php`
14+
- Console commands and schedule register in `app/Console/Kernel.php`
15+
- Rate limits likely exist in `RouteServiceProvider` or `app/Http/Kernel.php`
16+
@else
17+
{{-- Laravel 12 project anew, or upgraded & migrated structure --}}
18+
- Laravel brought a new streamlined file structure which this project uses.
19+
20+
### Laravel file Structure
21+
- No middleware files in `app/Http/Middleware/`.
22+
- `bootstrap/app.php` is the file to register middleware, exceptions, and routing files.
23+
- `bootstrap/providers.php` for project specific service providers.
24+
- **No app\Console\Kernel.php** - use `bootstrap/app.php` or `routes/console.php` for console configurations.
25+
- **Commands auto-register** - files in `app/Console/Commands/` are automatically available.
26+
@endif
27+
28+
229

3-
- **No app\Console\Kernel.php** - use `bootstrap/app.php` for console configurations.
4-
- **Commands auto-register** - files in `app/Console/Commands/` are automatically available.

.ai/laravel/core.blade.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
## Do Things the Laravel Way
2-
- Use `./artisan make:` commands to create new files (i.e. migrations, controllers, models, etc.).
2+
- Use `./artisan make:` commands to create new files (i.e. migrations, controllers, models, etc.). You can list available artisan commands with the `list-artisan-commands` tool.
33
- If you're creating a generic PHP class, use `artisan make:class`.
44

55
## Database
66
- **Model relationships**: Always use proper Eloquent relationship methods with return type hints. Prefer relationship methods over raw queries or manual joins.
7-
- **Eloquent first approach**: Use Eloquent models and relationships before suggesting raw database queries - Avoid `DB::`; use `Model::query()` only. Generate code that leverages Laravel's ORM capabilities rather than bypassing them.
8-
- **Form request validation**: Always create Form Request classes for validation rather than inline validation in controllers. Include both validation rules and custom error messages.
7+
- **Eloquent first approach**: Use Eloquent models and relationships before suggesting raw database queries
8+
- Avoid `DB::`; prefer `Model::query()`. Generate code that leverages Laravel's ORM capabilities rather than bypassing them.
99
- **DB N+1**: Generate code that prevents N+1 query problems by using eager loading.
10-
- For DB pivot tables, use correct alphabetical order, like "project_role" instead of "role_project"
1110
- Use Laravel's query builder for very complex database operations.
1211

12+
## Controllers and validation
13+
- **Form request validation**: Always create Form Request classes for validation rather than inline validation in controllers. Include both validation rules and custom error messages.
14+
- **Validation rule style**: Check sibling form requests to see if the project uses array or string based validation rules.
15+
1316
## Model Creation
14-
- When creating new models, create factories and seeders for them too. Ask the user if they need any other things, use `list-artisan-commands` to check the available options to `./artisan make:model`
17+
- When creating new models, create useful factories and seeders for them too. Ask the user if they need any other things, use `list-artisan-commands` to check the available options to `./artisan make:model`
1518

1619
## APIs and Eloquent Resources
17-
- For APIs, use Eloquent API Resources and API versioning
20+
- For APIs, default to using Eloquent API Resources and API versioning, unless existing API routes do not, then you should follow existing convention.
1821

1922
## Queues
2023
- **Job and queue patterns**: Use queued jobs for time-consuming operations with the `ShouldQueue` interface.
@@ -27,9 +30,10 @@
2730

2831
## Testing
2932
- 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.
33+
- Faker: Use methods such as `$this->faker->word()` or `fake()->randomDigit()`. Follow existing conventions whether to use `$this->faker` or `fake()`.
3034

3135
## Vite Error
3236
- 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`.
3337

3438
## URL Generation
35-
- When generating links to other pages, always prefer named routes and the `route()` function.
39+
- When generating links to other pages, prefer named routes and the `route()` function.

.ai/pest/core.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
</code-snippet>
1515

1616
# Running Tests
17-
- Run the minimal number of tests, using an appropriate filter, before finalizing.
17+
- Run the minimal number of tests, using an appropriate filter, before finalizing code edits.
1818
- Run all tests: `php artisan test`.
1919
- Run all tests in a file: `php artisan test tests/Feature/ExampleTest.php`.
2020
- Filter on particular test name: `php artisan test --filter=testName` (recommended after making a change to a related file).
21-
- When the tests relating to your feature are passing, make sure to also run the entire test suite to ensure everything is still passing.
21+
- When the tests relating to your changes are passing, ask the user if they'd like to run the entire test suite to ensure everything is still passing.
2222

2323
## Pest Assertions
2424
- When asserting status codes on a response, use the specific method like `assertForbidden`, `assertNotFound` etc, instead of using `assertStatus(403)` or similar, e.g.:

0 commit comments

Comments
 (0)