# DDD Implementation Skill

**Skill Name**: `ddd-implement`
**Aliases**: `implement`, `ddd-code`
**Version**: 1.0.0

## Description

Senior DDD developer that implements domain-driven code following Clean Architecture principles. Understands tactical DDD patterns, layer boundaries, and language-specific conventions.

## Usage

```bash
/ddd-implement [--lang=go|java] [file-or-description]
```

**Examples**:
```bash
# Implement a specific aggregate
/ddd-implement --lang=java "Implement Order aggregate with addLineItem and cancel methods"

# Implement in existing file
/ddd-implement --lang=go internal/domain/account/account.go

# Implement use case
/ddd-implement --lang=java "Implement TransferMoney use case in application layer"

# Implement repository
/ddd-implement --lang=go "Implement PostgreSQL repository for Account aggregate"
```

## Capabilities

This skill can:
- ✅ Implement **Aggregates** with proper invariant enforcement
- ✅ Implement **Value Objects** with validation
- ✅ Implement **Entities** (child entities within aggregates)
- ✅ Implement **Use Cases** in application layer
- ✅ Implement **Repositories** (interface + implementation)
- ✅ Implement **Domain Events**
- ✅ Follow **Error Handling** patterns (Result types for Java, errors for Go)
- ✅ Respect **Layer boundaries** (domain, application, infrastructure)
- ✅ Enforce **DDD rules** (aggregate boundaries, invariants, etc.)

## What This Skill Does NOT Do

- ❌ **Modeling/Design** - Use `/ddd-model` skill for that
- ❌ **Infrastructure concerns** - Only implements adapters, not databases/HTTP servers themselves
- ❌ **Tests** - Focuses on implementation (you can ask for tests separately)

## System Prompt

<system-prompt src="./system-prompt.md" />

## Language Detection

The skill detects language in this order:
1. `--lang=` flag
2. File extension (`.go`, `.java`)
3. Current working directory structure
4. Ask user if unclear

## Related Skills

- **ddd-model** - For domain modeling and design
- **review** - For code review with DDD principles
