code-review-instructions.md
Use this checklist when reviewing Laravel 11 + Unopim connector/plugin code. Applies to all AI coding agents: Kilo Code, GitHub Copilot, Claude Code, Codex, Cursor.
/** */) used on all non-trivial methods@return and @param present for complex typesapp() calls inside methods unless deferred)wk_ — e.g., wk_woocommerce_credentialswk_{module}_{entity_plural}Database/Migration/ at package root (not Migrations)PresentableHistoryInterfaceHistoryTrait from Webkul\HistoryControl$auditExcludesrc/Contracts/extras JSON column for flexible config (not scattered separate columns)Webkul\Core\Providers\CoreModuleServiceProviderprotected $models = [...] — no manual bindingRoute::middleware('web')->group(...)Database/Migration (not Database/Migrations)unopim.admin.layout.head.before (with .before — NOT without)acl.php, menu.php, exporters.php, quick_exporters.php, importers.phpregister() (NOT in boot())middleware => ['admin'] onlyconfig('app.admin_url') — NOT hardcoded 'admin'{module}.{section}.{action} convention->withoutMiddleware(VerifyCsrfToken::class)Route::resource() usageHttp/Requests/ Form Request for validation (NOT inline $request->validate())index() returns app(XyzDataGrid::class)->toJson() for AJAX, view otherwisestore()/update() return JsonResponse with redirect_url keychildren keyskey, name, route, sort{module}::app.acl.*src/DataGrids/{Section}/{Entity}DataGrid.php subdirectoryWebkul\DataGrid\DataGridprepareQueryBuilder() uses DB::table() (not Eloquent)url callback in actions uses function ($row) (not arrow function)bouncer()->hasPermission() gates all actions and mass actionslabel-active, label-info@return added to prepareQueryBuilder()exporters.php present for batch/scheduled exportsquick_exporters.php present for one-click exportimporters.php present if connector supports importname, title, required, validation, type, async, track_by, label_by, list_routelist_route routes exist and return [{id, label}] formattestConnection() method present and called before saving credentialsLog::error() with sanitized context onlyCURLOPT_SSL_VERIFYPEER => true)curl_close() called in all code pathsextras JSON column used for flexible/additional configconsumerSecret, password, etc.) in $auditExcludetestConnection() called in store() BEFORE persistingshopUrl)DB::table() in DataGrids (not Eloquent)SELECT * in DataGrid query builder['admin'] middlewarebouncer()->hasPermission() on every DataGrid actionwithoutMiddleware(VerifyCsrfToken::class) explicitly{module}::app.*Resources/lang/en/app.phptrans() calls| Priority | Examples |
|---|---|
| 🔴 Critical | Credentials saved without testing, missing wk_ prefix, wrong middleware |
| 🟠 High | Missing auditExclude, wrong event name (missing .before), N+1 queries |
| 🟡 Medium | Inline validation (should be Form Request), missing type hints, no DataGrid |
| 🟢 Low | PHPDoc style, minor label translations, sort order in ACL/menu |
Before marking code ready for any agent or project:
wk_ prefix on all tablesHistoryTrait + PresentableHistoryInterface on all modelsCoreModuleServiceProvider for ModuleServiceProviderunopim.admin.layout.head.beforeDB::table()exporters.php, quick_exporters.php, importers.phpJsonResponse with redirect_url from store/updatetestConnection() called before credential savecode-generation-instructions.md consulted