dykyi-roman/awesome-claude-code/create-builder

Trust tier 2
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Generates Builder pattern for PHP 8.4. Creates step-by-step object construction with fluent interface and validation. Includes unit tests.

Install

npx vskill@latest install dykyi-roman/awesome-claude-code/create-builder

SKILL.md

Builder Pattern Generator

Creates Builder pattern infrastructure for step-by-step construction of complex objects.

When to Use

ScenarioExample
Many constructor parametersOrder with 10+ fields
Optional parametersEmail with optional CC, BCC
Complex validationBuild-time validation
Step-by-step constructionQuery building
Multiple representationsDifferent order types

Component Characteristics

Builder Interface
  • Defines building steps
  • Returns self for fluent interface
  • Has build() method for final product
Concrete Builder
  • Implements building steps
  • Maintains product state
  • Validates before building
Director (Optional)
  • Defines construction order
  • Reusable build sequences
  • Hides complexity from client

Generation Process

Step 1: Analyze Requirements

Determine:

  • Target product class
  • Required vs optional properties
  • Validation rules
  • Whether Director is needed
Step 2: Generate Builder Components

Path: src/Domain/{BoundedContext}/Builder/

  1. {Name}BuilderInterface.php — Builder contract
  2. {Name}Builder.php — Concrete builder implementation
  3. BuilderValidationException.php — Validation exception
  4. {Name}Director.php — Optional director for common builds
Step 3: Generate Tests

Path: tests/Unit/Domain/{BoundedContext}/Builder/

  1. {Name}BuilderTest.php — Builder functionality tests

File Placement

ComponentPath
Builder Interfacesrc/Domain/{BoundedContext}/Builder/
Concrete Buildersrc/Domain/{BoundedContext}/Builder/
Directorsrc/Domain/{BoundedContext}/Builder/
Exceptionsrc/Domain/{BoundedContext}/Builder/
Unit Teststests/Unit/Domain/{BoundedContext}/Builder/

Naming Conventions

ComponentPatternExample
Interface{Name}BuilderInterfaceOrderBuilderInterface
Concrete Builder{Name}BuilderOrderBuilder
Director{Name}DirectorOrderDirector
ExceptionBuilderValidationExceptionBuilderValidationException
Test{ClassName}TestOrderBuilderTest

Quick Template Reference

Builder Interface
php
interface {Name}BuilderInterface
{
public function with{Property1}({Type1} $value): self;
public function with{Property2}({Type2} $value): self;
public function build(): {Product};
public function reset(): self;
}
Concrete Builder
php
final class {Name}Builder implements {Name}BuilderInterface
{
private ?{Type1} ${property1} = null;
private ?{Type2} ${property2} = null;
private array $errors = [];
public function with{Property1}({Type1} $value): self
{
$this->{property1} = $value;
return $this;
}
public function build(): {Product}
{
$this->validate();
if ($this->errors !== []) {
throw new BuilderValidationException($this->errors);
}
return new {Product}(...);
}
public function reset(): self
{
$this->{property1} = null;
$this->errors = [];
return $this;
}
}
Director
php
final readonly class {Name}Director
{
public function __construct(private {Name}BuilderInterface $builder) {}
public function buildMinimal{Name}(/* required params */): {Product}
{
return $this->builder
->reset()
->with{Required1}($value1)
->build();
}
public function buildFull{Name}(/* all params */): {Product}
{
return $this->builder
->reset()
->with{Property1}($value1)
->with{Property2}($value2)
->build();
}
}

Usage Example

php
// Direct builder usage
$order = (new OrderBuilder())
->forCustomer($customerId)
->withShippingAddress($address)
->addItem($item1)
->addItem($item2)
->withDiscountCode('SAVE10')
->build();
// Using Director
$director = new OrderDirector(new OrderBuilder());
$minimalOrder = $director->buildMinimalOrder($customerId, $address, $item);
$giftOrder = $director->buildGiftOrder($customerId, $shipping, $billing, $items, 'Happy Birthday!');

Anti-patterns to Avoid

Anti-patternProblemSolution
No ValidationInvalid objects builtValidate in build()
Mutable ProductProduct can change after buildReturn immutable objects
Missing ResetBuilder state persistsAdd reset() method
Too Many StepsHard to useUse Director or defaults
No Fluent InterfaceVerbose client codeReturn self from setters

References

For complete PHP templates and examples, see:

  • references/templates.md — Builder, QueryBuilder templates
  • references/examples.md — OrderBuilder, EmailBuilder examples and tests

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
96
Repository forks
25
7-day trend score
23

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 Mar 2026, 7 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/dykyi-roman/awesome-claude-code/create-builder/badge)](https://verified-skill.com/skills/dykyi-roman/awesome-claude-code/create-builder)

Something wrong with this skill or its page? Tell us.