backend-domain-model-architect

Models backend domains into bounded contexts, aggregates, and Effect-TS service layers.

1|Updated Aug 25, 2026
One-click install
npx skills add https://github.com/sabiscore/swarmxq --skill backend-domain-model-architect-sabiscore
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-domain-model-architect
Source: https://github.com/sabiscore/swarmxq/tree/main/.ai/skills/backend-domain-model-architect
Command: npx skills add https://github.com/sabiscore/swarmxq --skill backend-domain-model-architect-sabiscore

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires effect.

What problem does it solve? Business logic often ends up scattered across fat controllers and procedural scripts, making invariants hard to enforce and code hard to reason about. This Skill guides the design of backend domains using domain-driven design with Effect-TS, so business rules live in explicit types, aggregates, and services instead of route handlers. ## Core Features & Use Cases - Bounded Context Extraction: Define language boundaries and a domain glossary before writing any schema or code. - Typed Domain Modeling: Build value objects, aggregates, and invariant-enforcing methods with Effect-TS Schema and Data classes so invalid states are unrepresentable. - Service & Event Layers: Compose domain services with Effect Layers, publish past-tense domain events through a BullMQ outbox, and keep controllers as thin orchestrators. - Use Case: Translating a Nigerian fintech requirement (VAT computation, FIRS e-invoicing) into a TaxComputation bounded context with TIN value objects, a VATReturn aggregate, and a fileVATReturn application service wired to Fastify. ## Quick Start Ask the AI to model your business workflow into bounded contexts, aggregates, and an Effect-TS service layer before writing any route handlers.

Frequently Asked Questions about backend-domain-model-architect

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

FAQPage Schema
How do I model a backend domain with Effect-TS and DDD?

Start by extracting bounded contexts and writing a domain glossary, then define value objects and aggregates with Effect Schema and Data classes. Enforce invariants inside aggregate methods, compose domain services with Effect Layers, and keep controllers as thin orchestrators.

How to extract business logic from a fat controller?

Move business rules into an application service that validates input, calls a domain service for pure logic, and publishes domain events. The route handler then only provides Effect Layers and returns the result, containing no business logic itself.

What is the difference between an aggregate and a domain service?

An aggregate is the consistency boundary that enforces invariants and owns state transitions, with one aggregate per transaction. A domain service coordinates operations spanning multiple aggregates or external dependencies like databases and APIs.

How do I implement domain events with BullMQ?

Define events as past-tense Data classes carrying aggregateId, timestamp, and payload, then publish them through a BullMQ queue using an outbox pattern. Use a deterministic jobId combining aggregateId and timestamp to make publishing idempotent.

When should I not use domain-driven design for a backend feature?

Avoid full DDD for simple CRUD endpoints with no meaningful invariants or business rules, where the modeling overhead exceeds the benefit. Reserve bounded contexts and aggregates for domains with complex rules, transactional boundaries, or regulatory constraints.