coreex-app-service

Creates CoreEx Application-layer services with CRUD operations, CQRS read services, adapters, and policies.

28|8|Updated Feb 21, 2022
One-click install
npx skills add https://github.com/Avanade/CoreEx --skill coreex-app-service-avanade
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: coreex-app-service
Source: https://github.com/Avanade/CoreEx/tree/main/.github/skills/coreex-app-service
Command: npx skills add https://github.com/Avanade/CoreEx --skill coreex-app-service-avanade

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building Application-layer services in a CoreEx-based .NET solution requires following many strict conventions: unit-of-work transactions, event publishing, validation pipelines, CQRS separation, and adapter/policy patterns. This Skill guides an AI agent through creating or modifying these services correctly, eliminating convention drift and rework. ## Core Features & Use Cases - Service Scaffolding: Generates the interface and implementation for a new service with [ScopedService] registration, guard clauses, and correct dependency injection rules. - Dual Pipeline Styles: Supports both exception-based and Result<T> (railway-oriented) pipelines, including validation short-circuits and multi-step orchestration helpers. - CQRS Read Services: Creates {Name}ReadService classes for queries and read-model shapes, delegating to repository QueryAsync/QuerySchemaAsync methods. - Adapters and Policies: Adds anti-corruption adapter interfaces for cross-domain calls and policy classes for I/O-based guard logic. - Use Case: Ask the agent to add a new OrderService with create, update, and a ConfirmAsync business action; it scaffolds the interface, wraps mutations in TransactionAsync, publishes the correct EventAction events, and wires validation. ## Quick Start Ask the agent to create a CoreEx application service for your entity, specifying the operations needed and whether the project uses exception-based or Result<T> pipelines.

Frequently Asked Questions about coreex-app-service

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

FAQPage Schema
How do I create a CoreEx application service with CRUD operations?▼

Define an interface in Application/Interfaces with async methods taking CancellationToken, then implement it in a class decorated with [ScopedService<IInterface>]. Inject only the repository and IUnitOfWork, validate with ValidateAndThrowAsync, and wrap mutations in TransactionAsync with events added inside.

How do I choose between exception-based and Result<T> pipelines in CoreEx?▼

The choice is per-project: exception-based services throw NotFoundException and BusinessException, while Result<T> services return Result.NotFoundError() and compose steps with Result.GoAsync and ThenAsAsync. Check the solution's AGENTS.md feature configuration for the rop-enabled setting before writing code.

When should I use a CQRS read service versus the main service?▼

Use a {Name}ReadService for queries and collection results via QueryAsync and QuerySchemaAsync, while mutations and by-id GetAsync stay in {Name}Service. Both services share the same repository; never split the repository to mirror the CQRS separation.

Can I inject validators or mappers into a CoreEx service constructor?▼

No. Validators, mappers, and policies are never injected into service constructors. Call validators via their Default singleton or instantiate them at the point of use, and instantiate policies with dependencies already injected into the calling service.

Why must events be published inside TransactionAsync in CoreEx?▼

Events added to IUnitOfWork.Events inside TransactionAsync commit atomically with the database write, supporting outbox-style consistency. Publishing outside the transaction risks emitting events for changes that were never persisted.

When should I not use this application service skill?▼

Do not use it for Infrastructure repositories, validators, or controller endpoints; those belong to the coreex-repository, coreex-validator, and coreex-api skills respectively. Domain aggregates, entities, and value objects also belong in the Domain layer, not the Application layer.