lc-analyze-error
Paste a Laravel stacktrace and get root cause analysis with suggested fix.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Paste a Laravel stacktrace and get root cause analysis with suggested fix.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Create a Larascraper scraper (v2 or v3) for a target website, chaining browser actions (click, type, wait, scroll), conditional flow (when/repeatUntil), captcha solving, and file/PDF downloads. Detects the installed major and generates the matching style.
Add or edit a Laracrate file collection in config/laracrate.php with the correct anatomy (disk, access, types, variants, previews, extract/embed, flags, per-model scoping).
Runtime-verified Laravel inspection using the Laravel Boost MCP server (Tinker, Database Query/Schema, Last Error) instead of static grep. Falls back to Docker/Tinker if Boost is not installed.
Scaffold spatie/laravel-permission setup - add the HasRoles trait to a model and generate a roles & permissions seeder.
Audit spatie/laravel-permission usage - permissions used in code but undefined, defined but unused, unprotected routes, guard mismatches, and cache pitfalls.
Extract business logic from a controller or Livewire component method into a Laractions Action class.
| name | lc:analyze-error |
| description | Paste a Laravel stacktrace and get root cause analysis with suggested fix. |
| argument-hint | [analyze | fix | fix --dry-run] |
| user-invocable | true |
| allowed-tools | Read Grep Bash Edit Write Glob |
Parse a Laravel stacktrace or error message, identify the root cause, read the relevant source files, and provide a specific fix.
| Subcommand | Description |
|---|---|
| (no argument) | Paste an error after invoking. Analyzes and reports root cause with suggested fix. |
fix | Analyze the error and apply the suggested fix, with confirmation before each change. |
fix --dry-run | Analyze the error and show exactly what changes would be made without applying them. |
In all modes, the user pastes the error output after invoking the skill.
The user will paste an error after invoking this skill. Parse the error output to extract:
Illuminate\Database\QueryException, ErrorException, BadMethodCallExceptionIf the error is a standard Laravel error page (HTML), extract the relevant information from the HTML structure. If it is a CLI error, parse the text output.
Read to load the file where the error occurred, focusing on the line number from the stacktrace with surrounding context (approximately 20 lines before and after).app/, routes/, resources/, database/, config/) -- that is where the fix needs to happen.Based on the error type, read additional files for context:
config/auth.php)Classify the error into one of these common patterns and provide specific diagnosis:
| Pattern | Exception | Root Cause |
|---|---|---|
SQLSTATE[42S02] | QueryException | Table doesn't exist -- migration not run or wrong table name |
SQLSTATE[42S22] | QueryException | Column doesn't exist -- typo, migration not run, or column removed |
SQLSTATE[23000] | QueryException | Integrity constraint violation -- duplicate entry, null in NOT NULL, FK violation |
SQLSTATE[42000] | QueryException | Syntax error in SQL -- usually from raw queries or incorrect query builder usage |
SQLSTATE[HY000]: 1215 | QueryException | Cannot add FK constraint -- type mismatch or referenced table missing |
SQLSTATE[22001] | QueryException | Data too long -- string exceeds column length |
| Pattern | Exception | Root Cause |
|---|---|---|
Call to undefined relationship | BadMethodCallException | Relationship method doesn't exist on model |
Property does not exist | ErrorException | Accessing undefined property (possible missing relationship or accessor) |
Mass assignment | MassAssignmentException | Column not in $fillable or $guarded is blocking it |
Model not found | ModelNotFoundException | findOrFail() or firstOrFail() with non-existent ID |
Call to a member function on null | ErrorException | Accessing method on null relationship result |
| Pattern | Exception | Root Cause |
|---|---|---|
Undefined variable | ErrorException | Variable not passed from controller/component to view |
Property not found on component | Livewire error | Wire:model bound to non-existent property |
Component not found | ComponentNotFoundException | Livewire component class missing or not registered |
View not found | InvalidArgumentException | Blade file doesn't exist at expected path |
| Pattern | Exception | Root Cause |
|---|---|---|
Unauthenticated | AuthenticationException | User not logged in, session expired, or wrong guard |
This action is unauthorized | AuthorizationException | Policy check failed |
Route [login] not defined | RouteNotFoundException | Missing named route for auth redirect |
| Pattern | Exception | Root Cause |
|---|---|---|
Typed property must not be accessed before initialization | Error | Livewire property declared with type but no default value |
Cannot access offset of type null | TypeError | Trying to array-access a null value |
Argument #N must be of type X, Y given | TypeError | Wrong argument type passed to method |
Enum case not found | ValueError | Invalid value for PHP enum cast |
For each error, provide:
// BEFORE (line 45 in app/Models/Property.php):
return $this->office->name;
// AFTER:
return $this->office?->name;
After identifying the primary fix, check if the same pattern exists elsewhere:
Grep to search for similar problematic patterns in other files.In fix mode:
Edit to apply the change.In fix --dry-run mode:
In default mode (no subcommand):
Illuminate\Database\QueryException
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'properties.group_id' in 'where clause'
(Connection: mysql, SQL: select * from `properties` where `properties`.`group_id` = 1)
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:829
...
at app/Http/Controllers/PropertyController.php:25
Extract: Exception class, SQL state, column name, table, and the app file from the trace.
[2026-04-06 10:15:23] production.ERROR: Call to a member function format() on null
{"exception":"[object] (Error(code: 0): ... at /var/www/html/app/Models/Schedule.php:45)"}
Extract from JSON structure within the log line.
Livewire\Exceptions\PropertyNotFoundException
Property [$selectedUser] not found on component: [calendar]
These reference the Livewire component name, which maps to a Blade file in resources/views/livewire/.
If the error is related to Vite, assets, or frontend compilation, check:
vite.config.js configurationpackage.json dependenciesnpm run dev is runningBased on the project's CLAUDE.md, watch for these specific patterns:
database/schema/mysql-schema.sql.group_id instead of organization_id, Group instead of Organization.DatabaseNotification should use App\Models\Notification instead.__() instead of text() will not work with Laratext.ERROR ANALYSIS
===============
Exception: Illuminate\Database\QueryException
Message: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'properties.group_id'
ROOT CAUSE
===========
The 'properties' table was renamed from 'group_id' to 'organization_id' in the
Organization rename migration (2025_12_25_023229), but this query still uses the
old column name.
LOCATION
=========
File: app/Http/Controllers/PropertyController.php
Line: 25
Code: Property::where('group_id', $organizationId)->get();
FIX
====
Change 'group_id' to 'organization_id':
// Line 25
- Property::where('group_id', $organizationId)->get();
+ Property::where('organization_id', $organizationId)->get();
RELATED ISSUES
===============
Found 3 other files with the same pattern:
- app/Services/PropertyService.php:42
- app/Jobs/SyncPropertyJob.php:18
- resources/views/livewire/properties/index.blade.php:33
Apply fix? [Waiting for confirmation]