application-service-implementation

Implements business logic in traditional non-CQRS application service classes.

23|10|Updated Aug 31, 2017
One-click install
npx skills add https://github.com/IntentArchitect/Intent.Modules --skill application-service-implementation-intentarchitect
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: application-service-implementation
Source: https://github.com/IntentArchitect/Intent.Modules/tree/main/Tests/Accelerators/.agents/skills/application-service-implementation
Command: npx skills add https://github.com/IntentArchitect/Intent.Modules --skill application-service-implementation-intentarchitect

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing business logic in traditional application services often leads to layer-boundary violations, infrastructure leakage, in-memory aggregation, and inconsistent patterns. This Skill guides the implementation of service operations so they stay aligned with the modeled domain, existing repository abstractions, and established solution conventions. ## Core Features & Use Cases - Layer-safe service implementation: Enforces Domain/Application-only dependencies, banning Entity Framework, Dapper, DbContexts, and other infrastructure types from the service layer. - Pattern-consistent workflows: Searches the codebase for similar services, mapping conventions, error/result patterns, and unit-of-work conventions before writing code. - Strict data-access rules: Prohibits in-memory aggregation, EF Include/ThenInclude in the Application layer, unnecessary repository Update calls, and SaveChangesAsync unless DB-generated values are required. - AutoMapper enforcement: Requires AutoMapper for DTO projections with a mandatory verification gate that locates or creates Profile mappings. - Use Case: When asked to implement a GetOrderSummary operation on an existing OrderService, the Skill inspects nearby services, extends the repository abstraction for the aggregation, maps via AutoMapper, and produces code matching the solution's conventions. ## Quick Start Implement the CancelOrder operation in the existing OrderService following the application service implementation guidelines.

Frequently Asked Questions about application-service-implementation

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

FAQPage Schema
How do I implement business logic in a traditional application service?▼

Start from the existing service file and update only the relevant operations, loading aggregates through repository abstractions and invoking domain methods where they exist. Follow nearby services for mapping, validation, error handling, and save conventions rather than introducing new patterns.

How should aggregation queries be handled in application services?▼

Services must never compute Count, Sum, Average, GroupBy, or similar aggregations in memory. Instead, extend the appropriate repository or read abstraction with a method that returns the aggregated result, then call that abstraction from the service.

Can application services use Entity Framework Include or DbContext directly?▼

No. The Application layer must not reference EF, Dapper, DbContexts, or any infrastructure types. Lazy loading with proxies and Owned entity configuration load navigation properties automatically, and heavy data loading should move into the repository layer.

When should SaveChangesAsync be called in a service method?▼

Only call SaveChangesAsync when the operation returns a payload requiring DB-generated values such as an Id, RowVersion, or computed column. Operations returning Unit, void, or Task should omit it and rely on an outer unit-of-work commit.

Why is manual DTO construction not allowed on read paths?▼

Read and query operations returning DTOs must use AutoMapper so mapping stays centralized and consistent. Before using ProjectTo-style methods, verify a CreateMap exists in a Profile or create the Profile under the project's Mappings folder.

When should repository Update be called with EF repositories?▼

Never for entities loaded from an EF repository, since EF tracks changes automatically. Modify entity properties directly and let the unit of work persist them; only Add, Create, or Delete calls are appropriate for inserts and removals.