Implements the companion object pattern to group domain logic and interfaces for cleaner, reusable TypeScript code.
This skill automates and guides the implementation of the Entity Object (Companion Object) pattern in TypeScript projects. By grouping domain logic functions within a constant object sharing the same name as an interface, it creates a single source of truth for business rules that can be shared across UI components, API services, and unit tests. It provides a structured, layered approach to categorizing logic—from basic state checks to complex composite behaviors—ensuring high cohesion and reducing logic duplication during the TDD refactoring phase.
主な機能
01Companion object pattern implementation with name-matched interfaces and constants
02Standardized naming conventions for domain functions including is*, get*, can*, and should*
03Systematic extraction of domain logic from TDD Given/When/Then scenarios
04Layered logic architecture (Base, Derived, and Composite layers) to prevent circular dependencies
050 GitHub stars
06Cross-layer reusability for UI rendering, API request building, and unit testing
ユースケース
01Synchronizing validation and business rules between frontend UI and backend services
02Refactoring scattered domain logic into reusable, testable entity objects during TDD
03Establishing a consistent pattern for Domain-Driven Design (DDD) in TypeScript projects