service-layer

Apply Application, Domain, and Service Layer patterns to isolate orchestration logic from controllers.

1|1|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/Entelligentsia/skillforge --skill service-layer-entelligentsia
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: service-layer
Source: https://github.com/Entelligentsia/skillforge/tree/main/design-patterns/skills/service-layer
Command: npx skills add https://github.com/Entelligentsia/skillforge --skill service-layer-entelligentsia

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This pattern helps prevent business logic from leaking into controllers by specifying that orchestration belongs in services—Application Services orchestrate use cases, Domain Services hold domain logic that spans objects, and the Service Layer defines the public API boundary.

Core Features & Use Cases

  • Orchestration vs. domain logic: separates coordination from business rules to keep entities cohesive and expressive.
  • Patterns covered: Application Service (thin orchestration), Domain Service (cross-entity domain logic), and Service Layer (public API boundary).
  • Common guidance: avoid placing business rules in controllers or application services; place rule-logic in domain objects when it belongs there; name domain services after domain concepts.

Quick Start

Identify orchestration steps in a controller and extract them into an Application Service to coordinate domain objects.

Frequently Asked Questions about service-layer

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

FAQPage Schema
How do I stop business logic from leaking into my controllers?

To stop business logic leaking into controllers, extract orchestration steps into an Application Service. This isolates coordination logic, keeping controllers thin and ensuring business rules reside within domain objects or stateless domain services.

What is the difference between an Application Service and a Domain Service?

An Application Service orchestrates use cases as a thin coordination layer, while a Domain Service holds stateless business logic that spans multiple domain objects. Separating them prevents orchestration from diluting core domain rules.

When do I need a service layer in domain-driven design?

You need a service layer in domain-driven design when use cases span multiple aggregates or require coordination across domain objects and infrastructure. It defines a public API boundary for clean application service orchestration.

How do I extract orchestration logic from a controller into a service layer?

Identify orchestration steps in your controller and extract them into an Application Service to coordinate domain objects. This establishes a clearly defined service boundary that separates coordination from expressive business rules.

Where should cross-entity domain logic reside instead of application services?

Cross-entity domain logic should reside in stateless Domain Services, not application services. Placing rule-logic in domain services or entities keeps application services thin for orchestration and maintains domain cohesion.

Can I put business rules directly in my application service?

Avoid placing business rules in application services. Application services should remain thin orchestration layers; business rule-logic belongs in domain objects or stateless domain services to keep entities cohesive and expressive.