一键导入
ddd-type-duplication-across-layers
// When adding values to any union type in a domains/models/ file
// When adding values to any union type in a domains/models/ file
| name | ddd-type-duplication-across-layers |
| description | When adding values to any union type in a domains/models/ file |
| version | 1.0.0 |
| source | continuous-learning |
| status | approved |
| learned_from | skills/learned/ddd-type-duplication-across-layers.md |
Extracted: 2026-02-23 Context: Angular DDD codebase (gc.webapp) where domain types are duplicated in infrastructure API models
When adding a new value to a domain union type (e.g., CalculationBase), the build breaks because the same type is hardcoded separately in the infrastructure layer (API request/response models). The domain type compiles fine, but the adapter that maps domain models to API requests fails with Type 'X' is not assignable to type 'A' | 'B' | 'C'.
After modifying a domain union type, always search the entire codebase for other occurrences of the same union values:
grep -r "'Value1'.*'Value2'.*'Value3'" src/app/<domain>/
Common locations for duplicated types in this codebase:
domains/models/ - Domain type (primary)infrastructure/api/request/ - API request typesinfrastructure/api/response/ - API response typesdomains/rules/*.spec.ts - Test files with hardcoded arrays// Domain model (updated)
export type CalculationBase = 'AmountExclTax' | 'Hectoliter' | 'Quantity' | 'Kilogram' | 'Liter';
// API request model (forgotten) - build break
export interface CreateTaxRequest {
calculationBase: 'AmountExclTax' | 'Hectoliter' | 'Quantity'; // missing new values!
}
domains/models/ filenpm run build after type changes, proactively grep for all occurrencesUse this skill for any git work such as creating branches, staging changes, writing commit messages, pushing branches, or preparing pull requests. Delegates git execution to the git-specialist agent.
Pre-merge code review for Angular + TypeScript pull requests. Diffs current branch against a target branch, applies Angular-specific checklists (signals, RxJS, clean architecture, flurryx, TS strict), runs lint + tsc, and emits a tiered report (verbose for juniors, terse for seniors). Auto-loads project AGENTS.md rules. Use when user runs /cop-review, says "pre-merge review", "review before merging", "check my PR against <branch>", or invokes the merge-cop agent.
Signal-first reactive state management for Angular. Bridge RxJS streams into cache-aware stores, keyed resources, mirrored state, and replayable history. Use when generating or modifying Angular code that uses flurryx for state management, or when scaffolding new feature modules that follow the flurryx facade pattern.
Automatically extract reusable patterns from OpenCode sessions and save them as learned skills for future use.
evidence-first decision-gating for planning, design, architecture, and refactor requests with unresolved requirements, scope, constraints, facts, or tradeoffs. use when the next safe step is to ask exactly one dependency-safe question before proposing a plan or implementation, especially when critical decisions are not yet closed.
Use when you are adding or updating a codemap generator for a frontend Angular repo.