python-ddd

Structure Python projects with domain, application, and infrastructure layers.

11|1|Updated Feb 9, 2026
One-click install
npx skills add https://github.com/mindcockpit-ai/cognitive-core --skill python-ddd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-ddd
Source: https://github.com/mindcockpit-ai/cognitive-core/tree/main/.claude/skills/python-ddd
Command: npx skills add https://github.com/mindcockpit-ai/cognitive-core --skill python-ddd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Domain-Driven Design guide shows how to structure Python projects with domain, application, and infrastructure layers, enabling clearer boundaries and more maintainable code.

Core Features & Use Cases

  • Aggregates, entities, and value objects as first-class domain concepts with explicit invariants.
  • Domain events, repositories, and an async-friendly CQRS workflow for scalable, testable services.
  • Clear separation between domain logic and infrastructure using a four-layer architecture (domain, application, infrastructure, adapters).

Quick Start

Create a Python domain model using aggregates and value objects, wire up a repository, and emit domain events in an async use case.

Frequently Asked Questions about python-ddd

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

FAQPage Schema
How do I structure a Python project using domain-driven design?

Structure a Python domain-driven design project using a four-layer architecture: domain, application, infrastructure, and adapters. This separation enforces clear boundaries between business logic and infrastructure, ensuring the domain layer remains free of framework dependencies.

Does domain-driven design work with async Python workflows?

Domain-driven design fully supports async Python workflows by utilizing an async-friendly CQRS architecture. This allows scalable and testable services where the application layer coordinates use cases and emits domain events asynchronously.

How do I implement aggregates and value objects in Python?

Implement aggregates and value objects in Python as first-class domain concepts with explicit invariants. Using modern tooling like Pydantic v2, you can enforce strict validation rules and maintain clear boundaries within the domain layer.

Can I use SQLAlchemy 2.0 for repositories in a DDD architecture?

You can use SQLAlchemy 2.0 for repositories in a DDD architecture by placing it strictly in the infrastructure layer. This ensures the domain layer has no framework dependencies while repositories handle data persistence asynchronously.

What is the best way to separate domain logic from infrastructure in Python?

The best way to separate domain logic from infrastructure in Python is by applying a CQRS-oriented architecture with well-defined repositories. This isolates business rules into aggregates and domain events, while the application layer coordinates use cases.

When do I need CQRS in a Python domain-driven design project?

You need CQRS in a Python domain-driven design project when building scalable, testable services with async workflows. It separates read and write operations, allowing the application layer to coordinate use cases and emit domain events efficiently.