best-of-n

Generate parallel candidate implementations in isolated worktrees and apply the best result.

3|Updated Apr 18, 2026
One-click install
npx skills add https://github.com/garochee33/DSH --skill best-of-n-garochee33
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: best-of-n
Source: https://github.com/garochee33/DSH/tree/main/agents/grok/skills/best-of-n
Command: npx skills add https://github.com/garochee33/DSH --skill best-of-n-garochee33

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you solve a task by exploring multiple implementations in parallel, so you can choose the strongest result instead of settling for the first idea.

Core Features & Use Cases

  • Parallel candidate generation: Spins up several independent subagents to tackle the same problem in isolated worktrees.
  • Comparative evaluation: Reviews correctness, code quality, and safety across all candidates before selecting a winner.
  • Best-result application: Merges the winning solution back into the main workspace and performs any needed cleanup.
  • Use case: Use it when refactoring tricky code, implementing a new feature with uncertain design choices, or validating alternative approaches to a complex bug.

Quick Start

Ask the skill to solve your task with three parallel candidates and return the best implementation.

Frequently Asked Questions about best-of-n

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

FAQPage Schema
How do I compare multiple code implementations to pick the best refactoring approach?

To compare refactoring approaches, generate multiple parallel implementations in isolated worktrees, evaluate them for correctness and safety, then merge the winning candidate back into your main workspace.

What is the best way to implement a feature when the design choices are uncertain?

The best way to handle uncertain design choices is spinning up independent subagents to tackle the same problem in parallel, comparatively evaluating the results, and applying the strongest implementation.

How do I use parallel subagents to validate alternative solutions for a complex bug?

Use parallel subagents by having each execute an independent fix in an isolated worktree, evaluating all candidates for code quality and correctness, and selecting the winning solution for application.

Do I need isolated worktrees to run parallel candidate generation for coding tasks?

Yes, isolated worktrees are required for parallel candidate generation, ensuring each subagent can independently implement and evaluate its approach without interfering with the main workspace.

When should I avoid using a best-of-n approach for feature delivery?

Avoid using a best-of-n approach for feature delivery when tasks are straightforward and lack uncertain design choices, because the overhead of spinning up parallel subagents and isolated worktrees outweighs the comparative evaluation benefit.