一键导入
layered-architecture
Layered architecture patterns for separating presentation, application, domain, and data layers.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Layered architecture patterns for separating presentation, application, domain, and data layers.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | layered-architecture |
| description | Layered architecture patterns for separating presentation, application, domain, and data layers. |
| origin | FlowDeck |
When building traditional monolithic or client-server applications where clear vertical separation of concerns improves maintainability (e.g., MVC applications, REST APIs, data-driven apps).
// Presentation Layer - Controllers/Handlers
class OrderController {
constructor(private readonly orderService: OrderService) {}
async createOrder(req: Request, res: Response): Promise<void> {
const order = await this.orderService.createOrder(req.body)
res.status(201).json(order)
}
}
// Business Logic Layer - Services
class OrderService {
constructor(
private readonly orderRepository: OrderRepository,
private readonly paymentGateway: PaymentGateway
) {}
async createOrder(data: CreateOrderDto): Promise<Order> {
const order = new Order(data.items)
if (data.paymentMethod === 'prepaid') {
await this.paymentGateway.charge(order.total, data.paymentToken)
}
return this.orderRepository.save(order)
}
}
// Data Access Layer - Repositories
interface OrderRepository {
save(order: Order): Promise<void>
findById(id: string): Promise<Order | null>
findByCustomer(customerId: string): Promise<Order[]>
}
class PostgresOrderRepository implements OrderRepository {
constructor(private readonly db: Database) {}
async save(order: Order): Promise<void> {
await this.db.query('INSERT INTO orders (...) VALUES (...)', order.toDbFormat())
}
}
Optimize token usage and context window discipline. Reduce costs and improve response quality through smart context management.
Unified context lifecycle for FlowDeck sessions — ingest, filter, prune, protect, summarize, and persist with telemetry.
Predict affected files, modules, APIs, tests, and DB paths before changes. Returns an impact map for human review.
Map architecture, conventions, and file structure into `.codebase/`. Use when onboarding or before deep feature work.
Plan differently when the agent has low certainty — ask for clarification or narrow scope instead of pretending full understanding.
Protect critical context from pruning during compaction. Preserve active plans, safety files, pending operations, and user intent anchors.