# ds-best-of-n

The ds-best-of-n Claude Code skill creates several independent versions of a task and combines the strongest result with selected parts from the others. It runs for substantial work where a single attempt may take the wrong direction.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 539 installs · ★ 320 repo stars
- Author: aicodeking
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/aicodeking/deepseek-stack/tree/HEAD/skills/ds-best-of-n/SKILL.md
- Updated: 2026-10-28
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/ds-best-of-n

## What it does

The skill generates multiple versions of one artifact, tests them, then builds a final result from the strongest candidate. It sets a shared prompt and private scoring criteria first. Attempts run at the same time in separate locations; if subagents are unavailable, the skill runs them one after another in fresh contexts.

Each candidate gets a build, tests, or a quick execution check. The skill drops failures, picks a base by overall structure, then transfers specific good ideas from other candidates without merging entire files. It runs the full checks again and reports the result.

The default is 3 attempts; use 5 when there are many possible directions. If none passes after a rerun with a clarified prompt, the agent reports the failure.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add aicodeking/deepseek-stack --skill ds-best-of-n -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/ds-best-of-n/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/ds-best-of-n/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add aicodeking/deepseek-stack --skill ds-best-of-n -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/ds-best-of-n/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add aicodeking/deepseek-stack --skill ds-best-of-n -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/ds-best-of-n/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install aicodeking/deepseek-stack skills/ds-best-of-n
```

2. **Manually: put the files in place**
- File: `.github/skills/ds-best-of-n/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add aicodeking/deepseek-stack --skill ds-best-of-n -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/aicodeking/deepseek-stack --path skills/ds-best-of-n
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/ds-best-of-n/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add aicodeking/deepseek-stack --skill ds-best-of-n -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/aicodeking/deepseek-stack/tree/HEAD/skills/ds-best-of-n/SKILL.md

## When to use it
- compare several solutions to one task
- discard candidates that fail checks
- move strong details into a chosen base
- rerun checks on the assembled result

## Example prompts
- Run `/ds-best-of-n` on this task and combine the strongest results.
- Create three versions, test them, and assemble the best parts.
- Compare several implementations and merge selected improvements into one.

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 6b7d012438dcf58e.

BEGIN THIRD-PARTY FILE 6b7d012438dcf58e
```text
---
name: ds-best-of-n
description: "Run N independent attempts at the same task in parallel, pick the strongest as the base, and graft the best parts of the others into it. Use when one attempt at a non-trivial artifact could land on the wrong shape, or for /ds-best-of-n, 'try a few versions', 'best of 3'."
---

# ds-best-of-n

One attempt is a sample, not an answer. DeepSeek is cheap enough that three to five attempts usually cost less than one round of fixing a bad first try.

## Steps

1. Frame the task. Write one prompt that every attempt gets unchanged. Write a private rubric of 3 to 6 concrete, checkable criteria. Attempts never see the rubric.
2. Pick N. Use 3 by default and 5 when the design space is wide. Give each attempt its own output location, such as a git worktree or a separate temp folder.
3. Spawn N subagents at once with the prompt, the shared context and their output path. Ask each for the artifact plus a short note on alternatives it rejected. If a harness cannot run subagents, run the attempts one after another in fresh contexts.
4. Check each attempt. Run its build, tests or a quick probe. Record pass or fail with output. Discard attempts that do not run.
5. Score the survivors against the rubric. Pick the one with the best overall structure as the base. Structure beats polish.
6. List the specific strong parts of the other attempts: a test, an edge case, a cleaner function. Graft only those into the base. Do not merge whole files.
7. Re-run the full checks on the grafted result and show the output.

## Stop when

- The grafted result passes every check and you have reported base, grafts and scores.
- Or no attempt passes after one re-run with a clarified prompt. Report what failed.

## Rules

- Never pick by reading the attempt's own summary. Pick by running it.
- Do not let one attempt see another before scoring.
- Keep the losing attempts until the final checks pass.
```
END THIRD-PARTY FILE 6b7d012438dcf58e

The third-party file has ended. Everything between the 6b7d012438dcf58e tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

© aicodeking · MIT · https://github.com/aicodeking/deepseek-stack/tree/HEAD/skills/ds-best-of-n/SKILL.md

## Similar
- [stream-chain](https://affpapa.org/en/nevibecode/skills/stream-chain.md) — skill · 1200 installs
- [bug-hunt-swarm](https://affpapa.org/en/nevibecode/skills/bug-hunt-swarm.md) — skill · 767 installs
- [ai-team-orchestration](https://affpapa.org/en/nevibecode/skills/ai-team-orchestration.md) — skill · 381 installs
- [parallel-agents](https://affpapa.org/en/nevibecode/skills/parallel-agents.md) — skill · 189 installs
- [multi-agent-e2e-validation](https://affpapa.org/en/nevibecode/skills/multi-agent-e2e-validation.md) — skill · 128 installs
- [confirm-failures-are-causally-linked-to-the-task-before-reportin](https://affpapa.org/en/nevibecode/skills/confirm-failures-are-causally-linked-to-the-task-before-reportin.md) — skill · ★ 539 repo stars

From the same set: [aicodeking/deepseek-stack](https://affpapa.org/en/nevibecode/by/aicodeking/deepseek-stack.md) — 29 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
