best-of-n

best-of-n is a skill for Claude Code, Codex from Hmbown/CodeWhale. It costs 32 tokens per session (998 once invoked), scanned A, original, MIT.

A comparison process that creates several independent solutions, scores them against one stated set of criteria, and uses the winner only after checking it.

In plain words
What is it for?
Use it for consequential design, coding, explanation, or debugging tasks where comparing a small number of candidate solutions is worthwhile.
Why use it?
It helps choose among multiple plausible approaches when correctness, simplicity, fit, and risk matter.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it for consequential design, coding, explanation, or debugging tasks where comparing a small number of candidate solutions is worthwhile.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/hmbown/codewhale/best-of-n
About the project

Hmbown/CodeWhale is an open-source coding agent that runs in the terminal and is written in Rust. Developers use it to inspect repositories, edit files, run commands, and coordinate work with configurable model providers, skills, MCP servers, and approval controls; the catalogue entries extend its available workflows.

Hmbown/CodeWhale · 40,914 stars · on GitHub · codewhale.net

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Hmbown/CodeWhale --skill best-of-n
Clone the repo
git clone --depth 1 https://github.com/Hmbown/CodeWhale

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for best-of-n

README.md
[![agentmods](https://agentmods.dev/badge/skills/hmbown/codewhale/best-of-n/github.svg)](https://agentmods.dev/skills/hmbown/codewhale/best-of-n)
Your own site
<a href="https://agentmods.dev/skills/hmbown/codewhale/best-of-n"><img src="https://agentmods.dev/badge/skills/hmbown/codewhale/best-of-n/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for best-of-n

Your own site · 80×15
<a href="https://agentmods.dev/skills/hmbown/codewhale/best-of-n"><img src="https://agentmods.dev/badge/skills/hmbown/codewhale/best-of-n.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 998 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Snyk pass 7 Sept 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00032 $0.00998
Opus 5 $0.00016 $0.00499
Sonnet 5 $0.00006 $0.00200
Haiku 4.5 $0.00003 $0.00100

Measured 13d ago against content hash dc90f575c66a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

best-of-n scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 13d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

crates/tui/assets/skills/best-of-n/SKILL.md · 107 lines

How it starts

The opening of the file, as written. The whole thing — 107 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Best of N

Use this skill when a consequential design, implementation, explanation, or debugging task has several plausible solutions and comparison is worth the extra model work. In Operate mode this is the preferred ensemble pattern for high-stakes or ambiguous approaches. Do not use it for a tiny change or when the user has already chosen the approach.

Set The Tournament

  1. Define one task, one evidence packet, and one explicit scoring rubric before launching candidates. Include correctness, fit to the request, simplicity, risk, and verification.
  2. Choose N from 2 to 4 for a quick comparison (default 3). For an explicit experimental search, use the Workflow search option: 2–16 live candidates, with larger validated populations queued at the Workflow host's 16-worker concurrency gate rather than launched at once.
  3. Give every candidate the same task and rubric. Add only a candidate number; do not steer candidates toward different conclusions unless diversity is an explicit part of the request.
  4. Prefer a session goal (create_goal or active /goal) when the tournament spans more than one parent turn.

Generate Independently

Start the candidates as parallel background agent workers and return agent_ids immediately so the parent stays free. For proposals, reviews, or research, keep them read-only:

{
  "action": "start",
  "name": "candidate_1",
  "prompt": "Produce candidate 1 for the task below. Return the proposal, evidence, risks, and rubric self-score. Do not edit files.\n\n<TASK AND RUBRIC>",
  "type": "worker",
  "model_strength": "same",
  "write_authority": "read_only"
}

Launch the remaining candidates with the same contract, then use agent wait or completion events to collect every result. Do not show one candidate another candidate's answer before generation finishes.

When candidates must implement code, give each one:

  • type: "builder"
  • worktree: true
  • write_authority: "worktree_write"
  • the same bounded write_roots or exact_files

Read the full file on GitHub · 107 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 13d ago First seen · 107 lines · 32 tokens per session scan A dc90f575c66a

Subscribe to this mod's changes

best-of-n is a skill published in the GitHub repository Hmbown/CodeWhale (40,914 stars, last pushed 6d ago), licensed MIT. It adds 32 tokens to every session and 998 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories