跳到正文
Skillpedia
提示词与 LLM48k · #3718

ai-prompt-regression-testing

它能做什么

这个工具可以帮你对比 AI 在修改指令前后对同一问题的回答。它能确保改动不会破坏原有的良好回答。

适用场景

  • ✓测试修改 AI 指令后是否引入了新问题时。
  • ✓检查 AI 是否仍然遵守重要规则(比如不编造事实)时。
  • ✓当结果难以判断时,记录你对回答质量的判定结论。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/ai-prompt-regression-testing/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/ai-prompt-regression-testing/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“对比 AI 在修改指令前后对这 5 个问题的回答,并检查它是否仍然遵守规则。”

每周 5 个新技能,1 分钟读完。

工作原理

你需要提供一组固定的问题和预期答案。然后,系统会把 AI 在新指令下的回答与旧回答进行比较,并记录是否出现了问题。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

AI Prompt Regression Testing

When to Use

  • Compare a prompt change with an observed baseline on a fixed evaluation set.
  • Detect schema, factuality, refusal, tool-selection or task-completion regressions.
  • Record a reviewable decision when results are noisy, missing or contradictory.

Workflow

  1. Define the task, representative cases and forbidden outcomes. Use synthetic or approved/redacted data; freeze case IDs and the dataset revision before runs.
  2. Record baseline/candidate prompt digests, exact available model/version, inference settings, tool versions and evaluation environment. Do not hardcode old model-family options or silently change models between comparisons.
  3. Predeclare checks and acceptance rules. Use deterministic schema/field checks for structured output, behavioral checks for tools and a clear human/rubric standard for open text. Similarity does not prove factual or code correctness.
  4. Run matched baseline/candidate cases under the same permissions and budget. Record latency/cost and repeated runs when variability matters. A timeout, missing output or judge error is incomplete, not a pass or a zero-cost result.
  5. Treat judge outputs as evidence with limitations. Blind/randomize presentation where feasible, calibrate against human-labeled examples, and record judge identity/rubric. Do not ask a model to verify private reasoning or accept a judge's confidence as an objective correctness measurement.
  6. Review differences case by case and report the denominators, failures and uncertainty. Keep mandatory safety/schema failures visible even if aggregate similarity improves. Use the predeclared rule, not a threshold selected after results.
  7. Store a redacted report and exact artifacts at an authorized destination. Decide retain/revise/reject for the stated dataset; deployment is separate.

Regression register

Field Type Example / meaning
case_id string PTEST-001; a textual ID, not SERIAL
dataset_revision immutable reference exact case inventory, expected checks and labels
prompt_revision string baseline/candidate digest
model_runtime string exact available ID/version plus settings
check string required JSON fields or approved rubric criterion
result enum pass / fail / incomplete
evidence reference redacted actual output, tool trace or observed check
judge_configuration optional object exact judge ID/rubric/version and calibration limits
latency_ms nonnegative number or null null if not observed; never invented
cost amount/currency or null actual billing basis; unknown remains unknown
run_revision immutable reference binds the report to the actual run

IDs and statuses must have consistent SQL/JSON/CSV representations. Do not store private prompts, user messages or tokens in a public spreadsheet or Notion register.

Worked example

Two cases test a support-answer prompt. PTEST-001 requires an answer grounded in the supplied policy; PTEST-002 requires a structured escalation when the policy is absent. The candidate sounds more helpful but PTEST-002 has no observed result. The report is incomplete, not a win. The following Python 3 helper aggregates already reviewed case statuses; it does not call models or decide correctness.

def summarize_regression(results, expected_case_ids):
    if not isinstance(expected_case_ids, list) or not expected_case_ids:
        return {"status": "incomplete", "reason": "missing case inventory"}
    if any(not isinstance(case, str) or not case for case in expected_case_ids):
        return {"status": "incomplete", "reason": "invalid case IDs"}
    if len(set(expected_case_ids)) != len(expected_case_ids):
        return {"status": "incomplete", "reason": "duplicate expected case IDs"}
    if not isinstance(results, list) or any(not isinstance(row, dict) for row in results):
        return {"status": "incomplete", "reason": "invalid results"}
    by_id = {}
    for row in results:
        case = row.get("case_id")
        if not isinstance(case, str) or case not in expected_case_ids or case in by_id:
            return {"status": "incomplete", "reason": "unexpected or duplicate result"}
        if row.get("result") not in ("pass", "fail", "incomplete"):
            return {"status": "incomplete", "reason": "unknown result"}
        by_id[case] = row["result"]

…
常见问题

什么是“回归”?

回归指的是某些原本正常工作的功能,在修改之后又出现了故障。

需要专门的数据集吗?

需要。你需要一组问题及其答案,作为对比的基准。这组数据应当是固定的,并经过人工审核。

这个工具能替代常规测试吗?

不能。它只针对一种特定类型的测试:检查修改指令后,原有回答是否变差了。

详情

作者的原始描述

Use when comparing prompt changes against a fixed evaluation set: record actual model settings, required checks, missing results, judge limitations and case-level regression evidence.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#3718
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能