Service layer

From Bottelet/DaybydayCRM · View interactive version

Service layer is an AI agent skill from the GitHub repository Bottelet/DaybydayCRM. Defines application service structure and business orchestration boundaries

How to use this skill

Skill file

Service Layer

Services are the only place business logic lives. They are framework-agnostic.


1. Responsibility

Services MUST:

Services MUST NOT:


2. Dependency Rule

Constructor injection only:

public function __construct(
    private InvoiceRepository $repository
) {}

3. DTO Rule

DTOs are not required when the source is a validated FormRequest::validated()

array. Arrays are fine there.

Use DTOs when:

Skip DTOs when:


4. Standard Shape

app/Services/{Domain}/{Model}Service.php

e.g. app/Services/Task/TaskService.php, app/Services/Offer/OfferService.php.

Standard method names: create, update, delete, findByExternalId. Prefer

one service class per domain holding both create/update (see TaskService)

over splitting into separate per-action service classes.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.