File contents DDD Architecture Skill
Description
ドメイン駆動設計(DDD)に準拠したバックエンドコードを書くためのスキルです。
Automatic Activation
このスキルは以下のファイルを編集する際に自動で適用されます:
backend/src/domain/**/*.ts - エンティティ、リポジトリIF
backend/src/application/**/*.ts - ユースケース、DTO、サービス
backend/src/infrastructure/**/*.ts - DynamoDB実装、マッパー
backend/src/presentation/**/*.ts - コントローラー、ルート
backend/src/container/**/*.ts - DIコンテナ
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
新機能追加時は以下を全て実装:
Naming Conventions
種類
命名規則
例
エンティティ
PascalCase
Order, MenuItem
リポジトリIF
PascalCase + Repository
OrderRepository
リポジトリ実装
DynamoDB + PascalCase + Repository
DynamoDBOrderRepository
ユースケース
PascalCase + UseCase
CreateOrderUseCase
コントローラー
PascalCase + Controller
OrderController
ルート
camelCase + Routes
orderRoutes
DTO
PascalCase + Dto
CreateOrderDto
1 --- 2 name: ddd-architecture-3 3 description: DDD Architecture Skill 4 --- 5 6 # DDD Architecture Skill 7 8 ## Description 9 ドメイン駆動設計(DDD)に準拠したバックエンドコードを書くためのスキルです。 10 11 ## Automatic Activation 12 このスキルは以下のファイルを編集する際に自動で適用されます: 13 - `backend/src/domain/**/*.ts` - エンティティ、リポジトリIF 14 - `backend/src/application/**/*.ts` - ユースケース、DTO、サービス 15 - `backend/src/infrastructure/**/*.ts` - DynamoDB実装、マッパー 16 - `backend/src/presentation/**/*.ts` - コントローラー、ルート 17 - `backend/src/container/**/*.ts` - DIコンテナ 18 19 ## Architecture Layers 20 21 ``` 22 Presentation Layer (コントローラー、ルート) 23 ↓ 24 Application Layer (ユースケース、アプリケーションサービス) 25 ↓ 26 Domain Layer (エンティティ、リポジトリインターフェース) 27 ↑ 28 Infrastructure Layer (DynamoDBリポジトリ実装) 29 ``` 30 31 ## Directory Structure 32 33 ``` 34 backend/src/ 35 ├── domain/ 36 │ ├── entities/{feature}/ # エンティティ定義 37 │ └── repositories/{feature}/ # リポジトリインターフェース 38 ├── application/ 39 │ ├── dto/{feature}/ # Data Transfer Objects 40 │ ├── usecases/{feature}/ # ユースケース 41 │ └── services/{feature}/ # アプリケーションサービス 42 ├── infrastructure/ 43 │ ├── repositories/{feature}/ # DynamoDB実装 44 │ └── mappers/{feature}/ # エンティティ⇔DBマッパー 45 └── presentation/ 46 ├── controllers/{feature}/ # コントローラー 47 └── routes/{feature}/ # ルーティング 48 ``` 49 50 ## Implementation Rules 51 52 ### 1. Domain Layer 53 - エンティティはビジネスロジックを持つ 54 - リポジトリはインターフェースのみ定義 55 - 外部依存を持たない 56 57 ### 2. Application Layer 58 - ユースケースは1つの操作を表す 59 - DTOで入出力を定義 60 - ドメインオブジェクトを操作 61 62 ### 3. Infrastructure Layer 63 - リポジトリインターフェースを実装 64 - DynamoDBとの通信を担当 65 - マッパーでエンティティ変換 66 67 ### 4. Presentation Layer 68 - HTTPリクエスト/レスポンスを処理 69 - 認証・認可のミドルウェア適用 70 - Swagger定義も更新 71 72 ## New Feature Checklist 73 74 新機能追加時は以下を全て実装: 75 76 - [ ] `domain/entities/{feature}/{Feature}.ts` 77 - [ ] `domain/repositories/{feature}/{Feature}Repository.ts` 78 - [ ] `application/dto/{feature}/{Feature}Dto.ts` 79 - [ ] `application/usecases/{feature}/{Feature}UseCase.ts` 80 - [ ] `infrastructure/repositories/{feature}/DynamoDB{Feature}Repository.ts` 81 - [ ] `infrastructure/mappers/{feature}/{Feature}Mapper.ts` 82 - [ ] `presentation/controllers/{feature}/{Feature}Controller.ts` 83 - [ ] `presentation/routes/{feature}/{feature}Routes.ts` 84 - [ ] `container/Container.ts` にDI登録 85 - [ ] `server.ts` にルート追加 86 - [ ] `config/swagger.ts` にAPI定義追加 87 88 ## Naming Conventions 89 90 | 種類 | 命名規則 | 例 | 91 |-----|---------|-----| 92 | エンティティ | PascalCase | `Order`, `MenuItem` | 93 | リポジトリIF | PascalCase + Repository | `OrderRepository` | 94 | リポジトリ実装 | DynamoDB + PascalCase + Repository | `DynamoDBOrderRepository` | 95 | ユースケース | PascalCase + UseCase | `CreateOrderUseCase` | 96 | コントローラー | PascalCase + Controller | `OrderController` | 97 | ルート | camelCase + Routes | `orderRoutes` | 98 | DTO | PascalCase + Dto | `CreateOrderDto` |
majiayu000/claude-skill-registry-data/tree/main/data/ddd-architecture commit a9484c2aa1
Frequently asked questions How do I install the Ddd Architecture skill? Run npx skillmds@latest add majiayu000/ddd-architecture-3 in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Ddd Architecture skill do? DDD Architecture Skill It is listed under Coding & Dev Tools on SkillMD.
Is Ddd Architecture safe to use? This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. Capability flags: docs only. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Ddd Architecture? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Ddd Architecture free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Ddd Architecture? majiayu000 (@majiayu000) published this skill. Their other Agent Skills are listed on their SkillMD profile.