S6-04 · 基础S6-04 · Foundation

提示模板 · 把稳定规则与变量分开,才能校验与版本化Prompt Template · Separate Stable Rules from Variables to Validate and Version Them

stable instruction + typed variables + validation rules + field-level version diff

提示模板(Prompt Template)把稳定指令与可替换变量组织成可复用、可测试的输入结构。模板化让提示从手艺变成可版本化资产。A prompt template organizes stable instructions and replaceable variables into a reusable, testable input structure. Templating turns prompt craft into a versioned asset.

01 · 同一份表格,为什么有人总填错01 · Same form, recurring mistakes

如果 task、受众和字数都藏在一段自由文本里,系统怎样在发送前发现漏填、越界,甚至有人把“忽略规则”塞进变量?If task, audience, and length all hide inside free text, how can a system catch missing values, invalid ranges, or an “ignore the rules” injection before sending?

02填写变量并触发缺失、越界与注入校验,再逐字段比较 v1 / v2Fill Variables, Trigger Three Validation Failures, and Compare v1 / v2 Field by Field

变量 Schema · 版本差异variable Schema · version diff
状态 AMetric A
状态 BMetric B
状态 CMetric C

所有概率、命中率、得分与输出均为固定种子的教学模拟,不代表真实模型。拖回主变量即可复核结论。All probabilities, hit rates, scores, and outputs are fixed-seed teaching simulations, not real model output. Move the main variable back to verify the conclusion.

03把刚才的变化拆成 4 个零件Break the Change into Four Parts

Prompt Template
STABLE

稳定指令Stable instruction

不随每次请求变化,定义共同任务骨架。Defines the shared task skeleton and stays fixed across requests.

VARIABLES

可替换变量Replaceable variables

task、audience、output_limit 各有边界。task, audience, and output_limit each have explicit bounds.

VALIDATE

输入校验Input validation

缺失、越界与注入模式在渲染前阻断。Missing values, invalid ranges, and injection patterns are blocked before rendering.

VERSION

版本差异Version diff

变更按字段记录,不靠肉眼比较整段文字。Changes are recorded by field instead of eyeballing whole prompts.

04最小机制:主交互能逐项验证Minimal Mechanism: Verify Each Link in the Interaction

MECHANISM
render_allowed = required_present ∧ ranges_valid ∧ injection_check_passed
主交互保持模板骨架不动,只改三个变量;任一校验失败都会在字段级比较图中标红并阻断渲染。The template skeleton stays fixed while three variables change. Any validation failure turns its field red and blocks rendering.
分离骨架Separate skeleton稳定指令 + 变量槽stable instruction + slots
机械校验Validate类型、范围、注入模式types, ranges, injection patterns
版本发布Version逐字段可审计差异auditable field-level changes

05把“忽略之前指令”写进 task 变量Put “Ignore Previous Instructions” in the task Variable

主动制造失败Create a failure

边界实验Boundary experiment

变量是数据入口,不应获得改写上层规则的权限。点击后,input_guard 必须阻断模板渲染。A variable is a data entry point, not permission to rewrite higher-level rules. The input guard must block rendering.

尚未执行。先在主交互中观察正常机制。Not run yet. Observe the normal mechanism in the main interaction first.
模板只是复制粘贴一段文字。A template is just copied text.→ ✓ 模板应有变量 Schema、校验与版本记录。A template needs a variable Schema, validation, and version history.
变量能填进去就可以发送。Any value that fits can be sent.→ ✓ 必填、范围与注入模式都要在渲染前检查。Required fields, ranges, and injection patterns must be checked first.
比较两个版本只看最终字符串。Compare versions only by final strings.→ ✓ 逐字段差异才能定位行为变化来自哪里。Field-level diffs reveal where behavior changed.
06 · 一句话带走06 · One line to keep

提示模板把稳定指令与变量分开;只有通过必填、范围和注入校验的变量才能渲染,而版本变化要逐字段审计。A prompt template separates stable instructions from variables. Only validated values may render, and version changes should be audited field by field.