Przejdź do treści
Biblioteka skilli
Programowanie · Budowanie i kod

ddd-aggregate-generator

/ddd-aggregate-generator

Generuje klocki Domain-Driven Design w C#: agregaty, encje, obiekty wartości, zdarzenia domenowe i metody fabrykujące chroniące niezmienniki.

Licencja
MIT
Ostatnia zmiana repozytorium
09.08.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
2
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 09.08.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Generuje klocki Domain-Driven Design w C#: agregaty, encje, obiekty wartości, zdarzenia domenowe i metody fabrykujące chroniące niezmienniki.

Wyzwalacze z opisu

how do I model this domain / build an aggregate root
Oryginalny opis (EN)

Generate Domain-Driven Design building blocks in C# — aggregates, entities, value objects, domain events, and invariant-protecting factory methods. Use this skill whenever the user wants a DDD aggregate, value object, domain event, rich domain model, bounded context structure, encapsulated invariants, or asks "how do I model this domain / build an aggregate root". Always use this skill for DDD modeling requests; it generates a rich, encapsulated model rather than anemic setters.

Jak działa

  1. Input — point it at your project
  2. Aggregate root (invariants protected)
  3. Value object
  4. Domain events
  5. Principles
  6. How to use it & best prompts
Sekcje z nagłówków SKILL.md, w oryginale · 62 linii, 359 słów
Podgląd SKILL.md
---
name: ddd-aggregate-generator
description: Generate Domain-Driven Design building blocks in C# — aggregates, entities, value objects, domain events, and invariant-protecting factory methods. Use this skill whenever the user wants a DDD aggregate, value object, domain event, rich domain model, bounded context structure, encapsulated invariants, or asks "how do I model this domain / build an aggregate root". Always use this skill for DDD modeling requests; it generates a rich, encapsulated model rather than anemic setters.
category: Architecture
version: 1.0.0
---

# DDD Aggregate Generator

Model a domain with proper DDD building blocks: an aggregate root that protects its invariants, value objects for concepts, and domain events — no anemic bags of public setters.

## Input — point it at your project
Works on a target: a **file**, **folder**, **project/solution**, or **GitHub URL**. If a domain layer exists, match its base types (`Entity`, `AggregateRoot`, `ValueObject`). Detect with: `grep -rn "AggregateRoot\|ValueObject\|: Entity\|IDomainEvent" --include=*.cs <target>`.

## Aggregate root (invariants protected)
```csharp
public sealed class Order : AggregateRoot
{
    private readonly List<OrderLine> _lines = new();
    public IReadOnlyList<OrderLine> Lines => _lines.AsReadOnly();
    public OrderStatus Status { get; private set; }
    public Money Total { get; private set; }

    private Order() { }                              // EF

    public static Result<Order> Create(CustomerId customer, IEnumerable<OrderLine> lines)
    {
        var list = lines.ToList();
        if (list.Count == 0) return Error.Validation("Order needs at least one line");
        var order = new Order { Status = OrderStatus.Pending };
        order._lines.AddRange(list);
        order.Total = Money.Sum(list.Select(l => l.LineTotal));
        order.Raise(new OrderCreated(order.Id));     // domain event
        return order;
    }

    public Result Confirm()
    {
        if (Status != OrderStatus.Pending) return Error.Conflict("Only pending orders can be confirmed");
        Status = OrderStatus.Confirmed;
        Raise(new OrderConfirmed(Id));
        return Result.Success();
    }
}
```

## Value object
```csharp
public sealed record Money(decimal Amount, string Currency)
{
    public static Money Sum(IEnumerable<Money> items) { /* guard same currency */ }
    public static implicit operator decimal(Money m) => m.Amount;
}
```
Records give value equality for free; add guards in the constructor.

## Domain events
Raised inside the aggregate (`Raise(...)`), collected on the base type, dispatched after `SaveChanges` (outbox or MediatR). Keep events immutable and past-tense.

## Principles
- **Encapsulate invariants in the aggregate** — no public setters that let outsiders break rules. Mutate through intention-revealing methods.
- **The aggregate is the consistency boundary** — reference other aggregates by id, not by navigation.
- **Value objects for concepts** (Money, Email, DateRange), not primitives everywhere.
- Don't model anemically (logic in services, data in entities) — but also don't over-DDD a simple CRUD table.

## How to use it & best prompts
"Model an Order aggregate with these rules", "turn this anemic entity into a rich aggregate", "extract Money/Email value objects", "add domain events for order lifecycle".
Pliki w paczce (2)
  • SKILL.md 3 KB
  • USAGE.md 1 KB

Wersje

W bazie nie ma innych skilli o nazwie ddd-aggregate-generator.

Migawka bazy z 28.10.2026 · wersja paczki 7284120d9d9f (skrót SHA-256 całej paczki)

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100domain-model
    Tworzy lub recenzuje model domeny: bounded contexts, encje, value objects, agregaty, zdarzenia domenowe i relacje.
  • 100tactical-ddd
    Wykrywa anemiczne modele domenowe, waliduje je i refaktoryzuje do bogatych modeli oraz wymusza wzorce taktycznego DDD: encje, obiekty wartości, agregaty, serwisy domenowe i zdarzenia domenowe.
  • 100domain-driven-design
    Pomaga modelować domenę w Symfony: agregaty, encje, value objects, zdarzenia domenowe, repozytoria i język wszechobecny.
  • 100ddd
    Opisuje wzorce Domain-Driven Design: konteksty ograniczone, agregaty, encje, obiekty wartości, zdarzenia domenowe, repozytoria i serwisy aplikacyjne w strategicznym oraz taktycznym ujęciu.
  • 100domain-driven-design
    Doradza przy architekturze i implementacji Domain-Driven Design: konteksty ograniczone, modele domenowe, wybór między modularnym monolitem a mikroserwisami, agregaty, encje, obiekty wartości i event storming.
  • 95domain-driven-design
    Opisuje wzorce Domain-Driven Design w TypeScript: język wszechobecny, value objects, encje, agregaty, zdarzenia domenowe, serwisy domenowe i bounded contexts.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.