Guides decisions on whether business logic belongs in the domain layer (entities, domain services) or application layer (application services) per ABP's DDD guidance.
Ships in abp-module-development. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
ABP splits business logic into two layers, and the hardest DDD question in practice is
which layer a given rule belongs to. Getting it wrong leaks use-case concerns into the
domain (making it un-reusable) or scatters core rules across application services (making
them un-enforceable). This skill is the decision guide; the mechanics of writing each
building block live in model-domain-aggregates and application-services.
SaveChangesAsync.Put a rule in the domain when it must hold for every use case — it's part of what
makes the data valid. Prefer the entity first; use a domain service (a Manager)
only when the rule spans aggregates or needs a repository/other service.
A domain service must not:
ICurrentUser). A domain service should be
usable even when there is no logged-in user (background workers, data import). Pass any
needed user id in as a parameter.IEmailSender, SMS, etc.). Whether and what to notify is
use-case specific.public class OrganizationManager : DomainService
{
private readonly IRepository<Organization, Guid> _organizationRepository;
public OrganizationManager(IRepository<Organization, Guid> organizationRepository)
{
_organizationRepository = organizationRepository;
}
public async Task<Organization> CreateAsync(string name)
{
// Core domain rule: an organization name is always unique. It holds for every
// use case, so it belongs here — not in one application service.
if (await _organizationRepository.AnyAsync(o => o.Name == name))
{
throw new BusinessException("IssueTracking:DuplicateOrganizationName");
}
return new Organization(GuidGenerator.Create(), name);
// No authorization, no CurrentUser, no email, no InsertAsync here.
}
}
The application service implements one use case. It's the natural home for everything tied to how this interaction runs:
[UnitOfWork]. Write requests get a database transaction (all changes
commit together or roll back on error); read (HTTP GET) methods still get a unit of work
but no transaction.[Authorize("...")] (or an
IAuthorizationService/IPermissionChecker check).InsertAsync/UpdateAsync, or rely
on the unit of work for tracked entities).IObjectMapper.public class OrganizationAppService : ApplicationService, IOrganizationAppService
{
private readonly OrganizationManager _organizationManager;
private readonly IRepository<Organization, Guid> _organizationRepository;
private readonly IPaymentService _paymentService;
private readonly IEmailSender _emailSender;
public OrganizationAppService(
OrganizationManager organizationManager,
IRepository<Organization, Guid> organizationRepository,
IPaymentService paymentService,
IEmailSender emailSender)
{
_organizationManager = organizationManager;
_organizationRepository = organizationRepository;
_paymentService = paymentService;
_emailSender = emailSender;
}
[Authorize("OrganizationCreationPermission")] // authorization: application layer
public async Task<OrganizationDto> CreateAsync(CreateOrganizationDto input)
{
await _paymentService.ChargeAsync(CurrentUser.GetId(), GetOrganizationPrice()); // infra + CurrentUser
var organization = await _organizationManager.CreateAsync(input.Name); // core rule reused
await _organizationRepository.InsertAsync(organization); // persist
await _emailSender.SendAsync("[email protected]", "New organization", input.Name); // notify
return ObjectMapper.Map<Organization, OrganizationDto>(organization); // return a DTO
}
}
The trap is thinking important logic must be domain logic. In the example, charging payment feels critical — but it's still application logic, because there are valid use cases that create an organization without payment (an admin creating one from the back office; a background data-import job). A rule is core domain logic only if it must hold for every use case. If you can name a use case where it shouldn't run, it's application logic.
When several clients (public web MVC, back-office Angular, mobile) share one domain, don't
pile their differing use cases, DTOs, validation and authorization into a single
application layer full of if branches. Instead:
Acme.Admin.Application,
Acme.Public.Application, Acme.Mobile.Application), each with its own application
services, DTOs and authorization for that client's use cases.[Authorize]/permission checks to the application service.ICurrentUser — pass the needed user id as a method parameter so the service works with no active user.InsertAsync/UpdateAsync) — let the application service persist; saving in the domain service causes a double database operation once the application service updates the entity again.ObjectMapper.Map) instead.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
domain-driven-design, ddd, application-logic, domain-logic, abp
/abp-module-development:separate-domain-and-application-logicfrom abp-module-development
npx claudepluginhub abpframework/abp-skills --plugin abp-module-development13 skills in this plugin
/application-servicesWrites or reviews an ABP application service — the DTO-taking, DTO-returning boundary between the domain and the presentation/API layer. USE FOR: implementing IApplicationService/ApplicationService for non-CRUD use cases, using AbstractKeyCrudAppService for composite or non-standard keys, and unit-of-work basics. DO NOT USE FOR: exposing application services as auto/conventional API controllers, routes, verbs or [RemoteService] (use expose-http-apis); a complete standard-key CrudAppService workflow (use build-crud-application-services); detailed object-to-DTO mapping mechanics/profiles (use map-objects-and-dtos); DTO validation attributes and business exceptions (use handle-validation-and-errors); permission definitions and authorization policy (use permissions-and-authorization); the overall layered project structure (use layered-architecture).
/build-crud-application-servicesBuilds or reviews a complete ABP CRUD application-service contract and implementation with the CrudAppService APIs. USE FOR: choosing ICrudAppService/CrudAppService generic overloads, separating get/list/create/update DTOs, wiring IRepository, object mappings and five policy properties, adding list filters without breaking count/sort/page order, and validating all five CRUD operations. DO NOT USE FOR: a non-CRUD use case or general ApplicationService orchestration (use application-services); composite or non-standard keys with AbstractKeyCrudAppService (use application-services); mapping-provider configuration details (use map-objects-and-dtos); permission definitions (use permissions-and-authorization); optimistic concurrency (use handle-optimistic-concurrency); HTTP endpoint conventions (use expose-http-apis); integration-test infrastructure (use test-abp-applications).
/create-plugin-modulesLoad ABP modules at runtime as plug-ins instead of referencing their assemblies directly, via AbpApplicationCreationOptions.PlugInSources. USE FOR: configuring options.PlugInSources with AddFolder / AddFiles / AddTypes (or a custom IPlugInSource), building a class-library plug-in module deriving from AbpModule, wiring MVC/Razor Pages plug-ins with AssemblyPart / CompiledRazorAssemblyPart application parts. DO NOT USE FOR: defining ordinary referenced modules, [DependsOn], or DI registration (use define-application-modules); overall solution layering (use layered-architecture); building the actual UI pages inside a plug-in (use blazor-ui, mvc-razor-ui, or angular-ui).
/customize-application-modulesExtends or customizes a pre-built ABP module (Identity, Account, etc.) referenced as NuGet packages without editing its source. USE FOR: adding extra entity/DTO properties via the module extension system, mapping extra properties to real EF Core columns, replacing/overriding module services, repositories, domain services, and controllers, overriding module UI. DO NOT USE FOR: defining your own new application module from scratch (use define-application-modules); modeling your own aggregates/entities (use model-domain-aggregates); general object-to-DTO mapping mechanics (use map-objects-and-dtos).
/define-application-modulesDefine and wire up an ABP module: the AbpModule class, [DependsOn] dependencies, service registration, options configuration, lifecycle hooks, and conventional DI. USE FOR: creating an AbpModule class, declaring [DependsOn] dependencies, registering services in ConfigureServices / PreConfigureServices / PostConfigureServices, configuring options with Configure for an options class, adding startup/shutdown lifecycle hooks (OnApplicationInitialization / OnApplicationShutdown), relying on ITransientDependency/IScopedDependency/ISingletonDependency conventional DI. DO NOT USE FOR: deciding which project a class belongs in or the overall solution layering (use layered-architecture); modeling entities/aggregates/value objects/domain services (use model-domain-aggregates); loading modules at runtime as plug-ins (use create-plugin-modules); writing application service implementations (use application-services).
/extend-objects-with-extra-propertiesAdd framework-level dynamic properties to any ABP entity or DTO that implements IHasExtraProperties. USE FOR: IHasExtraProperties and ExtraPropertyDictionary; ExtensibleObject and extensible aggregate roots/DTOs; ObjectExtensionManager definitions; GetProperty/SetProperty; EF Core JSON or dedicated-column persistence; MongoDB extra elements; mapping extra properties between entities and DTOs. DO NOT USE FOR: extending an installed Identity, Account, or other pre-built module through its module-specific extension configurator (use customize-application-modules); ordinary object mapping without extra properties (use map-objects-and-dtos); designing aggregate invariants and entity relationships (use model-domain-aggregates).
Other plugins' skills for the same job