DDD Bounded Context Generator

Generate DDD bounded contexts with layered architecture and repository interfaces.

Updated Oct 31, 2025
One-click install
npx skills add https://github.com/RomualdP/hoki --skill ddd-bounded-context-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: DDD Bounded Context Generator
Source: https://github.com/RomualdP/hoki/tree/main/.claude/skills/ddd-bounded-context
Command: npx skills add https://github.com/RomualdP/hoki --skill ddd-bounded-context-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @nestjs/common, @prisma/client.

What problem does it solve?

This Skill guides the creation of well-structured backend bounded contexts using Domain-Driven Design (DDD) principles, ensuring a clear separation of concerns, maintainable code, and a pure domain layer isolated from technical infrastructure.

Core Features & Use Cases

  • Layered Architecture: Defines strict rules for Domain, Application, Infrastructure, and Presentation layers, ensuring unidirectional dependencies and framework-agnostic domain logic.
  • Rich Domain Models: Emphasizes encapsulating business logic within Entities and Value Objects, making the core of the application robust and testable.
  • Repository Pattern: Guides on defining repository interfaces in the Domain layer and implementing them in the Infrastructure layer, abstracting persistence details.
  • Use Case: When starting a new major feature like "Club Management," use this Skill to define its bounded context, structure its folders, and implement its core domain entities, application services, and infrastructure components according to DDD best practices.

Quick Start

To create a new bounded context, set up the domain/, application/, infrastructure/, and presentation/ directories. Start by defining your core domain entities and value objects, ensuring no external framework dependencies in the domain/ layer.

Frequently Asked Questions about DDD Bounded Context Generator

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

FAQPage Schema
How do I structure a backend with Domain-Driven Design and layered architecture?

DDD layered architecture separates your backend into Domain, Application, Infrastructure, and Presentation layers with unidirectional dependencies. This isolates business logic from frameworks, making your code testable and maintainable. Start by defining domain entities and value objects in a framework-agnostic domain layer, then build application services, repository implementations, and presentation adapters in upper layers.

What's the difference between entities and value objects in DDD?

Entities have unique identities that persist over time and encapsulate mutable state and business logic. Value objects represent immutable concepts defined by their attributes—two value objects are equal if their attributes match, regardless of identity. Both belong in your domain layer and model core business concepts without framework dependencies.

How do I implement the repository pattern in a DDD bounded context?

Define repository interfaces in your domain layer as contracts for persistence, then implement them in the infrastructure layer. This abstracts database details from your domain logic. Your application services depend on repository interfaces, not concrete implementations, keeping the domain layer framework-agnostic and testable.

Can I use DDD with NestJS for new backend features?

Yes. NestJS works well with DDD when you keep your domain layer free of NestJS decorators and framework code. Place your entities, value objects, and domain services in a pure domain module, then use NestJS modules, controllers, and services in application and presentation layers to orchestrate use cases and handle HTTP concerns separately.

When should I create a new bounded context instead of adding to an existing one?

Create a new bounded context when a feature has distinct business rules, language, or persistence needs that would complicate an existing context. Examples include separating Club Management from User Authentication. Each bounded context owns its domain model, repositories, and application services, reducing coupling and improving maintainability.

What's required before implementing a DDD bounded context?

Understand your domain's core business rules and terminology. Identify aggregate roots, entities, and value objects. Plan your layer structure and dependency flow. Set up project directories for domain, application, infrastructure, and presentation layers. Have NestJS and Prisma available if using this Skill's stack, though the domain layer remains framework-independent.