简介
Science Sim Author
原始描述
Generate self-contained interactive science simulations as a single index.html from a SimSpec YAML or JSON. Use when the user asks for physics, chemistry, bi...
通过你的 Agent 添加
安装目录:science-sim-author/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: science-sim-author description: Generate self-contained interactive science simulations as a single index.html from a SimSpec YAML or JSON. Use when the user asks for physics, chemistry, biology, or STEM demos with parameter sliders, plots, inquiry worksheets, data export, or PhET-style activities. homepage: https://clawhub.ai user-invocable: true metadata: {"openclaw":{"requires":{"bins":[],"env":[],"config":[]},"os":["darwin","linux","win32"]}}
Science Simulation Author
Core promise
Generate one self-contained index.html that runs offline, renders a STEM simulation on a 2D canvas, exposes model parameters as sliders, plots a time series, and includes an inquiry worksheet.
Inputs
Accept a SimSpec in YAML or JSON with:
id,title,domainstate,params,initial,equations,outputs- optional
level,dt,worksheet,success_criteria
Validate against templates/sim_spec_schema.json before generating anything.
Output contract
- Produce exactly one file named
index.html. - Keep all CSS in
<style>and all JS in<script>. - Do not use bundlers, package managers, CDNs, external fonts, or runtime network access.
- Include these DOM ids:
simCanvas,plotCanvas,runToggle,stepBtn,resetBtn,dtSlider,paramControls,readouts,statusBanner,worksheet,copyJsonBtn,downloadCsvBtn. - Include controls, readouts, one time-series plot, local JSON snapshot export, local CSV download, and a non-empty worksheet.
Workflow
- Validate the incoming SimSpec against templates/sim_spec_schema.json.
- Normalize the spec:
- If
dtis missing, usedefault=0.01,min=0.001,max=0.05. - If a parameter omits
step, derivestep=(max-min)/100with sensible rounding. - Normalize derivative aliases such as
dx,dy,dvx,dvy,dq,dvcto canonicald<stateName>keys before generating JS. - Default readouts to
tplus every state variable in state order.
- If
- Choose the renderer:
mechanics+ state includesxandy->trajectory2dmechanics+ state includesxandv->oscillator1delectromagnetism+ state includesqorvc->circuit_rc- Otherwise stop and ask the user for a clearer SimSpec instead of guessing.
- Populate templates/sim_single_file_html_template.html with pre-normalized values.
- Run rubrics/validation_checklist.md before returning the final
index.html.
Template placeholders
Populate these mustache variables:
sim_id,sim_title,domain,level,renderer_kindstate_json,params_json,initial_json,equations_json,outputs_jsonworksheet_json,success_criteria_json,readout_fields_jsondt_default,dt_min,dt_maxmodel_step_logic_js,scene_draw_js,readout_map_js
Expectations:
- JSON placeholders must be serialized before insertion.
- String placeholders used in data attributes should be plain strings.
model_step_logic_jsmust return a derivative object without usingevalorFunction.scene_draw_jsandreadout_map_jsmay be no-ops; usereturn [];for an empty readout override.
Rendering and model rules
- Use the shared RK4 and Euler integrators already present in the template.
- Keep physics fixed-step and rendering on
requestAnimationFrame. - Auto-pause if any state becomes
NaNorInfinity. - Cap trail history and plot history.
- Prefer one clear plot target from
outputs; if multiple plots are supplied, use the first one for the visible plot and keep the rest only as metadata.
Worksheet rules
- If the SimSpec provides a worksheet, keep it unless it is incomplete.
- If any worksheet category is missing, synthesize it using rubrics/pedagogy_inquiry_prompts.md.
- Always return:
- 3 Predict prompts
- 2 Test prompts
- 2 Explain prompts
- 2 Misconceptions prompts
Safety rules
Apply rubrics/security_notes.md strictly.
- Do not tell the user to run shell commands.
- Do not request secrets or API keys.
- Do not fetch remote assets or scripts.
- Do not add hidden telemetry or analytics.
- Do not produce multiple files.
Templates and references
- Template: templates/sim_single_file_html_template.html
- Schema: templates/sim_spec_schema.json
- Validation checklist: rubrics/validation_checklist.md
- Pedagogy prompts: rubrics/pedagogy_inquiry_prompts.md
- Security notes: rubrics/security_notes.md
Examples
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。