service-generator

Generate Laravel service classes with repository injection and API response formatting.

Updated Sep 19, 2026
One-click install
npx skills add https://github.com/idehen-divine/lumished --skill service-generator-idehen-divine
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: service-generator
Source: https://github.com/idehen-divine/lumished/tree/main/.agents/skills/service-generator
Command: npx skills add https://github.com/idehen-divine/lumished --skill service-generator-idehen-divine

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Manually creating service classes, interfaces, and implementations in Laravel is repetitive and error-prone, especially when wiring repositories and consistent API responses across a layered architecture. ## Core Features & Use Cases - Artisan Service Generation: Create service interfaces and implementations with php artisan make:service, including --api, --repository, and subdirectory options. - Layered Architecture Patterns: Enforce a Controller → Service → Repository → Model structure with automatic repository dependency injection. - ResultService Responses: Standardize success and error API responses using the ResultService trait, plus patterns for transactions, caching, events, and multi-repository orchestration. - Use Case: When building an order checkout flow, generate an OrderService with the API template, inject Order and Item repositories, and return consistent success/error responses to your controller. ## Quick Start Ask the AI to generate a new Laravel service class for your model with an API response template and a paired repository.

Frequently Asked Questions about service-generator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a service class in Laravel with artisan?▼

Run php artisan make:service UserService to create an interface and implementation in app/Services. Add the --api flag for ResultService response helpers or --repository to generate a paired repository.

How to create a service and repository from a Laravel model?▼

Use php artisan make:model Order --service to generate the model with a service, or add -sr -rt flags to include a repository as well. The service automatically receives the repository via constructor injection.

What is the ResultService trait in Laravel services?▼

ResultService is a trait from the Laravel Repository With Service package that provides success() and error() helper methods. These return consistently formatted arrays with success flags, data, and messages for API responses.

Can a Laravel service inject multiple repositories?▼

Yes, services support constructor injection of multiple repositories, such as OrderRepository and ItemRepository together. This enables orchestrating complex multi-step operations like checkout flows within a single service method.

How do I handle database transactions in a Laravel service?▼

Wrap multi-step operations in DB::transaction() inside the service method and return the ResultService response from the closure. Exceptions are caught in the surrounding try-catch and returned as error responses.