best-of-n-solving

Installation
SKILL.md

Best-of-N Problem Solving

Use this skill when facing a hard problem with multiple possible approaches — complex refactors, tricky bugs, performance optimization, or architectural decisions where you're not sure which strategy will work best.

How It Works

Cursor's best-of-n-runner subagent type creates isolated git worktrees — each attempt gets its own branch and working directory. Multiple approaches run in parallel without interfering with each other. You compare the results and pick the winner.

Steps

  1. Identify the approaches — before launching, define 2-3 distinct strategies. For example, if optimizing a slow database query:

    • Approach A: Add a composite index and rewrite the query
    • Approach B: Denormalize the schema with a materialized view
    • Approach C: Add application-level caching with Redis
  2. Launch parallel runners — use the Task tool with subagent_type: "best-of-n-runner" for each approach. Launch them all in a single message so they run concurrently:

    Task 1: { subagent_type: "best-of-n-runner", prompt: "Approach A: ..." }
    
Related skills
Installs
25
GitHub Stars
271
First Seen
Apr 12, 2026