Add or Update Domain

VerifiedSafe

Use this skill when adding or updating a domain in a bounded context. It enforces conventions for command and query classes in the domain/model directory, using sealed interfaces for commands and paginated queries.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude Code
#domain-driven-design#bounded-context#command-query#kotlin#pagination

Recommended for

Automated summary

Adds or updates a domain in a bounded context following a command and query model structure with pagination.

Strengths

  • Clean and consistent structure for commands and queries
  • Supports both cursor and offset pagination
  • Uses sealed classes for type safety

Limitations

  • Kotlin-specific, not language-agnostic
  • Requires strict naming conventions
  • Does not cover advanced use cases like events
When to use it

When adding or modifying a domain in a DDD architecture with a bounded context.

When not to use it

For simple projects without DDD, or if you're using a language other than Kotlin.

Security analysis

Safe
Quality score85/100

This skill is a coding style guide and does not contain any executable commands, destructive actions, or data exfiltration instructions. It is purely informational and poses no security risk.

No concerns found

How this analysis is made

Examples

Add a new Task domain
Add a new domain model for Task with CreateTask, UpdateTask, and DeleteTask commands, and queries for listing tasks by member and week with cursor pagination.
Add query for user by email
Add a query for finding users by email with offset pagination following the pattern in SKILL.md.

name: add-or-update-domain description: Bounded Context에 새로운 도메인을 추가하거나 수정할 때 사용하세요.

Add or Update Domain

Instructions

새로운 도메인을 추가하거나 기존 도메인을 수정할 때 다음 규칙을 따르세요:

1. model 디렉토리

├── domain/
│   ├── model/
│   │   ├── command/
│   │   └── query/

command 에는 생성/수정/삭제를 위한 조건이나 데이터를 표현하는 클래스가 위치합니다.

command 클래스는 마커 인터페이스로 정의하고, 필요한 속성들을 구현체에 정의합니다. 예를 들어:

sealed interface TaskCommand {
    data class CreateTask(
        val title: TaskTitle,
        val description: TaskDescription?,
        val state: TaskState,
        val step: TaskStep,
        val memberId: MemberId,
        val weekId: WeekId,
    ): TaskCommand

    data class UpdateTask(
        val taskId: TaskId,
        val title: TaskTitle,
        val description: TaskDescription?,
    ) : TaskCommand

    data class DeleteTask(
        val taskId: TaskId,
    ) : TaskCommand
}

query 에는 조회를 위한 조건을 표현하는 클래스가 위치합니다.

query 클래스는 반드시 xyz.robinjoon.growweek.common.PageQuery 인터페이스를 구현한 sealed class로 정의하고, 이를 다시 구체적인 클래스가 상속하도록 합니다. 예를 들어:

sealed class TaskQuery(
    override val pageInfo: PageInfo
) : PageQuery {

    object Cursor {
        fun byMemberAndWeek(
            memberId: MemberId,
            weekId: WeekId,
            cursor: String? = null,
            size: Int = 20,
            orderBy: String? = "createdAt"
        ): CursorByMemberAndWeek {
            return CursorByMemberAndWeek(
                memberId = memberId,
                weekId = weekId,
                pageInfo = CursorPageInfo(
                    cursor = cursor,
                    size = size,
                    orderBy = orderBy
                )
            )
        }

        fun byTaskIds(
            taskIds: List<TaskId>,
            cursor: String? = null,
            size: Int = 20,
            orderBy: String? = "createdAt"
        ): CursorByTaskIds {
            return CursorByTaskIds(
                taskIds = taskIds,
                pageInfo = CursorPageInfo(
                    cursor = cursor,
                    size = size,
                    orderBy = orderBy
                )
            )
        }
    }

    object Offset {
        fun byMemberAndWeek(
            memberId: MemberId,
            weekId: WeekId,
            page: Int = 0,
            size: Int = 20,
            orderBy: String? = "createdAt"
        ): OffsetByMemberAndWeek {
            return OffsetByMemberAndWeek(
                memberId = memberId,
                weekId = weekId,
                pageInfo = OffsetPageInfo(
                    page = page,
                    size = size,
                    orderBy = orderBy
                )
            )
        }

        fun byTaskIds(
            taskIds: List<TaskId>,
            page: Int = 0,
            size: Int = 20,
            orderBy: String? = "createdAt"
        ): OffsetByTaskIds {
            return OffsetByTaskIds(
                taskIds = taskIds,
                pageInfo = OffsetPageInfo(
                    page = page,
                    size = size,
                    orderBy = orderBy
                )
            )
        }
    }

    data class CursorByMemberAndWeek(
        val memberId: MemberId,
        val weekId: WeekId,
        override val pageInfo: CursorPageInfo
    ) : TaskQuery(pageInfo) {
        val cursor get() = pageInfo.cursor
        val size get() = pageInfo.size
        val orderBy: String? get() = pageInfo.orderBy
    }

    data class CursorByTaskIds(
        val taskIds: List<TaskId>,
        override val pageInfo: CursorPageInfo
    ) : TaskQuery(pageInfo) {
        val cursor get() = pageInfo.cursor
        val size get() = pageInfo.size
        val orderBy: String? get() = pageInfo.orderBy
    }

    data class OffsetByMemberAndWeek(
        val memberId: MemberId,
        val weekId: WeekId,
        override val pageInfo: OffsetPageInfo
    ) : TaskQuery(pageInfo) {
        val page get() = pageInfo.page
        val size get() = pageInfo.size
        val orderBy: String? get() = pageInfo.orderBy
    }

    data class OffsetByTaskIds(
        val taskIds: List<TaskId>,
        override val pageInfo: OffsetPageInfo
    ) : TaskQuery(pageInfo) {
        val page get() = pageInfo.page
        val size get() = pageInfo.size
        val orderBy: String? get() = pageInfo.orderBy
    }
}

그 외 도메인의 엔티티나 VO 등은 model 디렉토리에 함께 위치시키며 다음 조건을 따릅니다.

  1. 다른 바운디드 컨텍스트에서 사용해야 하는 것들은 common 에 추가합니다.

        @JvmInline
        value class MemberId(val value: Long) {
            init {
                require(value >= 0) { "MemberId must be greater than or equal to 0" }
            }
        }
    
       ├── common /
       │   ├── domain/
       │   │   ├── MemberId.kt/
       {bounded-context}/
       ├── domain/
       │   ├── model/
       │   │   ├── command/
       │   │   └── query/
       │   ├── repository/
       │   └── service/
    
  2. common 을 제외한 다른 바운디드 컨텍스트의 도메인 모델은 참조하지 않도록 합니다.

2. repository 디렉토리

├── domain/
│   ├── model/
│   │   ├── command/
│   │   └── query/
│   ├── repository/

repository 디렉토리에는 도메인 모델에 대한 영속성 인터페이스를 정의합니다. 이때, 반드시 saveAll(List<command>) : List<Domain> , findAll(query) : Page<Domain> 메서드만을 포함합니다. 예를 들어:

interface TaskRepository {
    fun saveAll(commands: List<TaskCommand>): List<Task>
    fun findAll(query: TaskQuery): Page<Task>
}

3. service 디렉토리

├── domain/
│   ├── model/
│   │   ├── command/
│   │   └── query/
│   ├── repository/
│   └── service/

service 디렉토리는 도메인 서비스가 위치합니다. 단, 도메인 서비스는 도메인 서비스 추가 필요성 결정 기준 문서에 따라 신중하게 설계하고 구현해야 합니다.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/add-or-update-domain-mm78no0u/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/add-or-update-domain-mm78no0u' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/add-or-update-domain-mm78no0u/download' --output '.skill-downloads/add-or-update-domain-mm78no0u/SKILL.md.part' && mv '.skill-downloads/add-or-update-domain-mm78no0u/SKILL.md.part' '.skill-downloads/add-or-update-domain-mm78no0u/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/add-or-update-domain-mm78no0u/SKILL.md' && test -s '.skill-downloads/add-or-update-domain-mm78no0u/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/add-or-update-domain' && cp -R '.skill-downloads/add-or-update-domain-mm78no0u' '.claude/skills/add-or-update-domain'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/add-or-update-domain-mm78no0u'

openskills read 'add-or-update-domain-mm78no0u'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/add-or-update-domain-mm78no0u/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills