pattern-builder

Orchestrate stepwise builders for complex TypeScript DTOs with optional parameters.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/johnnystefan/test-saas-business --skill pattern-builder
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pattern-builder
Source: https://github.com/johnnystefan/test-saas-business/tree/main/skills/design-patterns/creationals/pattern-builder
Command: npx skills add https://github.com/johnnystefan/test-saas-business --skill pattern-builder

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Eliminates the chaos of telescoping constructors and bloated DTO initialization by guiding you through a controlled, step-by-step builder workflow for complex aggregates.

Core Features & Use Cases

  • Explicit Construction Flow: Defines the builder interface and sequence so every property assignment is deliberate and testable.
  • Multiple Representations: Enables different concrete builders to share the same steps while producing varied domain models or DTOs.
  • Use Case: Apply when composing a reservation or order entity with numerous optional settings, ensuring each configuration path stays readable and maintainable.

Quick Start

Use the skill to define a builder for a membership package with optional equipment, insurance, and coaching add-ons.

Frequently Asked Questions about pattern-builder

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

FAQPage Schema
How do I construct complex TypeScript domain objects with many optional parameters?

To construct complex TypeScript domain objects with many optional parameters, use a stepwise builder workflow. This approach defines explicit builder interfaces and concrete builders to orchestrate property assignments, ensuring each construction step remains deliberate, readable, and testable.

What is the best way to avoid telescoping constructors when initializing rich DTOs?

To avoid telescoping constructors when initializing rich DTOs, implement a fluent interface builder pattern. This pattern guides you through a controlled, step-by-step configuration flow, replacing bloated initializations with explicit and reusable property assignment sequences.

How do I create multiple representations of the same aggregate using a builder pattern?

You can create multiple representations of the same aggregate by defining different concrete builders that share the same construction steps. An optional director class can orchestrate these steps to ensure consistent flows while producing varied domain models from the shared sequence.

Can I use a fluent interface to compose a reservation entity with optional add-ons in TypeScript?

Yes, you can use a fluent interface to compose a reservation entity with optional add-ons like equipment or insurance. The builder pattern applies directly to reservation or order entities, ensuring each configuration path with numerous optional settings stays maintainable.

When should I not use the builder pattern for object construction in TypeScript backend services?

You should not use the builder pattern for simple objects with few or mandatory parameters. The pattern targets rich aggregates and DTOs requiring multiple representations and consistent construction flows; using it for basic initialization introduces unnecessary interface complexity.

Does the builder pattern require a director class to construct domain models in TypeScript?

No, the builder pattern does not require a director class to construct domain models. Director classes are optional and used to orchestrate predefined construction sequences; you can directly invoke concrete builders for explicit, step-by-step object composition.