best-of-n

GitHub

通过生成多个独立候选方案,基于固定标准评分并验证,选择最优结果并生成证明日志。适用于多解场景且选错成本高、需确定性检查的任务。

examples/skills/best-of-n/SKILL.md FlorianBruniaux/claude-code-ultimate-guide

触发场景

任务存在多个合理解决方案 错误选择代价高昂 需要确定性检查或独立评审

安装

npx skills add FlorianBruniaux/claude-code-ultimate-guide --skill best-of-n -g -y
更多选项

非标准路径

npx skills add https://github.com/FlorianBruniaux/claude-code-ultimate-guide/tree/main/examples/skills/best-of-n -g -y

不安装直接使用

npx skills use FlorianBruniaux/claude-code-ultimate-guide@best-of-n

指定 Agent (Claude Code)

npx skills add FlorianBruniaux/claude-code-ultimate-guide --skill best-of-n -a claude-code -g -y

安装 repo 全部 skill

npx skills add FlorianBruniaux/claude-code-ultimate-guide --all -g -y

预览 repo 内 skill

npx skills add FlorianBruniaux/claude-code-ultimate-guide --list

SKILL.md

Frontmatter
{
    "name": "best-of-n",
    "effort": "high",
    "description": "Generate bounded independent candidates, score them against a frozen rubric, and verify the selected result with a proof log.",
    "argument-hint": "<task> [--candidates 3|5]",
    "disable-model-invocation": true
}

Best-of-N Selection and Proof

Use this skill when a task has several plausible solutions, a wrong choice is costly, and a deterministic check or independent reviewer can evaluate the selected result. Do not use it for mechanical work with one clear implementation and a direct acceptance test.

Read the full method at Best-of-N: Generate, Select, and Verify before running the protocol.

Inputs to collect before generation

  • Task scope, exclusions, repository revision, environment, permissions, and budget.
  • Acceptance criteria, mandatory failure conditions, and executable checks.
  • A rubric with weights, observable anchors, passing threshold, tie-breaker, candidate count or predeclared batch schedule, and stop rule.
  • The selected TESTING.md path. Start from the portable proof-log template.

If any item is missing, return needs_contract and list the missing fields. Do not generate candidates first and invent the rubric afterward.

Procedure

  1. Freeze the contract in the proof log. Default to three candidates. Use five only when the expected improvement justifies the additional generation, scoring, and verification cost. If work runs in batches, declare every batch and the between-batch stop condition before generation.
  2. Generate each candidate from the same frozen contract. Do not reveal candidate text, scores, or private reasoning across generators. Assign an opaque identifier to every generated candidate.
  3. Preserve each candidate as a separate artifact. For code, use isolated diffs or worktrees from the same base revision. Add one proof-log line for every generated candidate, including every candidate in Best-of-5 and rejected candidates.
  4. Blind provenance and presentation order for scoring when practical. Apply the fixed rubric to every candidate in the declared N, or to every candidate in the completed predeclared batch. Record criterion-level evidence and disqualify mandatory failures.
  5. Select the highest passing candidate using the declared tie-breaker. Treat any combination of candidate fragments as a new synthesized candidate with its own ID, score, and verification.
  6. Run the declared executable checks in the recorded environment. Capture commands, output location, exit status, artifact hash or revision, and uncovered scope.
  7. If executable verification cannot decide the requirement, request a reviewer who did not generate the candidate and who receives a fresh task packet. Record shared model, context, tools, and repository access as correlation risks.
  8. Finish the proof log with PASS, FAIL, or UNKNOWN. UNKNOWN blocks a claim that the requirement was verified.

Guardrails

  • Candidate generation is not selection. Selection is not synthesis. Majority vote is not evidence of correctness.
  • Never use a self-grading generator as the only acceptance gate.
  • Generate and score all candidates in the declared N before selection. A batched run may stop only after the complete predeclared batch is evaluated and its predeclared stop condition is met. Do not keep sampling until an answer feels persuasive.
  • Do not claim candidates are independent solely because they came from different calls. State the isolation controls and remaining shared context.
  • Preserve failed candidates and failed checks in the proof log. They bound what was actually tested.

Required output

Return this concise record and write the full details to TESTING.md:

BEST-OF-N RESULT
Task: <scope>
Contract: <rubric version, N or batch schedule, stop rule>
Candidates: <every generated candidate ID>
Selected: <candidate ID or none>
Verification: PASS | FAIL | UNKNOWN
Evidence: <proof-log path and artifact links>
Remaining limits: <uncovered scope or none>

Connections

Use Dynamic Workflows for durable parallel stages and schemas. Pair this skill with TDD with Claude Code, Agent Evaluation, Code Review, and AI traceability when the result will be delivered or audited.

版本历史

  • 2ef9894 当前 2026-09-09 11:31

同 Skill 集合

.agents/skills/guide-recap/SKILL.md
.agents/skills/self-assessment/SKILL.md
.agents/skills/source-command-audit-prose/SKILL.md
.agents/skills/source-command-audit-whitepapers/SKILL.md
.agents/skills/source-command-ccguide-daily/SKILL.md
.agents/skills/source-command-ccguide-diff-docs/SKILL.md
.agents/skills/source-command-ccguide-init-docs/SKILL.md
.agents/skills/source-command-ccguide-refresh-docs/SKILL.md
.agents/skills/source-command-methodology-advisor/SKILL.md
.agents/skills/source-command-track-mentions/SKILL.md
.agents/skills/source-command-update-infos-release/SKILL.md
.claude/skills/self-assessment/SKILL.md
examples/learning-project/.claude/skills/verify-release/SKILL.md
examples/skills/audit-agents-skills/SKILL.md
examples/skills/audit-codebase/SKILL.md
examples/skills/autoresearch/SKILL.md
examples/skills/canary/SKILL.md
examples/skills/catchup/SKILL.md
examples/skills/ccboard/SKILL.md
examples/skills/check-cache-bugs/SKILL.md
examples/skills/ci-all/SKILL.md
examples/skills/ci-pipeline/SKILL.md
examples/skills/ci-status/SKILL.md
examples/skills/ci-tests/SKILL.md
examples/skills/commit/SKILL.md
examples/skills/cyber-defense-team/SKILL.md
examples/skills/design-patterns/SKILL.md
examples/skills/diagnose/SKILL.md
examples/skills/eval-agents/SKILL.md
examples/skills/eval-hooks/SKILL.md
examples/skills/eval-rules/SKILL.md
examples/skills/eval-skills/SKILL.md
examples/skills/explain/SKILL.md
examples/skills/git-ai-archaeology/SKILL.md
examples/skills/git-worktree-clean/SKILL.md
examples/skills/git-worktree-remove/SKILL.md
examples/skills/git-worktree-status/SKILL.md
examples/skills/git-worktree/SKILL.md
examples/skills/guide-recap/SKILL.md
examples/skills/handoff-create/SKILL.md
examples/skills/handoff-resume/SKILL.md
examples/skills/handoff-update/SKILL.md
examples/skills/investigate/SKILL.md
examples/skills/issue-triage/SKILL.md
examples/skills/land-and-deploy/SKILL.md
examples/skills/landing-page-generator/SKILL.md
examples/skills/learn-alternatives/SKILL.md
examples/skills/learn-quiz/SKILL.md
examples/skills/learn-teach/SKILL.md

元信息

文件数
0
版本
2ef9894
Hash
20fc72c8
收录时间
2026-09-09 11:31

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-09 19:00
浙ICP备14020137号-1 $访客地图$