使用工厂创建对象而不指定具体类。通过定义创建接口,让子类决定实例化哪个类,实现对象创建与使用的解耦。
$npx -y skills add microwind/ai-skills --skill factory-patternInstalls into the current project.
Run `npx skills use "https://github.com/microwind/ai-skills" --skill "microwind/ai-skills/factory-pattern"` and follow the generated skill instructions now. Read its complete output, redirecting it to a temporary file first if necessary. Resolve relative paths from the supporting-files directory it provides.
Use the skills in "https://github.com/microwind/ai-skills" that are relevant to the current task. Run `npx skills add "https://github.com/microwind/ai-skills"` and select the relevant skills, then follow their instructions.