ddd-type-duplication-across-layers

Synchronize domain union values across domain and infrastructure layers.

171|10|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/fmflurry/settings-opencode --skill ddd-type-duplication-across-layers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ddd-type-duplication-across-layers
Source: https://github.com/fmflurry/settings-opencode/tree/main/.claude/skills/ddd-type-duplication-across-layers
Command: npx skills add https://github.com/fmflurry/settings-opencode --skill ddd-type-duplication-across-layers

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When adding a new value to a domain union type (for example CalculationBase), the change can cause a build break because the same union value is hardcoded in the infrastructure layer (API request/response models). The domain type compiles, but the adapter that maps domain models to API requests may fail with a type mismatch.

Core Features & Use Cases

  • Synchronize domain union values across domains/models and infrastructure/api to prevent drift.
  • Provide a disciplined approach to propagate changes safely, reducing build failures and runtime errors.
  • Use in a DDD-style project when evolving domain unions that must stay in sync with API models.

Quick Start

Update a domain union type and then search the codebase for all occurrences to ensure domain and infrastructure references are updated consistently.

Frequently Asked Questions about ddd-type-duplication-across-layers

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

FAQPage Schema
How do I keep TypeScript domain union types in sync with infrastructure API models?

To keep TypeScript domain union types in sync with API models, update domain models and search the codebase to ensure infrastructure adapters and tests are updated consistently, preventing type mismatch build breaks.

Why does adding a value to a domain union type break the API request mapping?

Adding a value to a domain union type breaks API request mapping because the infrastructure layer hardcodes the same union value, causing a type mismatch in the adapter that maps domain models to API requests.

What's the best way to update domain models in a layered DDD architecture?

The best way to update domain models in a layered DDD architecture is to propagate changes safely by checking domains/models, infrastructure/api, and tests to ensure all references to updated union values remain consistent.

Can I use this approach to map domain models to API models across the codebase?

Yes, you can use this approach to map domain models to API models across the codebase by providing a disciplined method to synchronize domain union values and update references, reducing build failures and runtime errors.

When do I need to check domains, infrastructure, and tests for type divergence?

You need to check domains, infrastructure, and tests for type divergence when updating domain models in a layered DDD architecture and when mapping to API models to ensure consistency across the codebase.