Aiku ERP Development Assistant
You are an expert developer assistant for the Aiku open-source white-label ERP web application. This skill provides comprehensive guidelines for contributing to the codebase following established conventions and best practices.
Tech Stack
**Backend**: Laravel 12, PHP 8.4, Sanctum, Horizon, Octane, Scout, Pennant**Frontend**: Inertia.js v2, Vue 3, Tailwind CSS 3**Testing**: Pest 4, PHPUnit 12**Tooling**: Pint (formatter), Ziggy (routing), Vite (bundling)Core Principles
1. **Write clear, self-explanatory code** - NO code comments except for PHPDoc blocks
2. **Follow existing conventions** - Check sibling files for structure, naming, and approach before creating new files
3. **Test everything** - Every change must have programmatic tests (unit or feature)
4. **Use descriptive names** - `isRegisteredForDiscounts()` not `discount()`
5. **Reuse before creating** - Check for existing components and patterns
Laravel Development Guidelines
File Creation
Always use `php artisan make:` commands (controllers, models, migrations, etc.)Use `php artisan make:class` for generic PHP classesPass `--no-interaction` and appropriate `--options` to all Artisan commandsDatabase & Eloquent
**Prefer Eloquent** over raw queries (`Model::query()` not `DB::`)Use proper relationship methods with return type hintsEager load to prevent N+1 queries**Migration modifications**: Include ALL previous column attributes or they'll be lostControllers & Validation
Create Form Request classes for validation (not inline)Check sibling Form Requests to match array vs string validation styleUse Eloquent API Resources for APIs with versioningConfiguration
Never use `env()` outside config filesAlways use `config('app.name')` not `env('APP_NAME')`URL Generation
Prefer named routes with `route()` functionAuthentication
Use built-in features: gates, policies, SanctumPHP Code Standards
Type Declarations
```php
protected function isAccessible(User $user, ?string $path = null): bool
{
// Implementation
}
```
Constructor Property Promotion
```php
public function __construct(public GitHub $github) { }
```
Control Structures
Always use curly braces, even for single-line blocksNo empty `__construct()` methods with zero parametersEnums
Keys should be TitleCase: `FavoritePerson`, `BestLake`, `Monthly`Inertia.js v2
Components in `resources/js/Pages` (unless vite.config.js specifies otherwise)Use `Inertia::render()` for server-side routingLeverage v2 features: polling, prefetching, deferred props, infinite scrolling, lazy loadingBuild forms with `<Form>` component or `useForm` helper (check docs with `search-docs`)Add skeleton loaders for deferred propsExample controller:
```php
Route::get('/users', function () {
return Inertia::render('Users/Index', [
'users' => User::all()
]);
});
```
Testing with Pest 4
Writing Tests
All tests use Pest syntaxCreate with `php artisan make:test --pest {name}`Test happy paths, failure paths, and edge casesNever remove tests without approvalExample:
```php
it('returns all users successfully', function () {
$response = $this->postJson('/api/users', []);
$response->assertSuccessful();
});
```
Running Tests
Run minimal tests with filters before finalizing editsAll tests: `php artisan test`Single file: `php artisan test tests/Feature/ExampleTest.php`Filtered: `php artisan test --filter=testName`Assertions
Use specific methods: `assertForbidden()`, `assertNotFound()` not `assertStatus(403)`Factories
Use model factories in testsCheck for custom factory states before manual setupUse `$this->faker->word()` or `fake()->randomDigit()` (match existing convention)Laravel Pint Formatting
**DO NOT run `vendor/bin/pint --dirty`** (per project-specific rules)
Laravel 12 Specific Notes
This project uses **Laravel 10 structure** (not migrated to Laravel 12 streamlined structure)Middleware: `app/Http/Middleware/`Providers: `app/Providers/`Middleware registration: `app/Http/Kernel.php`Exception handling: `app/Exceptions/Handler.php`Console: `app/Console/Kernel.php`Model Casts
Prefer `casts()` method over `$casts` property (follow existing conventions)
Laravel Pennant (Feature Flags)
This application uses Pennant for feature flag management across organizations and user types.
Frontend Bundling
If UI changes aren't reflected, ask user to run:
`npm run build``npm run dev``composer run dev`Vite Manifest Error
If "Unable to locate file in Vite manifest" error occurs, run `npm run build` or ask user to run `npm run dev`/`composer run dev`.
Documentation & Debugging
Use `search-docs` tool for Laravel ecosystem documentation (version-specific)Use broad, topic-based queries: `['rate limiting', 'routing']` not `'laravel 12 rate limiting'`Pass multiple queries at once for better resultsUse `tinker` tool for PHP debugging and Eloquent queriesUse `database-query` tool for read-only database accessUse `browser-logs` tool for frontend debugging (ignore old logs)Communication Style
**Be concise** - focus on important details, skip obvious explanationsOnly create documentation files if explicitly requestedCheck if tests cover functionality before creating verification scriptsApplication Structure
Stick to existing directory structureDon't create new base folders without approvalDon't change dependencies without approvalImportant Reminders
1. Every change needs a test
2. Run minimum necessary tests before finalizing
3. Use Artisan commands for file generation
4. Follow existing code conventions
5. Write clear, self-documenting code
6. No code comments (use PHPDoc blocks only)
7. Check sibling files for patterns before implementing