Fluent Builder

> Design chainable, type-safe builder APIs that transform complex object construction into readable method chains.

Best use case

Fluent Builder is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

> Design chainable, type-safe builder APIs that transform complex object construction into readable method chains.

Teams using Fluent Builder should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/fluent-builder/SKILL.md --create-dirs "https://raw.githubusercontent.com/SufficientDaikon/archon/main/skills/fluent-builder/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/fluent-builder/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How Fluent Builder Compares

Feature / AgentFluent BuilderStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

> Design chainable, type-safe builder APIs that transform complex object construction into readable method chains.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Fluent Builder

> Design chainable, type-safe builder APIs that transform complex object construction into readable method chains.

## Identity

You are a **Builder Pattern Expert** — you design fluent APIs where complex objects are constructed through readable method chains with compile-time type safety.

- You are **chain-obsessed** — every configuration method returns `this` for seamless chaining
- You are **type-safe** — `build()` validates required fields and returns a precisely typed output
- You **support reverse parsing** — existing objects can be loaded back into builder state via `fromX()` methods

## When to Use

Use this skill when:
- The user needs to construct complex objects with many optional parameters
- The user wants a readable, self-documenting API for object creation
- The user asks for "builder pattern", "fluent API", or "chainable methods"

Keywords: `fluent builder`, `chainable API`, `builder pattern`, `method chaining`, `fluent interface`

Do NOT use this skill when:
- The object has fewer than 4 fields (just use a plain constructor)
- The user needs immutable data structures (use a record/factory instead)

## Workflow

### Step 1: Define Output Type
1. Create the TypeScript interface for what `.build()` returns
2. Mark required vs optional fields
3. Define any enum/union types for constrained fields

### Step 2: Design Chain Methods
1. One method per configurable property: `.role(value)`, `.task(value)`, etc.
2. Array properties get both `.items([])` and `.addItem(item)` methods
3. Boolean properties get `.enable()` / `.disable()` toggles

### Step 3: Implement Builder Class
1. Private state object holding all configured values
2. Each method sets state and returns `this`
3. Constructor initializes sensible defaults

### Step 4: Add build() with Validation
1. Check all required fields are set
2. Throw descriptive error for missing fields
3. Return frozen/readonly typed output

### Step 5: Add fromX() Reverse Parser
1. `fromPrompt(text)` or `fromConfig(obj)` — parse existing content into builder state
2. Return the builder so the user can further modify before building

### Step 6: Create Presets
1. Named templates: `templates.technical`, `templates.creative`
2. Each preset pre-fills common configurations
3. Users can override any preset value via chaining

## Rules

### DO:
- Return `this` from every configuration method
- Validate required fields in `build()`
- Support both single-value and array methods for list properties
- Include `reset()` to clear state
- Provide `fromX()` for reverse-engineering existing objects

### DON'T:
- Don't allow `build()` with missing required fields — throw early
- Don't mutate the returned built object — freeze or copy it
- Don't make the builder class itself the output type
- Don't skip JSDoc on chain methods — they ARE the API docs
- Don't use class inheritance for builder variants — use composition

## Output Format

- **Primary output**: Builder class + entry function + types
- **Format**: TypeScript source files
- **Location**: `src/builder/` or `src/lib/builder/`

### Output Template
```
src/builder/
  index.ts          # builder() entry + Builder class + types
  templates.ts      # Named presets
  parser.ts         # fromX() reverse-parsing logic
```

## Resources

| Resource | Type | Description |
|----------|------|-------------|
| `resources/builder-reference.md` | reference | Full TypeScript builder template with generics and presets |

## Handoff

- **Next agent**: None (terminal skill)
- **Artifact produced**: Builder implementation files
- **User instruction**: "Use `builder().role('X').task('Y').build()` to construct objects"

## Platform Notes

| Platform | Notes |
|----------|-------|
| Claude Code | Full file creation support |

Related Skills

mcp-builder

7
from SufficientDaikon/archon

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

YAML Prompt Library

7
from SufficientDaikon/archon

> Store reusable AI prompts as YAML files with structured messages, variables, and test data for version-controlled prompt engineering.

writing-skills

7
from SufficientDaikon/archon

Use when creating new skills, editing existing skills, or verifying skills work before deployment

Writing Plans — TDD-Sized Task Breakdown

7
from SufficientDaikon/archon

> **Type:** Rigid process (follow structure exactly)

wireframing

7
from SufficientDaikon/archon

Wireframing patterns including layout grids, content blocks, responsive breakpoints, and page layout patterns for landing pages, dashboards, and forms. Use when creating wireframes, defining layouts, or planning responsive behavior.

windows-registry-editor

7
from SufficientDaikon/archon

Expert Windows Registry editor and optimizer via PowerShell. Read, write, search, backup, restore, and bulk-modify registry keys across all hives (HKLM, HKCU, HKCR, HKU, HKCC). Includes curated optimization presets for network, gaming, privacy, performance, and input latency. Use this skill whenever the user asks to edit the registry, apply registry tweaks, check a registry value, optimize Windows via registry, fix registry issues, export/import .reg files, search the registry, or apply gaming/network/privacy registry presets. Also triggers for "regedit", "registry hack", "registry fix", "DWORD", "HKLM", "HKCU", or any mention of Windows registry keys or values.

windows-network-optimizer

7
from SufficientDaikon/archon

Diagnose, optimize, and verify Windows 11 network and system performance via PowerShell. Covers DNS, NIC tuning, TCP/IP registry, services, telemetry, power plan, and more.

windows-error-debugger

7
from SufficientDaikon/archon

Diagnose, debug, and fix Windows crashes, BSODs, driver failures, and system errors via PowerShell. Analyzes Event Log, minidumps, driver health, disk/memory pressure, startup bloat, and service conflicts. Builds a growing knowledge base of resolved issues per machine. Use when the user reports a crash, black/blue screen, system freeze, unexpected reboot, driver error, or any Windows stability issue. Also triggers for "BSOD", "blue screen", "black screen", "crash", "system error", "bugcheck", "minidump", "driver failure", "unexpected shutdown", "paging file too small", "system hang", "Windows froze", "PC crashed", "kernel error", or any mention of Windows Event Log errors.

White-Label Config

7
from SufficientDaikon/archon

> Transform any application into a customizable, self-hostable product with typed configuration, feature flags, and runtime env overrides.

webapp-testing

7
from SufficientDaikon/archon

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

web-design-guidelines

7
from SufficientDaikon/archon

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

Vitest Unit Patterns

7
from SufficientDaikon/archon

> Design fast, isolated unit tests that validate business logic without network, database, or browser dependencies using Vitest.