backend-domain-model-architect

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Business logic often ends up scattered across fat controllers and procedural scripts, making backend systems hard to reason about and unsafe to change. This Skill guides the design of explicit domain models — bounded contexts, aggregates, invariants, and domain events — implemented with Effect-TS typed services. ## Core Features & Use Cases - Bounded Context Extraction: Define language boundaries and a domain glossary before writing any schema or code. - Effect-TS Domain Modeling: Build value objects, aggregates with enforced invariants, domain services via Layers, and past-tense domain events published through a BullMQ outbox. - Application Service Orchestration: Keep route handlers thin by moving logic into application services that validate input, call domain services, and publish events. - Use Case: Extracting a fat Fastify controller for a tax-filing feature into a TaxComputation domain service with a VATReturn aggregate, invariant checks, and a VATReturnFiled event. ## Quick Start Ask the AI to model your backend feature as a domain-driven design with bounded contexts, aggregates, and Effect-TS service layers 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 extract business logic from a fat controller?

Move logic into an application service that validates input, calls a domain service containing the pure business rules, and publishes domain events. The route handler then only orchestrates by providing the Effect-TS layers and returning the result.

How do I model aggregates and invariants with Effect-TS?

Define value objects with Schema.Class for validated immutable data, then build aggregates with Data.Class whose methods enforce invariants and return new state instead of mutating. This makes invalid states unrepresentable at the type level.

What is a bounded context in domain-driven design?

A bounded context is an explicit language boundary where domain terms have precise meanings, defined before writing code. Each context gets its own glossary, error types, and services, preventing hidden coupling between unrelated business areas.

How do I publish domain events reliably with BullMQ?

Use the outbox pattern: publish events through a BullMQ queue with a deterministic jobId built from the aggregate ID and timestamp. This makes event delivery idempotent so retries never produce duplicate side effects.

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

Avoid full DDD modeling for simple CRUD endpoints with no business rules or invariants, where the overhead of aggregates, layers, and events adds complexity without benefit. Reserve it for domains with meaningful consistency rules and transactional boundaries.