Skip to main content
skill CX Codex

ds-best-of-n — Claude Code skill: what it does, how to install

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.

MIT 539 installs ★ 320 updated 2026-10-28

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add aicodeking/deepseek-stack --skill ds-best-of-n -a claude-code
Open on GitHub

What ds-best-of-n 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.

What it helps with

  • 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 for the agent

  • 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.

How to install ds-best-of-n

1Skills CLI (Vercel)

npx skills add aicodeking/deepseek-stack --skill ds-best-of-n -a claude-code

2Manually: put the files in place

~/.claude/skills/ds-best-of-n/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/ds-best-of-n/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about ds-best-of-n

How do I install ds-best-of-n in Claude Code?

Run npx skills add aicodeking/deepseek-stack --skill ds-best-of-n -a claude-code. The skill file is at ~/.claude/skills/ds-best-of-n/SKILL.md.

What does ds-best-of-n do?

It produces multiple versions of a task, checks them, and transfers selected strengths into the best-structured candidate. Then it reruns the checks.

How many attempts does ds-best-of-n make?

It uses 3 by default and 5 when the task has a wider design space.

Source text

SKILL.md · MIT
---
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.

© aicodeking · MIT · aicodeking/deepseek-stack

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set29

The whole set →
ds-sharpen The ds-sharpen Claude Code skill refines your prompts, deepens tasks, and stress-tests plans for AI agents. It runs before starting vague or high-stakes work to identify potential weaknesses. CX Codex +1 542installs ds-tdd The ds-tdd Claude Code skill guides bug fixes through a failing test, then a minimal code change. It activates for TDD or regression-test requests and bugs with a simple local test target. CX Codex +1 542installs ds-catchup ds-catchup — a skill for Claude Code summarizes changes since the last message and lists decisions awaiting the user's input. It runs when someone returns after a long pause or asks what happened. CX Codex +1 540installs ds-jury The ds-jury Claude Code skill gathers independent reviews of a code change from several models. The agent works through accepted findings and runs another review round until the reviewers agree. CX Codex +1 539installs ds-swarm Claude Code skill splits broad tasks across parallel workers and merges their verified outputs into a single report. Triggers on /ds-swarm during audits or multi-branch races. CX Codex +1 537installs ds-watch-pr ds-watch-pr is a Claude Code skill that follows a pull request through CI and review, fixes real findings, and stops when it is ready, merged, or blocked. CX Codex +1 536installs ds-adopt ds-adopt — a Claude Code skill takes over an existing PR, branch, or agent thread and completes its original goal. It activates when asked to adopt or finish someone else’s work. CX Codex +1 534installs ds-ready ds-ready is a Claude Code skill that automates the delivery workflow through opening a pull request, then stops before merging. CX Codex +1 534installs

Project sponsors

Companies that keep this analytics open