본문으로 건너뛰기
Skillpedia
API 및 서버 (백엔드)81k · #1614

ddd-aggregate

하는 일

이 스킬은 기존 모듈 안에 애그리거트(aggregate)의 시작 코드를 만듭니다. 애그리거트는 자체 규칙을 지키는 핵심 비즈니스 객체입니다. 도메인 주도 설계(DDD)를 쓰는 소프트웨어 팀을 위한 스킬입니다.

사용하는 경우

  • ✓기존 모듈에 자체 규칙을 가진 새 비즈니스 개념을 추가할 때.
  • ✓엔티티, 저장소, 이벤트 파일을 함께 만들어야 할 때.
  • ✓새 애그리거트에 맞춰 테스트 스텁을 만들고 싶을 때.

스킬 링크

https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-ddd/skills/ddd-aggregate/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-ddd/skills/ddd-aggregate/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“영업 모듈 안에 ID, 저장소, 이벤트를 포함한 새 Order 애그리거트를 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

스킬은 모듈 폴더가 있는지 확인한 뒤, 규칙이 담긴 엔티티 파일, ID 값 객체, 저장소 인터페이스, 도메인 이벤트 파일, 테스트 스텁을 만듭니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Scaffold a complete aggregate root inside a bounded context.

Parse $ARGUMENTS as <context-name> <aggregate-name> (both kebab-case). The context must already exist under src/.

Steps

  1. Validate: Confirm src/<context>/domain/ exists. If not, suggest running /ddd-context <context> first.

  2. Pre-task hook: npx @claude-flow/cli@latest hooks pre-task --description "DDD aggregate: <aggregate-name> in <context>"

  3. Create aggregate root entity:

    • File: src/<context>/domain/entities/<aggregate-name>.entity.ts
    • Include: unique ID field, constructor with invariant validation, domain methods that enforce business rules, equals() based on identity
    • Export a TypeScript class extending or implementing a base AggregateRoot interface
  4. Create value objects:

    • File: src/<context>/domain/value-objects/<aggregate-name>-id.value-object.ts
    • Include: immutable ID value object with factory method and validation
    • Add additional value objects as properties of the aggregate suggest them
  5. Create repository interface:

    • File: src/<context>/domain/repositories/<aggregate-name>.repository.ts
    • Include: findById, save, delete methods
    • Use the aggregate root and its ID value object as types
    • This is an interface only -- no implementation (infrastructure concern)
  6. Create domain events:

    • File: src/<context>/domain/events/<aggregate-name>-created.event.ts
    • File: src/<context>/domain/events/<aggregate-name>-updated.event.ts
    • Include: event name (past tense), timestamp, aggregate ID, payload
  7. Create unit test stubs:

    • File: src/<context>/domain/entities/<aggregate-name>.entity.test.ts
    • Include: test cases for construction invariants, domain methods, equality
    • Use describe/it with should [behavior] when [condition] names
  8. Update barrel exports: Add new files to the relevant index.ts barrel files.

  9. Store in domain model graph:

    mcp__plugin_ruflo-core_ruflo__agentdb_hierarchical-store({ key: "domain/context-<context>/aggregate-<aggregate-name>", value: "Aggregate <aggregate-name> (parent: context-<context>)", tier: "semantic" })
    mcp__plugin_ruflo-core_ruflo__agentdb_causal-edge({ sourceId: "entity:context-<context>", targetId: "entity:aggregate-<aggregate-name>", relation: "contains" })
    mcp__plugin_ruflo-core_ruflo__memory_store({ key: "ddd-aggregate-<context>-<aggregate-name>", value: "AGGREGATE_SUMMARY", namespace: "tasks" })
    
  10. Post-task hook: npx @claude-flow/cli@latest hooks post-task --task-id "ddd-aggregate-<aggregate-name>" --success true

자주 묻는 질문

사용하기 전에 무엇이 있어야 하나요?

소스 폴더 아래에 바운디드 컨텍스트 폴더가 이미 있어야 합니다. 없으면 스킬이 먼저 컨텍스트를 만들라고 제안합니다.

저장소 저장 코드도 작성하나요?

아닙니다. 저장소는 인터페이스일 뿐이며, 저장 코드는 인프라 계층에 맡겨집니다.

어떤 언어로 작성하나요?

TypeScript 파일을 작성하며, 바운디드 컨텍스트의 폴더와 이름 규칙을 따릅니다.

상세 정보

작성자의 원본 설명

Scaffold an aggregate root with entity, value objects, repository interface, domain events, and test stubs. Use when adding a new aggregate to an existing bounded context, modeling a new business concept that owns invariants, or generating the boilerplate for an entity + repo + events triplet.

repo: ruvnet/ruflo

인기도

GitHub 스타
81k
순위
#1614
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬