pattern-factory-method
CommunityDecouple object creation with flexible factories
Software Engineering#typescript#domain-driven-design#code-refactor#factory-method#object-creation#creational-pattern
Authorjohnnystefan
Version1.0.0
Installs0
System Documentation
What problem does it solve?
This Skill teaches the Factory Method pattern to separate concrete class instantiation from clients, preventing rigid dependencies when domain objects like BusinessUnit or Membership require validation before creation.
Core Features & Use Cases
- Direct instantiation detection: Highlights spots with
new ConcreteClass()calls that should be routed through a creator. - Product interface definition: Ensures all products implement a shared contract so callers can remain agnostic to concrete types.
- Concrete creators: Builds subclasses that override the factory method to return specific domain entities while encapsulating construction logic.
Quick Start
Ask the skill to refactor Membership.create() so the domain entity is produced through a Factory Method that validates invariants first.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: pattern-factory-method Download link: https://github.com/johnnystefan/test-saas-business/archive/main.zip#pattern-factory-method Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.