scaffold-crud
Scaffolds a complete CRUD feature for an entity (Actions, Controller, Requests, Pages, Routes). Use when building a new feature from scratch (e.g., "Scaffold CRUD for Events in Academic module").
When & Why to Use This Skill
This Claude skill automates the generation of a complete full-stack CRUD (Create, Read, Update, Delete) feature set within a Modular Monolith architecture. It streamlines the development process by scaffolding all necessary components—including backend Models, Migrations, Actions, and Controllers, as well as frontend Inertia/Vue pages—ensuring rapid feature delivery and strict adherence to architectural standards.
Use Cases
- Rapid Feature Prototyping: Quickly bootstrap a new entity like 'Events' or 'Courses' with a fully functional management interface in minutes.
- Architectural Consistency: Standardize the implementation of business logic across a team by automatically following the Action/Query pattern and modular structure.
- Boilerplate Automation: Eliminate the manual effort of writing repetitive code for migrations, request validation, and basic CRUD views, allowing developers to focus on complex business requirements.
| name | scaffold-crud |
|---|---|
| description | Scaffolds a complete CRUD feature for an entity (Actions, Controller, Requests, Pages, Routes). Use when building a new feature from scratch (e.g., "Scaffold CRUD for Events in Academic module"). |
| allowed-tools | Bash, Write, Read |
Scaffold CRUD Feature
This skill helps generate the full stack of files needed for a standard CRUD feature in the Modular Monolith architecture.
Instructions
Analyze Request:
- Module: (e.g.,
Academic) - Entity: (e.g.,
Course) - Portal:
Admin(default) orStudent.
- Module: (e.g.,
Plan the Files: Create a checklist of files to generate using the specific single-purpose skills (or manually if skills can't be called directly).
Backend:
Model:app/Modules/{Module}/Models/{Entity}.phpMigration:database/migrations/xxxx_xx_xx_create_{table}_table.phpActions:Create{Entity}Action,Update{Entity}Action,Delete{Entity}Action.Query:List{Entity}Query(for Index),Get{Entity}Query(for Show/Edit).Requests:Create{Entity}Request,Update{Entity}Request.Controller:Http/Controllers/Web/{Portal}/{Entity}Controller.php.Policy:Policies/{Entity}Policy.php.Routes: Add toroutes/web.phpin the module.
Frontend (Inertia):
Index.vue: List with DataTable.Create.vue: Form for creating.Edit.vue: Form for editing.
Execute (Step-by-Step):
- Don't try to write all files in one turn.
- Start with Model & Migration.
- Then Actions & Queries.
- Then Requests & Policy.
- Then Controller & Routes.
- Finally Vue Pages.
Wiring:
- Ensure the Controller calls the Actions and Queries.
- Ensure the Vue pages use the correct Routes.
Template: Route Registration
// app/Modules/{Module}/routes/web.php
use App\Modules\Academic\Http\Controllers\Web\Admin\CourseController;
Route::middleware(['auth', 'verified'])->group(function () {
Route::resource('academic/courses', CourseController::class)
->names('academic.courses');
});
Best Practices
- Consistency: Ensure the
route()names in Vue match the names defined inroutes/web.php. - Authorization: Remind the user to register the Policy and Permissions.
- Validation: Ensure Requests are strictly typed.