本文へ移動
cccskills
無料GitHub で公開

ai-generated-test-auditor

当 AI 写完测试、要决定信不信这份测试时使用。查三类假信心:断言与实现是否同源复制、有没有边界与异常用例、失败信号够不够强;再规划 2–5 个突变抽样,能执行时再实跑,看把被测代码改坏之后测试会不会变红,没实跑就不声称测试抓得住错。测试全绿不等于代码对,也可能是测试根本抓不住错。

要决定整份 diff 能不能合并时走 ai-diff-review-protocol。

インストール方法を見る

含まれるファイル(2)

  • SKILL.md13.5 KB
  • scripts/check_test_audit_manifest.py18.8 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

ai-generated-test-auditor

Use this skill when an AI has already proposed or written tests and you need to decide whether those tests are actually protecting behavior, or just producing a reassuring green checkmark.

This skill audits test quality, not product correctness. Its job is to find weak assertions, implementation mirroring, missing boundary/error cases, and evidence that the suite would stay green even after a meaningful bug.

What this skill does

  • Separates the behavioral contract from the AI-generated test code.
  • Checks whether tests rely on an independent oracle or merely replay implementation logic.
  • Audits coverage shape:
    • happy path;
    • boundary values;
    • invalid input / failure paths;
    • state transitions / side effects;
    • regressions for previously known bugs.
  • Plans 2–5 reversible sample mutations that should make good tests fail, and runs them only when the tests can be executed, the user agrees, and the code can be restored (Step 5). Otherwise the plan is the deliverable and runtime evidence is marked missing.
  • Produces a verdict: usable / usable with gaps / weak / misleading.

Good fits

Use it for:

  • reviewing tests created by Copilot, ChatGPT, Claude, Cursor, Aider, or similar tools;
  • checking whether a generated suite only tests the obvious path;
  • spotting tautological assertions like “expected = same helper as production code”;
  • deciding what a human reviewer must strengthen before merging;
  • preparing a focused test-review handoff for another engineer or agent.

Not for

Do not use this skill to:

  • claim the underlying implementation is correct;
  • replace real test execution;
  • generate a full production-ready test suite from scratch;
  • approve risky refactors without runtime evidence;
  • decide whether a whole diff can be merged. Use ai-diff-review-protocol for that; it sends the tests inside the diff back here.

If the user actually wants new tests written, a test-authoring skill should do that first. Come back to this skill once there is a candidate suite to inspect.

Required inputs

Ask for the smallest set that makes an audit meaningful:

  1. Behavioral target
    • what function, module, endpoint, workflow, or bugfix the tests are supposed to protect;
  2. AI-generated tests
    • pasted code, file content, or a precise summary of key assertions;
  3. Implementation summary
    • enough to see whether tests copy internal logic instead of checking behavior;
  4. How tests would be run
    • command, framework, or at least the expected environment;
  5. Any known edge cases or failure modes
    • if already known by the user or issue tracker.

If these are missing, say exactly what is missing. Do not pretend to certify tests you cannot inspect.

Core workflow

Step 1: restate the contract under test

Before reading assertions, write down:

  • what external behavior should be true;
  • what inputs matter;
  • what outputs, state changes, or side effects matter;
  • what should fail, reject, or stay unchanged.

Prefer contract language such as:

  • accepts / rejects;
  • returns / raises / logs / persists;
  • preserves ordering / idempotence / monotonicity;
  • does not mutate unrelated state.

Step 2: classify each test by evidence strength

For each test or cluster of similar tests, classify the oracle:

  • independent oracle — compares against a hard requirement, fixture, known output, invariant, or manually reasoned expectation;
  • derived oracle — expected value computed by a simpler but still independent method;
  • mirrored logic — expected value built by repeating the production algorithm or the same branch conditions;
  • weak signal — only checks “did not crash”, status 200, non-null, truthy, or snapshot noise without semantic assertions.

Anything in the last two categories is high-risk when AI wrote it.

Step 3: audit coverage shape

Check whether the suite includes, skips, or hand-waves:

  1. happy path;
  2. boundary cases
    • empty input, zero, one, min/max, exact threshold, off-by-one neighbors;
  3. error / invalid input cases;
  4. stateful or side-effect cases
    • retries, duplicate calls, persistence, ordering, cleanup;
  5. regression hooks
    • tests tied to a known bug or failure mode.

If a category is absent, name the missing risk explicitly.

Step 4: look for AI-specific failure patterns

Treat these as red flags:

  • assertions copied from implementation formulas or helper functions;
  • mocks so aggressive that real behavior disappears;
  • snapshot tests with no focused semantic assertions;
  • exact string assertions on unstable text without checking the real contract;
  • tests that only verify the current implementation, not intended behavior;
  • “parameterized” cases that are all the same shape;
  • boundary values mentioned in comments but not asserted;
  • TODO/FIXME placeholders left in test code;
  • tests for private helpers while public behavior stays untested.

Step 5: plan reversible sample mutations

Pick 2–5 small mutations that a decent suite should catch.

Prefer mutations like:

  • flip > to >= or < to <= at a threshold;
  • remove validation or an early return;
  • replace a computed value with a constant;
  • swap sort order;
  • skip persistence / callback / emitted event;
  • change one branch’s sign, key, or unit conversion.

For each mutation, record:

  • target behavior being challenged;
  • likely file/function or logic point;
  • what test should fail;
  • what it means if no test would fail.

If you cannot run mutations in the current environment, still provide the plan and label runtime evidence as missing.

Run the plan only when all of these hold: you can execute the tests, the user has agreed, and every file can be restored exactly. Then:

  1. Work where nothing can be lost: a clean working tree (git status --porcelain prints nothing) or a separate worktree or copy of the project. Never mutate files that have uncommitted changes you cannot restore.
  2. Run the tests the plan names once without changes. They must pass; otherwise the mutation results mean nothing.
  3. Apply one mutation, run the named tests, record red or green.
  4. Restore the file (git checkout -- <file>, git restore <file>, or copy the saved original back) and confirm the tree is clean before the next mutation.
  5. Report each mutation as killed (a named test turned red), survived (the suite stayed green) or not run, with the command you used.

If any condition fails, deliver the plan only.

Step 6: produce a verdict

Use one of:

  • usable — covers core behavior with mostly independent oracles and meaningful failure signals;
  • usable with gaps — main path is protected, but specific missing edges or weak assertions remain;
  • weak — many tests are shallow, mirrored, or leave important behavior unprotected;
  • misleading — a green suite would create false confidence because the assertions barely test the contract.

Output format

Use this structure:

1. Audit target

  • what the tests claim to protect;
  • what evidence was actually available.

2. Contract summary

  • key behaviors;
  • failure modes that should matter.

3. Evidence audit

A compact table with:

  • test or cluster;
  • oracle type;
  • strength;
  • concern.

4. Coverage gaps

  • missing boundary cases;
  • missing error cases;
  • missing side-effect or regression coverage.

5. Sample mutation plan

For each mutation:

  • mutation idea;
  • behavior it probes;
  • test expected to fail;
  • interpretation if suite stays green.

6. Verdict

  • usable / usable with gaps / weak / misleading;
  • what to strengthen next.

7. Evidence status

Tag statements when useful:

  • given;
  • observed in test code;
  • inferred from implementation summary;
  • should be verified by execution;
  • missing evidence.

Boundary rules

  • Do not claim coverage percentages you did not measure.
  • Do not claim mutation resistance unless mutations were actually executed.
  • Do not rewrite the whole suite unless the user explicitly asks for authoring help.
  • Do not confuse “tests pass” with “tests are meaningful”.
  • If only a prose summary is available, downgrade confidence and say so.

Deterministic helper

This skill includes a dependency-free helper script:

  • scripts/check_test_audit_manifest.py

It validates whether a planned audit packet is structurally complete enough to review consistently:

  • required fields present;
  • implementation file paths unique;
  • test case IDs unique;
  • mutation sample IDs unique;
  • every mutation points to declared implementation files and named test cases;
  • warns when happy path, boundary, error, or side-effect coverage is missing from the audit packet;
  • warns about keys it does not know instead of ignoring them silently.

Allowed values, with the Step 2 and Step 3 wording the script also accepts:

FieldCanonical valueAlso accepted
oracleindependentindependent oracle
oraclederivedderived oracle
oraclemirroredmirrored logic
oracleweak-signalweak signal
kind (test case)happy-pathhappy path
kind (test case)boundaryboundary cases
kind (test case)error-patherror / invalid input cases
kind (test case)side-effectstateful or side-effect cases
kind (test case)state-transitionstate transition
kind (test case)regressionregression hooks

A mutation's kind is free text (for example remove-validation, boundary-flip).

Example manifest shape:

{
  "target": "Validate AI-generated tests for create_user",
  "implementationFiles": ["src/user_service.py"],
  "testCases": [
    {
      "id": "accepts_valid_name",
      "kind": "happy-path",
      "oracle": "independent",
      "summary": "Creates a user when name and email are valid"
    },
    {
      "id": "rejects_blank_name",
      "kind": "error-path",
      "oracle": "independent",
      "summary": "Raises ValueError for blank name"
    }
  ],
  "mutationSamples": [
    {
      "id": "skip_blank_name_validation",
      "targetFile": "src/user_service.py",
      "kind": "remove-validation",
      "expectedFailingTests": ["rejects_blank_name"],
      "why": "A real guard should be observable through the public API"
    }
  ]
}

Run it with any Python 3 environment:

python3 scripts/check_test_audit_manifest.py path/to/test-audit-manifest.json
python3 scripts/check_test_audit_manifest.py --selftest

Exit codes: 0 means the manifest is valid (warnings may remain), 1 means it has problems (missing fields, unknown values, a mutation naming a test that is not in the packet), 2 means the file cannot be read as JSON or the arguments are wrong.

Heuristics this skill should apply

Prefer these questions when deciding whether AI-generated tests are trustworthy:

  • Would the test still pass if the implementation returned a constant or cached default?
  • Does the expected value come from an independent requirement, or from reusing production logic?
  • Are there threshold neighbors, invalid shapes, and empty cases?
  • Does any test prove an important side effect happened, not merely that the function returned?
  • Is there at least one mutation per major behavioral promise that should clearly turn the suite red?

Mini examples

  • If the production code sorts ascending and the test builds sorted(input) as its expected value, that is often mirrored logic, not a strong oracle.
  • If an API test only checks status 200 and “response is not null”, it does not prove the payload contract.
  • If deleting an input-validation branch would leave the suite green, the suite is giving false confidence exactly where users are likely to get hurt.

Success criterion

The skill has done its job when the user can say:

  1. which tests genuinely protect behavior;
  2. which tests only mirror implementation or check noise;
  3. which edge and failure cases are still unprotected;
  4. which 2–5 sample mutations should be tried next;
  5. and how much trust the current suite has earned.

变更记录 / Changelog

版本日期变更类型
0.1.12026-09-26description 与 suggest_hint 不再承诺"验证测试真会变红",改成"规划 2–5 个突变抽样,能执行时再实跑",Step 5 补上实跑的安全步骤(干净工作区或副本、先征得同意、逐个突变、逐个恢复);脚本接受正文用语(mirrored logic、weak signal 等)并在正文列出枚举,改用 argparse(--help 不再被当成文件名),传入目录、非 UTF-8、坏 JSON 时报错退出 2,不认识的键给警告,补 --selftest;示例命令改为 python3;与 ai-diff-review-protocol 互相点名patch
0.1.02026-09-05初始版本minor

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

当学生说"Common App 活动栏写不下"、"这段活动描述超字数了"、"帮我把这几条压到限制内"时使用。先按官方申请表核对当季字符限额,再逐条检查;一次把所有条目量完并直接给出压缩版,只在需要砍掉实质内容时才用选择题问该保哪部分。每改一版都用工具重新数一遍字符,绝不凭感觉说"这样应该够了"。只压缩,不代写空白。

日本語の概要は準備中です。原文の説明を表示しています。

ChromiteCr/Skills42026年10月16日 更新

当学生说"我参加过一些活动但没整理过"、"帮我把经历录进去"、"我的活动档案是空的"时使用。让学生一口气把记得的活动说出来,直接把这段话拆成结构化的长期事项(角色、组织、起止时间、做了什么、结果、级别),说不清的字段留空标"待补"而不是编,再用一张选择题卡把级别判定与是否重复这类关键项一次问完,然后提案入库。只记录学生真正说出口的内容,级别按事实判定,绝不往高了写。

日本語の概要は準備中です。原文の説明を表示しています。

ChromiteCr/Skills42026年10月16日 更新

当学生问"招生官会怎么看我的档案"、"我的背景还差什么"、"帮我评估一下现在的申请竞争力"时使用。以顶尖大学招生官的视角通读学生的档案、长期活动与已写下的反思,不问任何前置问题直接产出一份指名道姓的坦诚点评:这份材料的亮点、招生官真实的解读方式、明显的短板与空白、以及接下来最值得做的一到两件事。只读不写,不修改学生的任何数据,也不代写任何申请材料。

日本語の概要は準備中です。原文の説明を表示しています。

ChromiteCr/Skills42026年10月16日 更新

当使用者说"帮我填词"、"按这个字数模板写歌词"、"用多Agent对抗式写词"、"这首副歌帮我想几句"时使用,前提是字数骨架和这首歌写什么都已经有了;只有主题、还没定写什么时先用 lyric-concept-builder。拿一份字数骨架和意象系统,派三个 sonnet 子代理按不同路子并行独立起草(场景派 / 口语派 / 意象派),再派一个红队子代理逐句挑毛病,主 Agent 按句裁决拼稿,最后统一辙口与意象。收敛判据卡死:字数用 lyric-doctor 的脚本对模板数、每段同辙、hook 不含陈词、主歌二对主歌一有推进。不抄现有歌词,不替使用者决定这首歌要说什么。

日本語の概要は準備中です。原文の説明を表示しています。

ChromiteCr/Skills42026年10月16日 更新

当想知道一段 AI 回答"哪些能直接用、哪些必须先验证、哪些只能当建议"时使用。按声明类型分四级——低风险草稿材料、观点与策略建议、可查证的事实声明、会改变状态的可执行指令——每级配一句默认处置动作;再按影响半径排序,给出最小的下一步检查。可执行类一律标"不能直接执行;先做代码审阅/沙箱测试/回滚准备",其中破坏性或提权的命令排在最前。教的是一套可复用的复查习惯,不是替使用者把所有内容都核实一遍:本 skill 只分级、排序、定处置,要逐条核实走 ai-output-fact-checker,整段代码要做入库体检走 ai-code-onboarding-checklist。

日本語の概要は準備中です。原文の説明を表示しています。

ChromiteCr/Skills42026年10月16日 更新

当拿到一段 AI 生成的代码,还没决定要不要信、要不要跑、要不要往上继续加东西时使用。先做一遍客观体检:行数与嵌套深度、有没有测试、有没有硬编码密钥或遗留 TODO、依赖是不是真实存在、有没有危险调用(eval/exec、shell=True、递归删除、反序列化、提权、外发网络,按正文给的 grep 模式逐类查);再给风险评级和下一步动作。老实写明它查不了算法正确性——体检通过不等于代码是对的。回答里文字、事实和代码混在一起时先用 ai-answer-triage 分级;只审相对已有代码的一份改动用 ai-diff-review-protocol。

日本語の概要は準備中です。原文の説明を表示しています。

ChromiteCr/Skills42026年10月16日 更新

ChromiteCr のスキルをすべて見る

このスキルの問題を報告する