Cursor rule
.cursor/rules/laravel-boost.mdcCursor rules
Quality
90/100
Scores the file, not the repository.Length
2,068 words
44 headings · 0 code blocksRepository
17k
— · pushed 3 days agoLast changed
3 days ago
First indexed 3 days ago.1234<laravel-boost-guidelines>5=== foundation rules ===67# Laravel Boost Guidelines89The 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.1011## Foundational Context12This 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.1314- php - 8.4.2015- laravel/framework (LARAVEL) - v1216- laravel/nightwatch (NIGHTWATCH) - v117- laravel/prompts (PROMPTS) - v018- laravel/sanctum (SANCTUM) - v419- laravel/scout (SCOUT) - v1020- laravel/socialite (SOCIALITE) - v521- larastan/larastan (LARASTAN) - v322- laravel/mcp (MCP) - v023- phpunit/phpunit (PHPUNIT) - v1124- vue (VUE) - v325- laravel-echo (ECHO) - v226- tailwindcss (TAILWINDCSS) - v42728## Conventions29- 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, and naming.30- Use descriptive names for variables and methods. For example, `isRegisteredForDiscounts`, not `discount()`.31- Check for existing components to reuse before writing a new one.3233## Verification Scripts34- Do not create verification scripts or tinker when tests cover that functionality and prove it works. Unit and feature tests are more important.3536## Application Structure & Architecture37- Stick to existing directory structure; don't create new base folders without approval.38- Do not change the application's dependencies without approval.3940## Frontend Bundling41- If the user doesn't see a frontend change reflected in the UI, it could mean they need to run `pnpm run build`, `pnpm run dev`, or `composer run dev`. Ask them.4243## Replies44- Be concise in your explanations - focus on what's important rather than explaining obvious details.4546## Documentation Files47- You must only create documentation files if explicitly requested by the user.4849=== boost rules ===5051## Laravel Boost52- Laravel Boost is an MCP server that comes with powerful tools designed specifically for this application. Use them.5354## Artisan55- Use the `list-artisan-commands` tool when you need to call an Artisan command to double-check the available parameters.5657## URLs58- 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.5960## Tinker / Debugging61- 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.6364## Reading Browser Logs With the `browser-logs` Tool65- 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.6768## Searching Documentation (Critically Important)69- Boost comes with a powerful `search-docs` tool you should use before any other approaches when dealing with Laravel or Laravel ecosystem packages. This tool automatically passes a list of installed packages and their versions to the remote Boost API, so it returns only version-specific documentation 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`.7576### Available Search Syntax77- You can and should pass multiple queries at once. The most relevant results will be returned first.78791. Simple Word Searches with auto-stemming - query=authentication - finds 'authenticate' and 'auth'.802. Multiple Words (AND Logic) - query=rate limit - finds knowledge containing both "rate" AND "limit".813. Quoted Phrases (Exact Position) - query="infinite scroll" - words must be adjacent and in that order.824. Mixed Queries - query=middleware "rate limit" - "middleware" AND exact phrase "rate limit".835. Multiple Queries - queries=["authentication", "middleware"] - ANY of these terms.8485=== php rules ===8687## PHP8889- Always use curly braces for control structures, even if it has one line.9091### Constructors92- Use PHP 8 constructor property promotion in `__construct()`.93 - <code-snippet>public function __construct(public GitHub $github) { }</code-snippet>94- Do not allow empty `__construct()` methods with zero parameters unless the constructor is private.9596### Type Declarations97- Always use explicit return type declarations for methods and functions.98- Use appropriate PHP type hints for method parameters.99100<code-snippet name="Explicit Return Types and Method Params" lang="php">101protected function isAccessible(User $user, ?string $path = null): bool102{103 ...104}105</code-snippet>106107## Comments108- Prefer PHPDoc blocks over inline comments. Never use comments within the code itself unless there is something very complex going on.109110## PHPDoc Blocks111- Add useful array shape type definitions for arrays when appropriate.112113## Enums114- Typically, keys in an Enum should be TitleCase. For example: `FavoritePerson`, `BestLake`, `Monthly`.115116=== tests rules ===117118## Test Enforcement119120- 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.121- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test --compact` with a specific filename or filter.122123=== laravel/core rules ===124125## Do Things the Laravel Way126127- 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.128- If you're creating a generic PHP class, use `php artisan make:class`.129- 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.130131### Database132- Always use proper Eloquent relationship methods with return type hints. Prefer relationship methods over raw queries or manual joins.133- Use Eloquent models and relationships before suggesting raw database queries.134- Avoid `DB::`; prefer `Model::query()`. Generate code that leverages Laravel's ORM capabilities rather than bypassing them.135- Generate code that prevents N+1 query problems by using eager loading.136- Use Laravel's query builder for very complex database operations.137138### Model Creation139- 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`.140141### APIs & Eloquent Resources142- For APIs, default to using Eloquent API Resources and API versioning unless existing API routes do not, then you should follow existing application convention.143144### Controllers & Validation145- Always create Form Request classes for validation rather than inline validation in controllers. Include both validation rules and custom error messages.146- Check sibling Form Requests to see if the application uses array or string based validation rules.147148### Queues149- Use queued jobs for time-consuming operations with the `ShouldQueue` interface.150151### Authentication & Authorization152- Use Laravel's built-in authentication and authorization features (gates, policies, Sanctum, etc.).153154### URL Generation155- When generating links to other pages, prefer named routes and the `route()` function.156157### Configuration158- 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')`.159160### Testing161- 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.162- Faker: Use methods such as `$this->faker->word()` or `fake()->randomDigit()`. Follow existing conventions whether to use `$this->faker` or `fake()`.163- 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.164165### Vite Error166- If you receive an "Illuminate\Foundation\ViteException: Unable to locate file in Vite manifest" error, you can run `pnpm run build` or ask the user to run `pnpm run dev` or `composer run dev`.167168=== laravel/v12 rules ===169170## Laravel 12171172- Use the `search-docs` tool to get version-specific documentation.173- Since Laravel 11, Laravel has a new streamlined file structure which this project uses.174175### Laravel 12 Structure176- In Laravel 12, middleware are no longer registered in `app/Http/Kernel.php`.177- Middleware are configured declaratively in `bootstrap/app.php` using `Application::configure()->withMiddleware()`.178- `bootstrap/app.php` is the file to register middleware, exceptions, and routing files.179- `bootstrap/providers.php` contains application specific service providers.180- The `app\Console\Kernel.php` file no longer exists; use `bootstrap/app.php` or `routes/console.php` for console configuration.181- Console commands in `app/Console/Commands/` are automatically available and do not require manual registration.182183### Database184- 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.185- Laravel 12 allows limiting eagerly loaded records natively, without external packages: `$query->latest()->limit(10);`.186187### Models188- 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.189190=== phpunit/core rules ===191192## PHPUnit193194- This application uses PHPUnit for testing. All tests must be written as PHPUnit classes. Use `php artisan make:test --phpunit {name}` to create a new test.195- If you see a test using "Pest", convert it to PHPUnit.196- Every time a test has been updated, run that singular test.197- When the tests relating to your feature are passing, ask the user if they would like to also run the entire test suite to make sure everything is still passing.198- Tests should test all of the happy paths, failure paths, and weird paths.199- You must not remove any tests or test files from the tests directory without approval. These are not temporary or helper files; these are core to the application.200201### Running Tests202- Run the minimal number of tests, using an appropriate filter, before finalizing.203- To run all tests: `php artisan test --compact`.204- To run all tests in a file: `php artisan test --compact tests/Feature/ExampleTest.php`.205- To filter on a particular test name: `php artisan test --compact --filter=testName` (recommended after making a change to a related file).206207=== tailwindcss/core rules ===208209## Tailwind CSS210211- Use Tailwind CSS classes to style HTML; check and use existing Tailwind conventions within the project before writing your own.212- Offer to extract repeated patterns into components that match the project's conventions (i.e. Blade, JSX, Vue, etc.).213- Think through class placement, order, priority, and defaults. Remove redundant classes, add classes to parent or child carefully to limit repetition, and group elements logically.214- You can use the `search-docs` tool to get exact examples from the official documentation when needed.215216### Spacing217- When listing items, use gap utilities for spacing; don't use margins.218219<code-snippet name="Valid Flex Gap Spacing Example" lang="html">220 <div class="flex gap-8">221 <div>Superior</div>222 <div>Michigan</div>223 <div>Erie</div>224 </div>225</code-snippet>226227### Dark Mode228- If existing pages and components support dark mode, new pages and components must support dark mode in a similar way, typically using `dark:`.229230=== tailwindcss/v4 rules ===231232## Tailwind CSS 4233234- Always use Tailwind CSS v4; do not use the deprecated utilities.235- `corePlugins` is not supported in Tailwind v4.236- In Tailwind v4, configuration is CSS-first using the `@theme` directive — no separate `tailwind.config.js` file is needed.237238<code-snippet name="Extending Theme in CSS" lang="css">239@theme {240 --color-brand: oklch(0.72 0.11 178);241}242</code-snippet>243244- In Tailwind v4, you import Tailwind using a regular CSS `@import` statement, not using the `@tailwind` directives used in v3:245246<code-snippet name="Tailwind v4 Import Tailwind Diff" lang="diff">247 - @tailwind base;248 - @tailwind components;249 - @tailwind utilities;250 + @import "tailwindcss";251</code-snippet>252253### Replaced Utilities254- Tailwind v4 removed deprecated utilities. Do not use the deprecated option; use the replacement.255- Opacity values are still numeric.256257| Deprecated | Replacement |258|------------+--------------|259| bg-opacity-* | bg-black/* |260| text-opacity-* | text-black/* |261| border-opacity-* | border-black/* |262| divide-opacity-* | divide-black/* |263| ring-opacity-* | ring-black/* |264| placeholder-opacity-* | placeholder-black/* |265| flex-shrink-* | shrink-* |266| flex-grow-* | grow-* |267| overflow-ellipsis | text-ellipsis |268| decoration-slice | box-decoration-slice |269| decoration-clone | box-decoration-clone |270</laravel-boost-guidelines>271
Also in koel/koel
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| nerds-odd-e/doughnut.cursor/rules/cli.mdc · 49 | Cursor rules | setupbuildteststyle+4 | 96/100 | 3 days ago | |
| coollabsio/coolify.cursor/rules/coolify-ai-docs.mdc · 60k | Cursor rules | buildteststylearch+5 | 92/100 | 3 days ago | |
| groupultra/telegram-search.cursor/rules/architecture.mdc · 4.0k | Cursor rules | buildtestlint-formatarch+4 | 89/100 | 3 days ago | |
| nerds-odd-e/doughnut.cursor/rules/frontend-testing.mdc · 49 | Cursor rules | buildteststyletesting-strategy+2 | 89/100 | 3 days ago | |
| nerds-odd-e/doughnut.cursor/rules/linting_formating.mdc · 49 | Cursor rules | testlint-formatstylearch+6 | 88/100 | 3 days ago | |
| nerds-odd-e/doughnut.cursor/rules/mcp-server.mdc · 49 | Cursor rules | buildtestlint-formatarch+2 | 85/100 | 3 days ago | |
| nerds-odd-e/doughnut.cursor/rules/e2e-authoring.mdc · 49 | Cursor rules | setupteststylearch+3 | 80/100 | 3 days ago | |
| xuliang2024/cutcli-cookbook.cursor/rules/commands.mdc · 66 | Cursor rules | lint-formatgitsecuritydeployment+1 | 78/100 | 3 days ago |
