backend-development-rules

Enforces Laravel Repository-Service pattern rules for controllers, services, repositories, models, and testing.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Laravel backend codebases drift into inconsistent patterns when multiple developers or AI agents write controllers, services, and repositories without shared conventions, causing architectural violations, N+1 queries, and unmaintainable code. ## Core Features & Use Cases - Layered Architecture Rules: Defines strict responsibilities for controllers, services, repositories, models, form requests, resources, enums, and migrations using the L0n3ly Laravel Repository With Service package. - Exact Helper Implementations: Provides verbatim code for PermissionHelper, QueryableHelper, StringSearch, MoneyHelper, and ImageHelper so authorization, pagination, fuzzy search, and currency handling stay consistent. - Compliance Audit Checklist: Ships a 15-section audit covering code quality, security, testing, and architecture alignment for PR reviews and release checks. - Use Case: When asked to build a new product management endpoint, the Skill guides creation of the repository interface and implementation, service with response chain and permission validation, thin controller with Scribe documentation, form request validation, and feature tests. ## Quick Start Use the backend-development-rules skill to create a new Product feature with repository, service, controller, form request, and resource following the project conventions.

Frequently Asked Questions about backend-development-rules

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

FAQPage Schema
How do I implement the Repository-Service pattern in Laravel?▼

Create an interface like ProductRepository and an implementation ProductRepositoryImplement extending the Eloquent base class, then do the same for services. The RepositoryAutoBindProvider handles binding automatically, so no manual container registration is needed.

How to validate permissions in a Laravel service layer?▼

Call helpers()->permissionHelper()->validatePermission() with a PermissionEnum case at the start of the service method. Catch UnauthorizedHttpException for 401 responses and AccessDeniedHttpException for 403 responses separately.

Should Laravel enums be backed or non-backed?▼

This convention defaults to non-backed enums with UPPER_SNAKE_CASE case names, using the ->name property as the string value. Use backed enums only when explicitly required, such as matching specific database values.

Does this pattern work with Laravel API documentation tools?▼

Yes, controllers must return service responses via toJson() and include Scribe annotations like @group, @bodyParam, and @response scenarios. This generates accurate API documentation directly from controller docblocks.

Why should controllers stay thin in Laravel applications?▼

Thin controllers only map HTTP requests to service calls, keeping business logic testable in services and data access in repositories. Typical controller methods stay around 15-25 lines with validation delegated to Form Requests.

When should I not use the Repository-Service pattern?▼

Very small applications or prototypes with minimal data logic may not justify the extra interface and implementation layers. The pattern pays off in larger codebases needing testability, consistency, and clear separation of concerns.