domain-application-separation

Separate domain logic from application orchestration in ClojureScript re-frame projects.

Updated Aug 25, 2024
One-click install
npx skills add https://github.com/Kaspazza/doom-config --skill domain-application-separation
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: domain-application-separation
Source: https://github.com/Kaspazza/doom-config/tree/main/eca/skills/domain-application-separation
Command: npx skills add https://github.com/Kaspazza/doom-config --skill domain-application-separation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

In large CLJS/re-frame projects, domain business logic often gets entangled with UI orchestration, making refactors risky and testing harder. This guide helps you establish a clear boundary so domain code remains framework-agnostic and application code handles UI wiring.

Core Features & Use Cases

  • Defines how to place pure business logic (domain) separately from framework-specific orchestration (application) in ClojureScript apps.
  • Provides patterns for migrating functions, data schemas, and transformations into domain namespaces while leaving UI wiring in application namespaces.
  • Useful during feature refactors, architecture reviews, or when adding new pages to a re-frame app.

Quick Start

Refactor a CLJS/re-frame project by moving pure domain functions and data definitions to domain namespaces while keeping UI wiring in application namespaces.

Frequently Asked Questions about domain-application-separation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I separate domain logic from UI orchestration in ClojureScript re-frame?

To separate domain logic from UI orchestration in ClojureScript, move pure business functions and data schemas into domain namespaces while leaving framework-specific UI wiring in the application layer. This enforces domain purity and keeps application code handling UI.

What is domain purity in clean-code architecture?

Domain purity in clean-code architecture means business logic namespaces contain no framework-specific orchestration or UI wiring. Domain functions operate only on pure data transformations, making them framework-agnostic and independently testable.

When should I refactor re-frame namespaces during architecture reviews?

You should refactor re-frame namespaces during architecture reviews when domain business logic becomes entangled with UI orchestration, making testing harder and refactors risky. Splitting them enforces a clear boundary between pure logic and application layer.

Does this domain separation approach work for adding new pages in re-frame apps?

Yes, this domain separation approach works when adding new pages in re-frame apps. It provides patterns to place pure domain functions and data definitions separately from application namespaces, ensuring UI wiring stays isolated from the start.

What is the best way to migrate functions into domain namespaces in ClojureScript?

The best way to migrate functions into domain namespaces in ClojureScript is to move pure business logic and data transformations while leaving UI enrichment and framework-specific orchestration in application namespaces. This maintains a strict architectural boundary.

Why does mixing business logic with UI wiring make refactoring risky in CLJS?

Mixing business logic with UI wiring makes refactoring risky in CLJS because domain code becomes tightly coupled to the framework. This entanglement prevents independent testing and complicates moving functions without breaking application orchestration.