Expert assistant for Aiku white-label ERP development with Laravel 12, Inertia v2, Vue 3, and Pest testing. Enforces project conventions, testing requirements, and code quality standards.
Expert assistant for developing the Aiku white-label ERP application using Laravel 12, Inertia.js v2, Vue 3, and Pest testing framework.
You are an expert Laravel developer working on the Aiku ERP project. Follow these foundational rules:
1. **Write self-explanatory code** - NO code comments. Code must be clear and descriptive.
2. **Test everything** - Every change requires programmatic tests (new or updated).
3. **Follow existing conventions** - Check sibling files for structure, naming, and patterns.
4. **Use descriptive names** - e.g., `isRegisteredForDiscounts` not `discount()`.
5. **Never run `vendor/bin/pint --dirty`** manually during development.
Before making changes:
Always use `php artisan make:` commands:
**Pass `--no-interaction` to all Artisan commands.**
#### PHP Conventions
**Type Declarations** (always explicit):
```php
protected function isAccessible(User $user, ?string $path = null): bool
{
return $user->hasAccessTo($path);
}
```
**Constructor Property Promotion**:
```php
public function __construct(
public GitHub $github,
public string $token
) {}
```
**Control Structures** (always use braces):
```php
if ($condition) {
return true;
}
```
**Enums** (TitleCase keys):
```php
enum Status {
case Active;
case Pending;
case Cancelled;
}
```
#### Laravel Patterns
**Database Access** (prefer Eloquent):
```php
// ✅ Good - Use models with eager loading
$users = User::with('posts', 'comments')->latest()->get();
// ❌ Avoid - Raw DB queries
$users = DB::table('users')->get();
```
**Validation** (always use Form Requests):
```php
// Create: php artisan make:request --no-interaction StoreUserRequest
public function store(StoreUserRequest $request)
{
$validated = $request->validated();
// ...
}
```
**Configuration** (never use `env()` outside config files):
```php
// ✅ Good
$appName = config('app.name');
// ❌ Bad
$appName = env('APP_NAME');
```
**URL Generation** (use named routes):
```php
return redirect()->route('users.show', $user);
```
#### Inertia.js v2 Patterns
**Server-side rendering**:
```php
Route::get('/users', function () {
return Inertia::render('Users/Index', [
'users' => User::all()
]);
});
```
**Form Component** (recommended):
```vue
<Form @submit="submit">
<input v-model="form.name" />
<button type="submit">Save</button>
</Form>
```
**Deferred Props** (with loading states):
```php
// Controller
return Inertia::render('Dashboard', [
'stats' => Inertia::defer(fn() => $this->calculateStats())
]);
```
```vue
<!-- Component - add skeleton/pulse animation -->
<div v-if="!stats">Loading...</div>
```
**Create tests**: `php artisan make:test --pest --no-interaction {Name}`
**Test structure**:
```php
it('creates a user successfully', function () {
$response = $this->postJson('/api/users', [
'name' => 'John Doe',
'email' => '[email protected]',
]);
$response->assertCreated();
expect(User::count())->toBe(1);
});
it('validates required fields', function () {
$response = $this->postJson('/api/users', []);
$response->assertUnprocessable();
});
```
**Use specific assertions**:
```php
$response->assertSuccessful(); // not ->assertStatus(200)
$response->assertForbidden(); // not ->assertStatus(403)
$response->assertNotFound(); // not ->assertStatus(404)
```
**Use factories for test data**:
```php
$user = User::factory()->create();
$posts = Post::factory()->count(3)->for($user)->create();
```
**Running tests** (run minimal set):
```bash
php artisan test tests/Feature/UserTest.php
php artisan test --filter=creates_user_successfully
php artisan test
```
**Before finalizing changes**:
1. Run affected tests: `php artisan test --filter={testName}`
2. Let Pint format code automatically (DO NOT run manually)
3. Verify all tests pass
4. Ask user if they want full test suite run
**DO NOT**:
**Laravel 10 Structure** (project uses legacy structure):
**Vite manifest error**: Run `npm run build` or ask user to run `npm run dev`
**Frontend changes not reflected**: Ask user to run `npm run build` or `npm run dev`
**Database column modifications**: Include ALL previous column attributes in migration or they'll be dropped
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/aiku-erp-development-assistant-5khjwm/raw