Scaffold Filament plugins with Plugin class, ServiceProvider, Resources, and Pest tests
This skill is limited to using the following tools:
scripts/scaffold_filament_plugin.pyCreates a complete Filament plugin skeleton (panel or standalone) following Filament's official plugin development guidelines.
When the user wants to create a Filament plugin, use the scaffold script:
python3 ${SKILL_DIR}/scripts/scaffold_filament_plugin.py <vendor/plugin-name> [options]
--with-resource <name> - Include a sample Resource--with-page - Include a sample custom Page--with-widget - Include a sample Widget--with-livewire - Include Livewire component structure--with-pest - Include PestPHP testing (default: yes)--no-pest - Exclude PestPHP testingpython3 ${SKILL_DIR}/scripts/scaffold_filament_plugin.py mwguerra/filament-blog
python3 ${SKILL_DIR}/scripts/scaffold_filament_plugin.py mwguerra/filament-blog --with-resource Post
python3 ${SKILL_DIR}/scripts/scaffold_filament_plugin.py mwguerra/filament-blog --with-resource Post --with-page --with-widget
packages/
└── vendor/
└── filament-plugin-name/
├── composer.json
├── README.md
├── LICENSE
├── .gitignore
├── phpunit.xml
├── config/
│ └── filament-plugin-name.php
├── database/
│ └── migrations/
│ └── .gitkeep
├── resources/
│ ├── lang/
│ │ └── en/
│ │ └── messages.php
│ └── views/
│ └── .gitkeep
├── src/
│ ├── PluginNamePlugin.php
│ ├── PluginNameServiceProvider.php
│ ├── Facades/
│ │ └── PluginName.php
│ ├── Resources/
│ │ └── .gitkeep (or generated Resource)
│ ├── Pages/
│ │ └── .gitkeep (or generated Page)
│ ├── Widgets/
│ │ └── .gitkeep (or generated Widget)
│ ├── Livewire/
│ │ └── .gitkeep
│ └── Commands/
│ └── .gitkeep
└── tests/
├── Pest.php
├── TestCase.php
├── Unit/
│ └── ExampleTest.php
└── Feature/
└── .gitkeep
composer.json
Plugin Class (PluginNamePlugin.php)
Filament\Contracts\PluginServiceProvider
Resource (if --with-resource)
Page (if --with-page)
Widget (if --with-widget)
Testing Setup
Install dependencies:
composer update
Register plugin in Panel Provider:
use Vendor\PluginName\PluginNamePlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugins([
PluginNamePlugin::make(),
]);
}
Publish assets (if needed):
php artisan vendor:publish --tag=filament-plugin-name-config
php artisan vendor:publish --tag=filament-plugin-name-migrations
Run tests:
cd packages/vendor/filament-plugin-name
composer install
./vendor/bin/pest
Filament\Contracts\Pluginboot() method->plugin()filament-plugin-name::view-name)Livewire::test()