prototyping

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Prototyping

原型设计

Trigger

触发条件

Activate on
/prototyping
, a request to prototype a decision or compare options through a prototype, or a request to keep prototyping through a host session. Keep this stance until the client says to stop. Treat one-off "prototype this" work as a one-step session.
在
/prototyping
、要求对某个决策进行原型设计或通过原型比较选项,或要求通过 host 会话持续进行原型设计时激活。在 client 表示停止之前,持续保持此工作方式。将一次性的“prototype this”任务视为单步会话。

Scope

范围

Own the prototyping session directory, shell, step pages, manifest, and loopback serving. The host owns its questions and plan; the client owns each decision. Leave the discussed repository unchanged and stop before implementing a selected option.
负责原型设计会话目录、shell、步骤页面、manifest 和 loopback 服务。host 负责自己的问题和计划;client 负责每个决策。保持所讨论的仓库不变,并在实现选定选项之前停止。

Inputs

输入

  • Host steps as they occur, including Consultant or Autoconsultant questions, each Grilling question, Wayfinder ticket questions, and plain choices.
  • A client-named slug or path to resume. Fresh requests never inspect sibling sessions.
  • A client-supplied state root, or expanded
    ~/.prototyping
    by default.
  • 随着 host 步骤执行而收到的输入,包括 Consultant 或 Autoconsultant 问题、每个 Grilling 问题、Wayfinder 工单问题以及普通选项。
  • client 指定的用于恢复会话的 slug 或路径。新请求绝不检查同级会话。
  • client 提供的状态根目录,或默认使用展开后的
    ~/.prototyping
    。

Roles

角色

The agent builds pages, maintains the manifest, and keeps serving alive. The client chooses options. Host skills keep their own output contract unchanged.
Agent 构建页面、维护 manifest 并让服务保持运行。client 选择选项。host skills 保持各自的输出约定不变。

Procedure

过程

  1. On activation, resolve one session directory. Resume only an explicitly named slug or path. Otherwise choose a direct lowercase-hyphen slug from the topic without listing or reading siblings. Create
    steps/
    and initialize
    steps.js
    with exactly
    window.STEPS = [];
    when absent. Copy
    assets/index.html
    once when absent and replace its
    __SESSION_SLUG__
    placeholder with the slug. Run this skill's shipping
    scripts/serve.sh <session-dir>
    in place; never copy the helper into the session directory.
  2. For every host step, assign the next monotonic integer
    n
    across the whole session. Preserve the host's label:
    Question N
    ,
    Qn
    ,
    Qn (ticket: <name>)
    , or an empty string for a plain host.
  3. Enumerate substantive options before applying the gate. Consultant and Autoconsultant use number strings and exclude trailing
    Other
    . Grilling, Wayfinder, and plain hosts use
    A
    ,
    B
    , and later letters in presentation order. A prototype has two to five options. A step without enumerable choices uses
    options: []
    and
    recommended: null
    .
  4. Build a prototype only when the enumerated options differ in a way the client can see or click. Visible structural choices use the UI shape; behavioral choices use the logic shape. Read the step-page contract before building either. Text-only, naming, numeric, approval, and other non-visible choices use a stub and have no step file.
  5. Append exactly one line per step to
    steps.js
    :
    window.STEPS.push({...});
    . The object contains
    n
    ,
    label
    , one-line
    title
    ,
    host
    ,
    kind
    ,
    file
    ,
    options
    ,
    recommended
    , and
    decision
    . Use valid compact JSON inside the call.
    kind
    is
    prototype
    or
    stub
    ;
    file
    is
    steps/NN-<lowercase-hyphen-step-slug>.html
    for a prototype and
    null
    for a stub. Start
    decision
    as
    null
    .
    options
    is always a JSON array of objects shaped exactly
    {"key":"1","label":"Option label"}
    ; never use an array of bare keys, even when the page already shows labels.
  6. Run this skill's shipping
    scripts/serve.sh <session-dir>
    in place before rendering the host reply. Put exactly one line immediately above the complete host reply. A single-step host gets
    Prototypes: <URL>#<n>
    . A multi-question round gets
    Prototypes: <URL>#<n> #<n> ...
    with every round entry, including stubs. The host text below that line stays byte-identical, and the line never enters the host's fenced question block. An activation-only turn prints
    Prototypes: <URL>
    with no hash.
  7. When the client answers, edit only that entry's line and set
    decision
    to the option key or the client's exact free-text answer before adding the next step. Keep the rest of the line's data unchanged.
  8. On
    stop prototyping
    , leave the files and server running, report the current URL and the resolved shipping helper command
    <skill-dir>/scripts/serve.sh <session-dir> stop
    , then drop this stance. Never copy that helper into the session. Later host steps receive no entry or
    Prototypes:
    line.
  1. 激活时,确定一个会话目录。仅当明确指定 slug 或路径时才恢复会话。否则,根据主题直接选择一个小写连字符 slug,不列出或读取同级会话。创建
    steps/
    ;若
    steps.js
    不存在,则使用完全一致的
    window.STEPS = [];
    对其进行初始化。仅当
    assets/index.html
    不存在时将其复制一次,并把
    __SESSION_SLUG__
    占位符替换为该 slug。在原地运行本 skill 随附的
    scripts/serve.sh <session-dir>
    ;绝不把辅助脚本复制到会话目录中。
  2. 为每个 host 步骤在整个会话范围内分配下一个单调递增的整数
    n
    。保留 host 的标签:
    Question N
    、
    Qn
    、
    Qn (ticket: <name>)
    ,普通 host 则使用空字符串。
  3. 在应用 gate 前枚举所有实质性选项。Consultant 和 Autoconsultant 使用数字字符串,并排除末尾的
    Other
    。Grilling、Wayfinder 和普通 host 按展示顺序使用
    A
    、
    B
    和后续字母。每个原型有两个到五个选项。无可枚举选择的步骤使用
    options: []
    和
    recommended: null
    。
  4. 仅当枚举出的选项存在 client 可以看到或点击的差异时,才构建原型。可见的结构性选择使用 UI 形态;行为性选择使用逻辑形态。构建任一种页面前,读取 step-page 约定。纯文本、命名、数值、审批及其他不可见选择使用 stub,且不生成步骤文件。
  5. 每个步骤向
    steps.js
    恰好追加一行:
    window.STEPS.push({...});
    。该对象包含
    n
    、
    label
    、单行
    title
    、
    host
    、
    kind
    、
    file
    、
    options
    、
    recommended
    和
    decision
    。调用内使用有效的紧凑 JSON。
    kind
    为
    prototype
    或
    stub
    ;原型的
    file
    为
    steps/NN-<lowercase-hyphen-step-slug>.html
    ,stub 的
    file
    为
    null
    。
    decision
    初始值为
    null
    。
    options
    始终是一个 JSON 对象数组,其结构必须完全为
    {"key":"1","label":"Option label"}
    ;即使页面已显示标签,也绝不能使用裸键数组。
  6. 在呈现 host 回复之前,在原地运行本 skill 随附的
    scripts/serve.sh <session-dir>
    。在完整 host 回复正上方恰好放置一行。单步 host 使用
    Prototypes: <URL>#<n>
    。多问题轮次使用
    Prototypes: <URL>#<n> #<n> ...
    ,并列出该轮所有条目,包括 stub。该行下方的 host 文本保持逐字节一致,并且该行绝不进入 host 的围栏问题块。仅激活的轮次打印
    Prototypes: <URL>
    ,不带 hash。
  7. client 回答时,只编辑对应条目的行,并在添加下一步骤前将
    decision
    设置为选项键或 client 的原样自由文本回答。该行其余数据保持不变。
  8. 执行
    stop prototyping
    时,让文件和服务器继续运行;报告当前 URL 以及解析后的随附辅助命令
    <skill-dir>/scripts/serve.sh <session-dir> stop
    ,然后退出此工作方式。绝不将该辅助脚本复制到会话中。后续 host 步骤不会获得条目或
    Prototypes:
    行。

Outputs

输出

One
~/.prototyping/<slug>/
or redirected session containing the shell, append-shaped manifest, optional self-contained step pages,
server.port
,
server.pid
, and
server.log
, plus the served loopback URL and recorded decisions.
一个
~/.prototyping/<slug>/
或重定向会话,包含 shell、追加式 manifest、可选的自包含步骤页面、
server.port
、
server.pid
和
server.log
,以及所提供服务的 loopback URL 和已记录的决策。

Exceptions

异常情况

If serving fails after the script's retries, report the session path and its one reason line, keep building the files, and omit an unverified URL. If a named session does not exist, ask only for the intended slug or path without inspecting siblings.
如果脚本重试后仍无法提供服务,报告会话路径及其单行原因,继续构建文件,并省略未经验证的 URL。如果指定的会话不存在,只询问预期的 slug 或路径,不检查同级会话。

QC

质量检查

  • Every active host step has one unique monotonic entry, and every answered entry has its decision set before the next step.
  • Each
    prototype
    file exists, is self-contained, and has exactly one selector per manifest option with accurate recommended and chosen markers.
  • Each
    stub
    has
    file: null
    ; pagination uses
    n
    , while labels preserve host numbering.
  • The exact
    /index.html
    URL answers on
    127.0.0.1
    ; the recorded PID belongs to
    http.server
    serving the canonical session directory.
  • The shell title shows the resolved session slug, never the literal
    __SESSION_SLUG__
    placeholder.
  • The session contains only
    index.html
    ,
    steps.js
    ,
    steps/
    , and
    server.port
    ,
    server.pid
    , and
    server.log
    ; no helper script is copied in.
  • No task file was written outside the resolved session directory, and host text below the one added line is byte-identical.
  • 每个活跃 host 步骤都有一条唯一且单调递增的条目,并且每个已回答条目都在下一步骤之前设置其 decision。
  • 每个
    prototype
    文件都存在且为自包含文件,manifest 中每个选项都恰好有一个 selector,并带有准确的 recommended 和 chosen 标记。
  • 每个
    stub
    的
    file
    均为
    null
    ;分页使用
    n
    ,标签则保留 host 编号。
  • 精确的
    /index.html
    URL 在
    127.0.0.1
    上作出响应;记录的 PID 属于从规范会话目录提供服务的
    http.server
    。
  • shell 标题显示解析后的会话 slug,绝不显示字面量
    __SESSION_SLUG__
    占位符。
  • 会话只包含
    index.html
    、
    steps.js
    、
    steps/
    ,以及
    server.port
    、
    server.pid
    和
    server.log
    ;其中没有复制辅助脚本。
  • 解析后的会话目录之外未写入任何任务文件,且新增一行下方的 host 文本逐字节一致。

References

参考资料

Read references/step-page.md whenever the gate calls for a UI or logic prototype page.
当 gate 要求生成 UI 或逻辑原型页面时,读取 references/step-page.md。