npx skills add ...
npx skills add spencerpauly/awesome-cursor-skills --skill best-of-n-solving
Solve a hard problem by trying multiple approaches in parallel using isolated git worktrees. Each attempt runs in its own branch, and the best solution is selected. Use for complex refactors, tricky bugs, or architectural decisions where multiple strategies could work.
npx skills add spencerpauly/awesome-cursor-skills --skill best-of-n-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.
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.
Identify the approaches — before launching, define 2-3 distinct strategies. For example, if optimizing a slow database query:
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:
Each runner gets its own branch and worktree. Include clear success criteria in the prompt (e.g., "run the tests and report if they pass", "measure the query time").
Compare results — when all runners complete, evaluate:
Merge the winner — check out the winning branch and merge it, or cherry-pick specific commits. Clean up the other worktree branches.