drupal-ddd

Structure Drupal modules around Domain-Driven Design patterns.

3|5|Updated Jan 8, 2026
One-click install
npx skills add https://github.com/sparkfabrik/sf-awesome-copilot --skill drupal-ddd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drupal-ddd
Source: https://github.com/sparkfabrik/sf-awesome-copilot/tree/main/skills/drupal/drupal-ddd
Command: npx skills add https://github.com/sparkfabrik/sf-awesome-copilot --skill drupal-ddd

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Applies Domain-Driven Design to Drupal 11 custom modules, providing clear domain boundaries and a repository-based persistence pattern to reduce coupling with Drupal's Entity API and to enable richer domain behavior.

Core Features & Use Cases

  • Introduces strategic (bounded contexts, ubiquitous language, context maps) and tactical patterns (value objects, entities, aggregates, domain services, domain events, factories, application services, anti-corruption layers).
  • Enforces the Repository Design Pattern for all entity interactions to separate storage concerns from domain logic.
  • Provides reference material to guide architectural decisions, module organization, and cross-module integration.

Quick Start

Read repository-pattern.md and start applying the repository pattern in your Drupal modules.

Frequently Asked Questions about drupal-ddd

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

FAQPage Schema
How do I apply Domain-Driven Design patterns to Drupal custom modules?

Apply Domain-Driven Design to Drupal custom modules by structuring code around bounded contexts, aggregates, and value objects. This separates domain logic from storage concerns using a repository pattern to reduce coupling with Drupal's Entity API.

What is the repository pattern in Drupal and when should I use it?

The repository pattern in Drupal separates storage concerns from domain logic by enforcing repository interfaces for all entity interactions. Use it when you need clear domain boundaries, improved testability, and reduced direct coupling with Drupal's Entity API.

How do I structure bounded contexts and aggregates across Drupal's Entity API?

Structure bounded contexts and aggregates by defining clear module boundaries and using tactical DDD patterns like factories and domain services. This isolates domain behavior from Drupal's Entity API through anti-corruption layers.

Can I refactor existing Drupal modules to use domain events and value objects?

Yes, you can refactor existing Drupal modules to use domain events and value objects. The approach applies to both new module boundaries and refactors where clear domain boundaries, repositories, and aggregates are desired.

What is the best way to decouple domain logic from Drupal's Entity API?

The best way to decouple domain logic from Drupal's Entity API is enforcing the Repository Design Pattern for all entity interactions. This separates storage concerns and enables richer domain behavior within bounded contexts.

Do I need an anti-corruption layer when integrating domain-driven design in Drupal?

You need an anti-corruption layer when integrating domain-driven design in Drupal to prevent external subsystem concepts from polluting your bounded contexts. It translates external models into your ubiquitous language.