agentsclimarketplace

Run3 scala fluent builder pattern

Skill cxcscmu/SkillLearnBench/skills/b3-teacher-feedback-gemini-3-flash-preview/python-scala-translation/run3_scala-fluent-builder-pattern

Implement a fluent Builder pattern in Scala to provide a clean API for object configuration and instantiation.From its SKILL.md

Install
npx -y skills add cxcscmu/SkillLearnBench --skill run3_scala-fluent-builder-pattern

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

1.2 KB, 232 tokens by cl100k_base, as published. Nobody here has run it

Fluent Builder Implementation

The TokenizerBuilder should provide a functional and fluent interface.

  1. State Management: The builder can maintain an internal state using a private var (encapsulated) or by returning a new version of the builder case class with updated fields.
  2. Method Chaining: Ensure methods return this.type (for mutable builders) or a new instance of the builder (for immutable builders). This allows the user to chain calls like .withType(...).withModel(...).
  3. The Build Method: Provide a build() method that validates the current state and instantiates the appropriate BaseTokenizer implementation.

Pattern Structure

class TokenizerBuilder {
  private var tokenizerType: String = _
  
  def setType(t: String): this.type = {
    this.tokenizerType = t
    this
  }
  
  def build(): BaseTokenizer = {
    // Logic to return specific implementation based on tokenizerType
  }
}

This pattern provides a clear, type-safe API for constructing complex objects while hiding the instantiation logic of the specific tokenizer subclasses.

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.