home / skills / partme-ai / full-stack-skills / ddd-cola

ddd-cola skill

/skills/ddd-cola

This skill guides you through COLA architecture, enabling structured project design, layering, and domain-driven development using adapter, application,

npx playbooks add skill partme-ai/full-stack-skills --skill ddd-cola

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
911 B
---
name: ddd-cola
description: Provides comprehensive guidance for COLA architecture including adapter layer, application layer, domain layer, and infrastructure layer. Use when the user asks about COLA, needs to implement COLA architecture, structure applications with COLA, or work with COLA patterns.
license: Complete terms in LICENSE.txt
---

## When to use this skill

Use this skill whenever the user wants to:
- [待完善:根据具体工具添加使用场景]
- 使用 COLA 架构框架进行项目开发
- 应用 COLA 的分层架构模式
- 实现基于 COLA 的领域驱动设计

## How to use this skill

[待完善:根据具体工具添加使用指南]

## Best Practices

[待完善:根据具体工具添加最佳实践]

## Keywords

[待完善:根据具体工具添加关键词]
cola, cola architecture, clean object-oriented layered architecture, 分层架构, COLA 框架, DDD COLA

Overview

This skill provides comprehensive guidance for implementing COLA (Clean Object-oriented Layered Architecture) across adapter, application, domain, and infrastructure layers. It explains responsibilities, boundaries, and interaction patterns so you can structure maintainable, testable systems. Practical advice covers folder layout, dependency rules, DTOs, use cases, and mapping strategies.

How this skill works

The skill inspects your design decisions and maps them to COLA principles: clear separation of concerns, dependency inversion, and single-responsibility components. It helps you define use-case boundaries in the application layer, model domain entities and aggregates, design adapter interfaces, and choose infrastructure implementations (DB, messaging, external APIs). It also offers templates, example code snippets, and migration steps to refactor monoliths into COLA-style layers.

When to use it

  • Starting a new project where maintainability and testability are priorities
  • Refactoring a monolith to enforce clear domain boundaries and reduce coupling
  • Designing backend services that must evolve independently (different deploy cycles)
  • Implementing DDD patterns with application-level use cases and pure domain logic
  • Integrating external systems while isolating infrastructure concerns behind adapters

Best practices

  • Keep domain layer free of framework and I/O dependencies; express business rules as pure objects
  • Model use cases in the application layer as thin orchestrators that call domain operations and adapters
  • Define adapter interfaces and depend on abstractions; inject concrete infrastructure implementations at composition root
  • Use DTOs or command objects at the adapter boundary to decouple transport from domain models
  • Write tests by focusing on domain and application logic; mock adapters and infrastructure
  • Document layer responsibilities and enforce dependency rules with code reviews or static checks

Example use cases

  • Build a payments service: domain models for payment rules, application use cases for workflows, adapters for gateways, and infra for persistence
  • Migrate legacy order processing to COLA: extract domain logic, create use-case services, and replace direct DB calls with repository adapters
  • Create an authentication module: domain policies for credentials, application flows for login, adapters for OAuth, and infra for token store
  • Design a microservice that communicates with external APIs using adapter patterns to make integration replaceable

FAQ

Is COLA the same as classic layered architecture?

COLA emphasizes strict dependency direction and richer domain modeling; it layers responsibilities like classic layering but enforces domain purity and use-case driven application layer.

Where should validation live?

Put business validation in the domain layer and input/format validation in adapters or the application layer to keep domain rules central.

How do I start refactoring to COLA?

Identify domain boundaries, extract pure domain logic first, create application use-case services, then introduce adapter interfaces and replace direct infrastructure calls gradually.