lc-dead-code
Find unused classes, methods, routes, views, and imports.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Menu
Find unused classes, methods, routes, views, and imports.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Basé sur la classification professionnelle 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:dead-code |
| description | Find unused classes, methods, routes, views, and imports. |
| argument-hint | [analyze | clean | clean --dry-run | directory] |
| user-invocable | true |
| allowed-tools | Read Grep Bash Edit Write Glob |
Find unused classes, methods, routes, Blade views, and import statements through static analysis.
| Subcommand | Description |
|---|---|
| (no argument) | Scan the entire project for dead code. Read-only report. |
clean | Remove confirmed dead code. Asks for confirmation before each removal. |
clean --dry-run | Show what would be removed without deleting anything. |
[directory] | Analyze a specific directory for dead code. Read-only. |
What to detect:
Classes in app/ that are never instantiated, referenced, imported, or used anywhere else in the codebase.
How to scan:
Glob to find all PHP classes in app/ (excluding vendor).Grep to search the entire codebase for:
use App\ClassName; import statementsClassName:: static callsnew ClassName( instantiationClassName::class references (in route files, service providers, model arrays, etc.)function foo(ClassName $param)app/Providers/*.php for service provider registrationsconfig/*.php for class references in configroutes/*.php for controller referencescomposer.json for autoload references$actions, $casts arrays for action/enum classesClasses to skip (never flag as unused):
config/app.php or bootstrap/providers.php)Severity: Medium
Clean action: Delete the class file after confirmation.
What to detect: Public methods on classes that are never called from outside the class.
How to scan:
Grep to search for calls to each method:
->methodName( instance calls::methodName( static calls'methodName' string references (for dynamic dispatch, route actions, etc.)mount(), render(), boot(), booted() (Livewire/Eloquent)handle() (Jobs, Actions, Commands)up(), down() (Migrations)rules(), messages() (Validation)authorize() (Form Requests)Model::scopeName())Severity: Low (methods may be used dynamically or reserved for future use)
Clean action: Remove the method after confirmation. Show the full method body before deletion so the user can review.
What to detect:
Routes defined in routes/*.php that are never linked to via route(), url(), or action() helpers.
How to scan:
Read to parse all route files and extract named routes.Grep to search for:
route('route.name') callsroute('route.name', calls with parametersRoute::has('route.name') checkshref="{{ route('route.name') }}"redirect()->route('route.name')Severity: Low (routes may be used by external systems or planned for future use)
Clean action: Comment out or remove the route definition after confirmation.
What to detect:
Blade view files in resources/views/ that are never rendered.
How to scan:
Glob to find all resources/views/**/*.blade.php files.resources/views/livewire/properties/index.blade.php -> livewire.properties.index).Grep to search for references:
view('view.name') or view("view.name")@include('view.name') or @include("view.name")@extends('view.name')@livewire('component.name')<livewire:component-name />@component('view.name')<x-component-name (for component views)@livewire directive references them.Views to skip (never flag as unused):
resources/views/layouts/ or resources/views/components/layouts/resources/views/components/ (used via <x-name>)resources/views/errors/resources/views/mail/ or resources/views/emails/Severity: Low
Clean action: Delete the view file after confirmation.
What to detect:
use statements at the top of PHP files that import classes never referenced in the file body.
How to scan:
use import statements.@param ClassName)ClassName::new ClassNameSeverity: Very Low (cosmetic, no runtime impact)
Clean action: Remove the unused use statement.
DEAD CODE ANALYSIS
===================
UNUSED CLASSES (3 found)
-------------------------
1. App\Services\LegacyImportService
File: app/Services/LegacyImportService.php
Reason: Zero references in codebase
Lines: 145
2. App\Actions\Property\OldExportAction
File: app/Actions/Property/OldExportAction.php
Reason: Zero references in codebase (not in model $actions)
Lines: 67
UNUSED ROUTES (2 found)
-------------------------
1. Route: 'admin.legacy.import' (GET /admin/legacy/import)
File: routes/app.php:142
Reason: No route() call found
UNUSED VIEWS (1 found)
------------------------
1. View: livewire.admin.legacy-import
File: resources/views/livewire/admin/legacy-import.blade.php
Reason: No @livewire or route reference
UNUSED IMPORTS (15 found)
--------------------------
1. app/Http/Controllers/PropertyController.php:8
use App\Models\Office; (never referenced)
2. app/Services/SearchService.php:5
use Illuminate\Support\Str; (never referenced)
...
SUMMARY
========
Category | Found | Total Lines
------------------|-------|------------
Unused classes | 3 | 312
Unused methods | 7 | 89
Unused routes | 2 | -
Unused views | 1 | 45
Unused imports | 15 | 15
Total dead code | 28 | ~461 lines
In clean mode, process each category in order (classes, methods, routes, views, imports):
Edit to remove the method from the class.Edit to remove or comment out the route.Edit to remove the use statement.app($className))config('key') resolving to a class)AppServiceProviderview("livewire.{$type}.{$action}") -- these are not detectable statically.