Refactor Evals 标志

Refactor Evals

社区
marekkirejczyk
refactor-evals

Bring an eval suite's cases up to written rules. Bundled cases are split to one requirement each, duplicates merged, every check moved to the cheapest grader that can decide it, and every failing or unsteady case diagnosed. Run it with what to refactor, such as a file, a PR or `failing`.

概览

发布者marekkirejczyk
代码仓库skills
技能名称refactor-evals
星标数
157
复刻数
1
附带文件
3
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 3 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 marekkirejczyk 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Refactor Evals AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/marekkirejczyk/skills/tree/main/skills/refactor-evals
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/marekkirejczyk/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/refactor-evals .claude/skills/refactor-evals
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Refactor Evals,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Refactor Evals。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Refactor Evals 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Refactor evals

Bring the eval cases in a scope up to the rules below. Arguments: $ARGUMENTS. If your agent does not fill that in, take them from the user's message.

The scope is what the user names: the whole suite, a PR or branch's cases, a file or folder of cases, or failing (the cases red or marked in the latest run). With no scope given, use the whole suite.

Start by learning the suite: read its README, its case format, its runner and one case file, and map this skill's words onto the project's. Where the project has written its own eval rules, those win, and the conflict goes in the report. An example in its README is not a rule.

Change only the cases in scope, plus the suite's shared files (its list for every reply, shared fixtures) when a move needs them. Search the whole suite for duplicates of what is in scope, and report those outside it.

Why

A suite is worth running only while a red case means one known thing broke and a green case means its requirement held. Three things wear that away:

  • Bundles. A case holding several requirements fails more often than any of them: 17 checks that each hold 98% of the time pass together 71% of the time. Its failure doesn't say which requirement broke, and one mark on it silences them all.
  • Duplicates. A requirement held by several cases costs model calls on every run, and a change to it has to be found in every copy.
  • Checks at the wrong grader. A pattern that guesses at meaning fails good replies. A judge asked what code could decide costs a call and adds its own variance.

Words

  • Subject: the agent or prompt the evals test.
  • Requirement: one obligation from the product's sources (a spec, the system prompt, a policy) that the subject can break while keeping every other. A sentence that can be half kept is two requirements.
  • Scenario: the situation a case puts the subject in: its input and the fixtures the requirement depends on. Two situations are one scenario when the requirement reads the same in both: the same branch of it applies, and it predicts the same reply. Two cars or four, a link or a tick, are different scenarios only for a requirement that names the difference.
  • Case: one scenario with its expectations.
  • Check: an expectation code decides. Judge statement: one a model decides. Both are expectations.
  • Mark: what lets a case fail without failing the run (a known bug, a skip, an expected failure).
  • Trial: one run of a case against the subject.
  • Good reply, bad reply: replies you write by hand, one keeping a requirement and one breaking it. They go green and red in Proof.

Goal

You are done when all five hold:

  1. Every case holds one requirement, cited by its source and section, and every expectation in the case traces to it or is listed in Ask.
  2. Every requirement is held once per scenario. No two cases share both.
  3. Every expectation is at the cheapest grader that can decide it: code first, then the judge.
  4. Nothing is lost. Every pair of requirement and scenario held before is held after, or the user decided to drop it.
  5. Every red is explained. Each failing or unsteady case in scope has a verdict from A red case.

Then the project's format, lint and test commands pass, and every changed case passes every trial or carries a mark.

The ledger

Before the first change, write the ledger in your working notes: one row per expectation in scope.

Requirement (source, section)ScenarioGraderCaseWhere

Write "none found" for an expectation no source backs. Leave out what the runner adds to every case by itself. Then sort by requirement and scenario. The ledger finds the work:

  • A case whose rows name more than one requirement: Split.
  • A requirement and scenario held by more than one case: Merge.
  • One expectation repeated across cases, about every reply and not about their requirements: Hoist.
  • An expectation about what code decides, with nothing left to the model: Push down.
  • A row with "none found": Trace.

At the end, rebuild the ledger from the files and compare it with the first one, pair by pair. That comparison is goal 4.

Rules

examples.md, next to this file, shows each rule broken and kept. Read it before your first round.

Cases

  1. One requirement per case. The name states the behaviour a reader would observe. A name that needs "and" is two cases. Names are unique across the suite.
  2. The case cites its requirement: the source and its section, in the field the project has for it.
  3. A case asks what its requirement asks, and no more. Two people who read the requirement would give any reply the same verdict.
  4. The shortest scenario that reaches the requirement. Earlier turns are there only when the requirement depends on them. An earlier turn carries at most a precondition: one check that the scenario was reached (the list the next turn refers to was shown). A failed precondition is a case that didn't reach its requirement, never the requirement failing.
  5. Both sides of a boundary. A requirement with a condition ("only after", "unless") has a case on each side, and each name says which side.
  6. Invented data. No real person's words, names or records.

Checks

  1. Code decides what code can: how the reply ended, which tools ran and with what, what was shown, a literal, a count.
  2. A must-say pattern is a literal the reply has to carry: a price, a date, a name from a fixture. A list of synonyms is a judge statement.
  3. A must-never-say pattern is a literal no good reply contains. When a refusal or a negation can contain it ("I can't guarantee a date"), it is a judge statement. The exception is a requirement that bans the word itself.
  4. Grade the outcome. Expect a tool call only when the requirement is that it runs, with only the arguments the requirement names, and in an order only when the order is the requirement. Any other expectation about calls is one for Trace.
  5. What holds for every reply is written once, in the suite's list for every reply.
  6. Each fact is checked once in a case, by the cheaper grader that decides it.

Judge statements

  1. One fact per statement. It is two facts when a reply can make one half true and the other false. "A or B" appears only when the requirement itself gives the alternatives.
  2. Checkable from the transcript alone, in plain words, saying what the reply does.

Marks

  1. A mark's note says which expectation fails, what the reply did instead, how often (k of n trials), since when, and its ticket where the project has one.
  2. A mark comes off with the fix: when the cause its note names is gone and the case passes 5 of 5. A clean run alone only adds "not reproduced, 5 of 5" and the date to the note: a case that fails one time in six passes 5 of 5 four times in ten.

Changing an expectation

  1. An expectation changes only on proof: a good reply fails it, or a bad reply passes it. A case that is red because the subject broke its requirement stays as written.

Moves

  • Split. A case holding several requirements becomes one case per requirement on the same scenario. Each expectation goes to the case whose requirement it traces to.
  • Merge. Cases holding one requirement in one scenario become one: keep the shorter scenario and the union of what their expectations catch. Cases that share a requirement across different scenarios both stay, and their names say what differs. When you can't tell whether the scenarios differ, leave both and take them to Ask. Split first: two bundles that each hold "offers nothing for sale" in the same scenario only show as duplicates once they are apart.
  • Hoist. An expectation repeated across cases that holds for every reply moves to the suite's list for every reply and leaves the cases.
  • Push down. An expectation about what code decides (a tool's result, a card the code builds) moves to a unit test of that code. The eval keeps what the model does with it.
  • Regrade. A judge statement code can decide becomes a check (rule 7). A pattern that guesses at meaning becomes a judge statement (rules 8 and 9).
  • Trace. For an expectation with no requirement, search the sources. Found: it gets its own case citing it, in a scenario where the requirement applies. Not found: it stays, in the first case a split of its case makes, and goes to Ask.
  • Pair. A boundary with one side covered gets the other side's case when the source states both sides. Otherwise report the gap.
  • Shorten. Cut the turns the requirement doesn't depend on.

Proof

Both ways. Every expectation you write, reword, or rely on to remove another is shown green on a good reply and red on a bad reply. An expectation moved unchanged needs none. Write the two replies in the shape the runner grades (the words, the tools run, what was shown), and grade them with the project's own check function and judge from a scratch file you never commit. This calls the judge at most; the subject isn't needed. For a must-never-say pattern, the good reply contains the innocent use: a refusal that names the thing.

Removal. A case or an expectation goes only when, for each requirement it held, a remaining expectation is red on that requirement's bad reply.

When the runner can't grade a reply you give it, or there is no key for the judge, that is a finding (harness.md). Until it can, prove by reading each expectation against the two replies, and say so in the report.

Trials

The subject answers differently each time, so one pass proves little.

  • Baseline. Before the first round, run every case in scope for 3 trials with retries off, and record k of 3 for each, keeping each trial's transcript. Say first how many subject calls that makes: the turns in scope × 3. Use the runner's own options for trials, retries and choosing cases. Where it has none, run its command 3 times and count first tries only, and report the lack as a finding.
  • After the last round, do the same for every case you changed or created.
  • Steady is 3 of 3. A case steady at baseline is steady after, or the round that changed it is undone.
  • Parts of a split are judged on their own: the steady parts carry no mark, and a red or unsteady part gets a verdict from A red case.

A split multiplies subject calls. Report the case count and the calls per run, before and after.

With no key for the subject's model, make the moves Proof covers without it and report the trials as not run.

A red case

Read the transcript before anything else: the baseline's, or the latest report's. A mark's note is not a transcript. Then give each failing expectation one verdict:

VerdictThe transcript showsWhat you do
HarnessA model error, a timeout, a judge's answer that couldn't be readRun it again. If it repeats, report it as a finding (harness.md)
CaseA reply that keeps the requirement and still fails: the case asks more than the requirement, a pattern catches a good reply, a fixture is wrongFix the case under rule 17, and say why in the commit
SubjectA reply that breaks the requirementLeave the case as written and report it with the transcript. Mark it (rule 15) only if it was already red at baseline
RequirementSources that are unclear, contradict each other, or say nothing of the failing expectationAsk

A case at 0 of n is suspect before the subject is: look for a fixture typo or an expectation no reply could meet. For an unsteady case, read the failing trials, name the expectation that fails, and give the verdict for that one.

Rounds

Work on a new branch, in rounds: one move on one case or one cluster, then the project's checks that need no model (the case schema, lint, unit tests), then a commit. Leave the branch unpushed.

Order: the baseline, the ledger, verdicts for red cases, Trace, Split, Merge, Hoist, Regrade, Pair and Shorten, then the trials.

The runner and the fake world have their own rules in harness.md. Read it when the scope is the whole suite or includes the runner's files, or when a move needs something the runner can't do. When a rule needs a kind of expectation the case format lacks (the order of calls, a call that must never carry an argument), write the nearest the format has and report the lack as a finding.

Ask

Run everything above without asking. Then present these in one batch, numbered, each with its cases as file:line and your recommendation:

  • an expectation no source backs: add the requirement to the sources, or drop it
  • a merge where the scenarios may differ in a way that matters
  • a requirement that is unclear or contradicted
  • a harness finding marked ask in harness.md

Apply the answers in the same session, one commit each. What the user doesn't answer stays as it is.

Report

  • Cases before and after, and subject calls per run before and after.
  • Each move made: cases split, merged and removed, expectations hoisted and regraded.
  • The trials: k of n per changed case, before and after, or that they weren't run.
  • Each red case with its verdict, and each mark added, rewritten or removed.
  • Subject failures, each with its requirement and transcript.
  • Gaps: boundaries with one side, a cited requirement with no expectation, tool outcomes with no case, marks with no ticket, harness findings.
  • What was proved by reading instead of by grading.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Refactor Evals AI 技能有什么作用?

Bring an eval suite's cases up to written rules. Bundled cases are split to one requirement each, duplicates merged, every check moved to the cheapest grader that can decide it, and every failing or unsteady case diagnosed. Run it with what to refactor, such as a file, a PR or `failing`.

为什么在 TypingMind 中使用 Refactor Evals?

因为您只需安装一次,就能搭配任何模型使用。Refactor Evals 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Refactor Evals?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/marekkirejczyk/skills/tree/main/skills/refactor-evals。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Refactor Evals?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Refactor Evals 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Refactor Evals 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Refactor Evals AI 技能免费吗?

是的。marekkirejczyk 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇