一键导入
hexagonal-architecture
Guide for implementing Hexagonal Architecture (Ports and Adapters), detailing layer responsibilities and dependency rules.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Guide for implementing Hexagonal Architecture (Ports and Adapters), detailing layer responsibilities and dependency rules.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Create backend with ElysiaJS, a type-safe, high-performance framework.
Guide for implementing Domain-Driven Design (DDD) in TypeScript, focusing on Entities, Value Objects, Aggregates, and Domain Services.
Guide for using the EDOpro-server-ts repository as a reference for stats calculation and game logic.
基于 SOC 职业分类
| name | hexagonal-architecture |
| description | Guide for implementing Hexagonal Architecture (Ports and Adapters), detailing layer responsibilities and dependency rules. |
This skill guides the implementation of Hexagonal Architecture to ensure clean separation of concerns and testability.
The heart of the application. It contains business logic and rules.
Orchestrates the domain objects to perform specific user tasks (Use Cases).
Contains the implementation of the interfaces defined in the Domain/Application layers and the entry points to the application.
Source Code Dependencies must point only inward, toward the Domain.
Infrastructure -> Application -> Domain
Use Cases orchestrate the flow of data between the User (via DTOs) and the Domain.
Template:
interface CreateOrderDTO {
customerId: string;
items: { productId: string; quantity: number }[];
}
export class CreateOrderUseCase {
constructor(
private readonly orderRepository: OrderRepository,
private readonly customerRepository: CustomerRepository
) {}
public async execute(dto: CreateOrderDTO): Promise<void> {
const customer = await this.customerRepository.findById(dto.customerId);
if (!customer) throw new Error("Customer not found");
const order = new Order(generateId(), customer.id);
// ... logic to add items
await this.orderRepository.save(order);
}
}
Rules:
src/
modules/
[module-name]/
domain/ # Inner Hexagon (Core)
models/
repositories/ (Interfaces)
application/ # Use Cases
use-cases/
dtos/
infrastructure/ # Outer Hexagon (Adapters)
http/
controllers/
routes/
persistence/
repositories/ (Implementations)
mappers/
domain/repositories. Implement it in infrastructure/persistence.