install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/ddd-architecture" ~/.claude/skills/majiayu000-claude-skill-registry-ddd-architecture && rm -rf "$T"
manifest:
skills/data/ddd-architecture/SKILL.mdsource content
DDD Architecture Skill
Description
ドメイン駆動設計(DDD)に準拠したバックエンドコードを書くためのスキルです。
Automatic Activation
このスキルは以下のファイルを編集する際に自動で適用されます:
- エンティティ、リポジトリIFbackend/src/domain/**/*.ts
- ユースケース、DTO、サービスbackend/src/application/**/*.ts
- DynamoDB実装、マッパーbackend/src/infrastructure/**/*.ts
- コントローラー、ルートbackend/src/presentation/**/*.ts
- DIコンテナbackend/src/container/**/*.ts
Architecture Layers
Presentation Layer (コントローラー、ルート) ↓ Application Layer (ユースケース、アプリケーションサービス) ↓ Domain Layer (エンティティ、リポジトリインターフェース) ↑ Infrastructure Layer (DynamoDBリポジトリ実装)
Directory Structure
backend/src/ ├── domain/ │ ├── entities/{feature}/ # エンティティ定義 │ └── repositories/{feature}/ # リポジトリインターフェース ├── application/ │ ├── dto/{feature}/ # Data Transfer Objects │ ├── usecases/{feature}/ # ユースケース │ └── services/{feature}/ # アプリケーションサービス ├── infrastructure/ │ ├── repositories/{feature}/ # DynamoDB実装 │ └── mappers/{feature}/ # エンティティ⇔DBマッパー └── presentation/ ├── controllers/{feature}/ # コントローラー └── routes/{feature}/ # ルーティング
Implementation Rules
1. Domain Layer
- エンティティはビジネスロジックを持つ
- リポジトリはインターフェースのみ定義
- 外部依存を持たない
2. Application Layer
- ユースケースは1つの操作を表す
- DTOで入出力を定義
- ドメインオブジェクトを操作
3. Infrastructure Layer
- リポジトリインターフェースを実装
- DynamoDBとの通信を担当
- マッパーでエンティティ変換
4. Presentation Layer
- HTTPリクエスト/レスポンスを処理
- 認証・認可のミドルウェア適用
- Swagger定義も更新
New Feature Checklist
新機能追加時は以下を全て実装:
-
domain/entities/{feature}/{Feature}.ts -
domain/repositories/{feature}/{Feature}Repository.ts -
application/dto/{feature}/{Feature}Dto.ts -
application/usecases/{feature}/{Feature}UseCase.ts -
infrastructure/repositories/{feature}/DynamoDB{Feature}Repository.ts -
infrastructure/mappers/{feature}/{Feature}Mapper.ts -
presentation/controllers/{feature}/{Feature}Controller.ts -
presentation/routes/{feature}/{feature}Routes.ts -
にDI登録container/Container.ts -
にルート追加server.ts -
にAPI定義追加config/swagger.ts
Naming Conventions
| 種類 | 命名規則 | 例 |
|---|---|---|
| エンティティ | PascalCase | , |
| リポジトリIF | PascalCase + Repository | |
| リポジトリ実装 | DynamoDB + PascalCase + Repository | |
| ユースケース | PascalCase + UseCase | |
| コントローラー | PascalCase + Controller | |
| ルート | camelCase + Routes | |
| DTO | PascalCase + Dto | |