pn-best-of-n

pn-best-of-n is a skill for Cursor from perniemann/pnCore. It costs 54 tokens per session (1,518 once invoked), scanned A, original, MIT.

A tournament process that runs two or three competing implementations of the same specification in separate workspaces, verifies them, and compares the survivors.

In plain words
What is it for?
Use it for algorithm, API, or refactoring choices with clear acceptance tests, but not for authentication, payments, secrets, or other security-sensitive paths.
Why use it?
It provides an objective way to choose between uncertain implementation approaches when tests or other checks can judge the results.

Skill for Cursor

Written for Cursor: shipped in a Cursor plugin. Also seen: mentions subagents; mentions Codex.

Part of the pn-core plugin — 133 skills, 19 commands, 9 agents, 1 MCP server shipped together

Good fit Use it for algorithm, API, or refactoring choices with clear acceptance tests, but not for authentication, payments, secrets, or other security-sensitive paths.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/perniemann/pncore/pn-best-of-n
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 perniemann/pnCore --skill pn-best-of-n
Clone the repo
git clone --depth 1 https://github.com/perniemann/pnCore

Made for: Cursor.

Or install pn-core, the plugin that ships this one along with the rest of its 133 skills, 19 commands, 9 agents, 1 MCP server.

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 pn-best-of-n

README.md
[![agentmods](https://agentmods.dev/badge/skills/perniemann/pncore/pn-best-of-n/github.svg)](https://agentmods.dev/skills/perniemann/pncore/pn-best-of-n)
Your own site
<a href="https://agentmods.dev/skills/perniemann/pncore/pn-best-of-n"><img src="https://agentmods.dev/badge/skills/perniemann/pncore/pn-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 pn-best-of-n

Your own site · 80×15
<a href="https://agentmods.dev/skills/perniemann/pncore/pn-best-of-n"><img src="https://agentmods.dev/badge/skills/perniemann/pncore/pn-best-of-n.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,518 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.
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.00054 $0.01518
Opus 5 $0.00027 $0.00759
Sonnet 5 $0.00011 $0.00304
Haiku 4.5 $0.00005 $0.00152

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

Security

Grade A, and why

pn-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 8d 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.

packages/pn-core-mcp/content/skills/orchestration/pn-best-of-n/SKILL.md · 121 lines

How it starts

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

Best-of-N (implementation tournament)

When to use

  • Ambiguous implementation choice with objective verification (tests, lint, typecheck)
  • Repeated skeptic failure on the same slice (same approach tried twice)
  • User sets useBestOfN: true or invokes /pn-best-of-n
  • Refactor with strong test harness, algorithm choice, API module shape after design exploration

When NOT to use

  • Auth, RLS, payments, secrets — use parallel review panel (pn-build-gate + subagent-routing.md), not competing implementations
  • Single-file edits, copy tweaks, shared mutable state without worktree isolation
  • No verification commands — run tests first or use pn-design-variants (design-only explore)
  • Full full_dev parallel specialists — use specialist decomposition instead

Design-only explore: use pn-design-variants first; this skill implements the winning shape.

Prerequisites

  1. Written spec (plan slice, issue, or user brief) with acceptance criteria
  2. Verification commands listed upfront (e.g. npm test -- <scope>, npm run lint)
  3. Git worktree support (or best-of-n-runner subagent handles isolation)

Workflow

1. Confirm scope and gates

  • Restate spec in ≤5 sentences
  • List objective gates (commands + expected exit 0) — judges must not score candidates that fail these
  • Set N = 2 or 3 (default 2; use 3 only when ambiguity is high and budget allows)
  • Confirm scope is not security-critical; if it is, stop and route to review panel

Log report_usage when MCP available (pilot metric for P1 exit criteria).

MCP workflow (P2): when bestOfN.enabled is true in pn-core://config/features.json, use workflow_step('implementation_tournament', 0, {}) instead of ad-hoc fan-out. Skill-only path remains valid when the flag is off.

2. Fan-out — parallel builders

Spawn N Task subagents (subagent_type: best-of-n-runner) in parallel, each in an isolated worktree on the same spec with a different constraint:

Read the full file on GitHub · 121 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. 8d ago First seen · 121 lines · 54 tokens per session scan A d8c043a30512

Subscribe to this mod's changes

pn-best-of-n is a skill published in the GitHub repository perniemann/pnCore (0 stars, last pushed 5d ago), licensed MIT. It adds 54 tokens to every session and 1,518 once invoked, about $0.0003 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-09-03.

Related

Other skills, from other repositories