Skip to content

Commit a6e6a44

Browse files
authored
Merge pull request #1212 from NFDI4Chem/development
Development
2 parents 74df02f + a48d4ee commit a6e6a44

30 files changed

Lines changed: 2873 additions & 701 deletions

.cursor/mcp.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"mcpServers": {
3+
"laravel-boost": {
4+
"command": "php",
5+
"args": [
6+
"./artisan",
7+
"boost:mcp"
8+
]
9+
}
10+
}
11+
}

.cursor/rules/laravel-boost.mdc

Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,316 @@
1+
---
2+
alwaysApply: true
3+
---
4+
<laravel-boost-guidelines>
5+
=== foundation rules ===
6+
7+
# Laravel Boost Guidelines
8+
9+
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
82+
4. Mixed Queries - query=middleware "rate limit" - "middleware" AND exact phrase "rate limit"
83+
5. Multiple Queries - queries=["authentication", "middleware"] - ANY of these terms
84+
85+
86+
=== php rules ===
87+
88+
## PHP
89+
90+
- Always use curly braces for control structures, even if it has one line.
91+
92+
### Constructors
93+
- Use PHP 8 constructor property promotion in `__construct()`.
94+
- <code-snippet>public function __construct(public GitHub $github) { }</code-snippet>
95+
- Do not allow empty `__construct()` methods with zero parameters.
96+
97+
### Type Declarations
98+
- Always use explicit return type declarations for methods and functions.
99+
- Use appropriate PHP type hints for method parameters.
100+
101+
<code-snippet name="Explicit Return Types and Method Params" lang="php">
102+
protected function isAccessible(User $user, ?string $path = null): bool
103+
{
104+
...
105+
}
106+
</code-snippet>
107+
108+
## Comments
109+
- Prefer PHPDoc blocks over comments. Never use comments within the code itself unless there is something _very_ complex going on.
110+
111+
## PHPDoc Blocks
112+
- Add useful array shape type definitions for arrays when appropriate.
113+
114+
## Enums
115+
- Typically, keys in an Enum should be TitleCase. For example: `FavoritePerson`, `BestLake`, `Monthly`.
116+
117+
118+
=== inertia-laravel/core rules ===
119+
120+
## Inertia Core
121+
122+
- Inertia.js components should be placed in the `resources/js/Pages` directory unless specified differently in the JS bundler (vite.config.js).
123+
- Use `Inertia::render()` for server-side routing instead of traditional Blade views.
124+
125+
<code-snippet lang="php" name="Inertia::render Example">
126+
// routes/web.php example
127+
Route::get('/users', function () {
128+
return Inertia::render('Users/Index', [
129+
'users' => User::all()
130+
]);
131+
});
132+
</code-snippet>
133+
134+
135+
=== inertia-laravel/v2 rules ===
136+
137+
## Inertia v2
138+
139+
- 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.
234+
235+
<code-snippet lang="vue" name="Inertia Client Navigation">
236+
import { Link } from '@inertiajs/vue3'
237+
238+
<Link href="/">Home</Link>
239+
</code-snippet>
240+
241+
- For form handling, use `router.post` and related methods. Do not use regular forms.
242+
243+
244+
<code-snippet lang="vue" name="Inertia Vue Form Example">
245+
<script setup>
246+
import { reactive } from 'vue'
247+
import { router } from '@inertiajs/vue3'
248+
import { usePage } from '@inertiajs/vue3'
249+
250+
const page = usePage()
251+
252+
const form = reactive({
253+
first_name: null,
254+
last_name: null,
255+
email: null,
256+
})
257+
258+
function submit() {
259+
router.post('/users', form)
260+
}
261+
</script>
262+
263+
<template>
264+
<h1>Create {{ page.modelName }}</h1>
265+
<form @submit.prevent="submit">
266+
<label for="first_name">First name:</label>
267+
<input id="first_name" v-model="form.first_name" />
268+
<label for="last_name">Last name:</label>
269+
<input id="last_name" v-model="form.last_name" />
270+
<label for="email">Email:</label>
271+
<input id="email" v-model="form.email" />
272+
<button type="submit">Submit</button>
273+
</form>
274+
</template>
275+
</code-snippet>
276+
277+
278+
=== tailwindcss/core rules ===
279+
280+
## Tailwind Core
281+
282+
- 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.
316+
</laravel-boost-guidelines>

0 commit comments

Comments
 (0)