writing-evals
БесплатноБез исполняемых скриптовНе проверенTeaches how to write and run evals on the `products/posthog_ai/eval_harness/` harness — sandboxed agent suites that execute the real coding agent in a Docker…
от PostHog★ 41 278 звёзд на GitHubОб этом скилле
Writing and running evals
The harness under products/posthog_ai/eval_harness/ runs two kinds of suites: sandboxed suites execute the real coding agent inside a real sandbox against a seeded Hedgebox project and score what it did, and one-shot suites score a single in-process model invocation per case.
Neither runs under pytest — the standalone harness boots the shared infrastructure the selected suites need (for sandboxed suites: test DB, Django live server, AI gateway, MCP server, Temporal, personhog; for one-shot suites: just the test DB, personhog, and demo data) and runs every selected suite concurrently, with Braintrust as the eval engine.
Read before writing anything:
- products/posthog_ai/eval_harness/README.md — usage, CLI flags, providers.
- products/posthog_ai/evals/AGENTS.md — the Hedgebox dataset reference. Your prompts,
expectedvalues, and scorers must match that taxonomy exactly (signed_up, notsign_up). - products/posthog_ai/eval_harness/harness/AGENTS.md — invariants when touching the harness itself.
Field-level API detail (case fields, the output dict, LogParser, seeder inventory) lives in references/authoring-reference.md.
Writing a suite
Suites are discovered by convention, not registered: any coroutine named eval_* in a file named eval_*.py, taking a single ctx: EvalContext and returning None.
The harness discovers suites from two root sets:
products/posthog_ai/evals/<domain>/— the built-in tree, reserved for Max and other agent suites. The directory is the domain; the suite id is<domain>/<module>::<fn>(import pathproducts.posthog_ai.evals.<domain>.<module>).products/<product>/evals/— where a product ships eval suites next to its own code. Note the pluralevals/: the singularproducts/signals/eval/is an existing pytest tree and is not collected by the harness. The product is the domain; the suite id is<product>/<module>::<fn>(import pathproducts.<product>.evals.<module>).
New product-owned evals belong under products/<product>/evals/. Both root sets use the same conventions (the eval_*-coroutine-in-eval_*.py rule, the SUITE_KIND marker, and substring selectors).
No evals/ tree needs a pytest-collection exclusion: pytest's default python_files matches test_*.py, so eval_*.py files there are never collected as tests. Do not add a conftest.py under an evals/ tree.
from products.posthog_ai.eval_harness.base import SandboxedEval
from products.posthog_ai.eval_harness.config import SandboxedEvalCase
from products.posthog_ai.eval_harness.harness.context import EvalContext
async def eval_my_thing(ctx: EvalContext) -> None:
await SandboxedEval(
experiment_name="sandboxed-my-thing-cli",
cases=[SandboxedEvalCase(name="my_case", prompt="...")],
scorers=[],
ctx=ctx,
)
- One suite = one experiment. Bundle related cases into one suite; split only when the scorecard would be heterogeneous (self-skipping scorers stretch a shared scorer list across mildly different cases, but a scorecard where half the scorers skip half the cases is a sign to split).
experiment_nameidentifies local and PostHog runs — keep it stable for cross-run comparison. Existing sandboxed suites end in-clibecause the MCP server serves theclisurface.SandboxedEvalandOneShotEvalalways run Braintrust locally without uploading to it. Withoffline_suiteand a publishing credential, results publish to PostHog by default. Setsend_to_posthog=Falsefor local-only results; local logs are always written. Ordinary SDK and trace clients still honorOPT_OUT_CAPTURE. See evaluation result reporting.- To enroll a suite in PostHog reporting, register its scorer kinds and immutable version UUIDs in the owning
offline_config.pycatalog, then passoffline_suite=offline_suite("<domain>/<module>::<function>", metrics=[...])to the runner. Use the PostHog AI catalog for built-in suites and the Slack app catalog for Slack suites. List every explicit scorer's_name()inmetrics; the catalog addsexit_code_zeroonly for sandboxed suites. For one-shot suites, passsuite_kind=SUITE_KIND. The enrollment test discovers catalog-using modules and checks every suite function against its scorer list. - Uploading and tagging require
POSTHOG_OFFLINE_EVAL_API_KEYto be a personal key withoffline_evaluation_ingestion:writeandevaluation:write. Ingestion-only personal or project secret keys can upload without tags. Upload success is recorded before the separate, bounded tag update, so a tagging failure or interruption keeps the results link.
One-shot suites
A module-level SUITE_KIND declares how a module's s
Установить writing-evals в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл writing-evals?
Teaches how to write and run evals on the `products/posthog_ai/eval_harness/` harness — sandboxed agent suites that execute the real coding agent in a Docker or Modal sandbox against a seeded Hedgebox project, and one-shot suites that score a single in-process model invocation per case. Use when adding or changing eval suites, cases, scorers, seeders, or synthesizers under `products/posthog_ai/evals/` or `products/*/evals/`, when touching the harness under `products/posthog_ai/eval_harness/`, or when running or debugging those evals (`hogli evals`). Covers suite kinds and discovery, case anatomy, the seeder/synthesizer split, the one-branch scorer patterns, and how to read results. Not for the LLM Analytics product's evaluation features.
Как установить скилл writing-evals?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл writing-evals запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic