返回 Skill 列表
extension
分类: 开发与工程无需 API Key

determinism

在使用代码而不是LLM判断来验证结果、通过哈希版本化提示或确保可重现的代理行为时使用。对于任何关键验证都要加载。脚本返回布尔类型的退出代码,而不是主观评估。提示使用带有SHA256验证的语义化版本控制。

person作者: jakexiaohubgithub

Determinism

Reproducible outcomes through code verification and prompt versioning.

Core Principle

"Claude can run scripts without loading either the script or the PDF into context. And because code is deterministic, this workflow is consistent and repeatable." - Anthropic Engineering

Instructions

  1. Replace LLM judgment with script verification
  2. Version prompts with semantic versioning
  3. Hash-validate critical prompts: scripts/validate-prompt.sh
  4. Use exit codes (0 = pass, 1 = fail), not text

LLM Judgment vs Code Verification

| Task | LLM (Bad) | Code (Good) | |------|-----------|-------------| | Tests passed? | "The tests appear to pass" | pytest; echo $? → 0 or 1 | | Valid JSON? | "This looks like valid JSON" | python -c "json.load(f)" | | Server running? | "The server should be up" | curl -s localhost/health |

References

| File | Load When | |------|-----------| | references/code-verification.md | Writing verification scripts | | references/prompt-versioning.md | Versioning/hashing prompts |