light-citation
Verify scholarly references and claim-citation support for Light stage 10. Use when auditing…
Light 科研主线 stage 6:把冻结的 question/estimand、experiment matrix、pre-registration 与 data lineage 落成最小可运行、测试先行、无泄漏、可复现且能交给 result-analysis 的实验代码。用于实现或复现训练/预处理/评测, 设计 gold/property/metamorphic 测试,控制 Python/NumPy/框架/CUDA/DataLoader 随机性,审查 train/test 或 CV fit 穿越,记录
$ npx -y skills add Light0305/Light-skills --skill light-experiment-coding --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/light-experiment-codingContext preview
The summary Claude sees to decide when to auto-load this skill.
Light 科研主线 stage 6:把冻结的 question/estimand、experiment matrix、pre-registration 与 data lineage 落成最小可运行、测试先行、无泄漏、可复现且能交给 result-analysis 的实验代码。用于实现或复现训练/预处理/评测, 设计 gold/property/metamorphic 测试,控制 Python/NumPy/框架/CUDA/DataLoader 随机性,审查 train/test 或 CV fit 穿越,记录
name: light-experiment-coding description: >- Light 科研主线 stage 6:把冻结的 question/estimand、experiment matrix、pre-registration 与 data lineage 落成最小可运行、测试先行、无泄漏、可复现且能交给 result-analysis 的实验代码。用于实现或复现训练/预处理/评测, 设计 gold/property/metamorphic 测试,控制 Python/NumPy/框架/CUDA/DataLoader 随机性,审查 train/test 或 CV fit 穿越,记录 config/code/environment/input hashes、stdout/stderr、raw metrics、patient/entity predictions 与 failure artifacts,以及运行 stage-6 checkpoint。数据泄漏或不可复现是 critical;静态扫描和同 seed 两次一致都不证明跨硬件 绝对复现。 metadata: version: 2.2.0-round3 truth_source: ../../docs/competitors/experiment-coding.md resource_map: references/experiment-coding-resource-map.md engine: scripts/experiment_execution_contract.py · scripts/repro_gate.py · scripts/seed_audit.py · scripts/review_gate.py · scripts/run_artifact_check.py emits: light.findings.v1 · light.run_manifest.v3 · raw run bundles consumes: research-plan frozen plan/preregistration/failure-tree report · data-engineering lineage/split_leakage · result-analysis raw-run contract stage: 6
任务不是“写出能跑的 notebook”,而是把上游冻结计划逐行实现成**可证伪、可复跑、可审计**的实验。优先级:
1. 不改研究问题; 2. 不让评估信息进入训练; 3. 能用固定环境与 seed 真复跑; 4. 保留足够 raw evidence,让 result-analysis 自己重算; 5. 代码整洁和速度服从以上约束。
先完整阅读 [`references/experiment-coding-resource-map.md`](references/experiment-coding-resource-map.md)。工具机制见 [`references/tools.md`](references/tools.md),TDD/调试红旗见 [`references/tdd_redflags.md`](references/tdd_redflags.md) 与 [`references/debug_protocol.md`](references/debug_protocol.md)。
开始写码前读取并 hash:
primary outcome、comparison family、exclusion、stopping 已冻结。若实现证明计划不可行,带最小复现和影响返回 research-plan,停下让人决策;不得改 config 默认值静默漂移。
优先复制 [`assets/project-scaffold/`](assets/project-scaffold/):
遵循现有仓库框架和配置格式;不要为一个实验引入付费 IDE、云追踪或私有 key。MLflow/DVC 可选,普通本地文件必须能完成 核心闭环。不可用资源明确写 `UNAVAILABLE:原因`,不假装通过。
在实现 preprocessing/train/eval 前:
1. 写 gold test,验证人工可算的小答案; 2. 写 property test(Hypothesis),验证范围、有限性、对称/单调等不变量; 3. 写 metamorphic test,验证置换/等价变换后的输出关系; 4. 写 train-only-fit 测试,记录 transformer 只收到训练折; 5. 亲眼看新测试因缺实现或真实 bug 失败,再写最小实现使其通过。
浮点断言用 `pytest.approx` / `assert_allclose(rtol, atol)`。先声明 device、dtype、mixed precision 和容差;NaN/Inf 默认 fail。不要测“随机训练一定达到某个漂亮数”,测确定性边界和可重算事实。
`review_gate` 只识别静态形态,会漏/误报;领域语义仍要人工核对。指标异常好,先查 leakage。
分开两个目的:
多 seeds 不是患者/实体样本量,绝不拿 seed 数替代功效分析 n。
按实际使用覆盖 `PYTHONHASHSEED`(当前进程须启动前设)、`random`、NumPy、框架 RNG、CUDA、cuDNN、 deterministic algorithms、DataLoader generator/worker。记录 device/dtype/AMP、线程数、worker 数、排序键和已知 非确定算子。换 seed 应可变但可追溯;同 seed 一致也只支持同环境契约,不外推跨 release/platform/hardware bitwise 保证。
从 [`templates/run_manifest.template.json`](templates/run_manifest.template.json) 生成 `light.run_manifest.v3`;说明见 [`templates/run_manifest.md`](templates/run_manifest.md)。 `termination` 只说明进程为何停止,`completion` 才记录矩阵行 oracle 是否真的通过; timeout / max iterations / cancel 一律不得冒充完成。
每个 matrix row × config × seed × attempt 独立目录,至少保存:
失败 run 不删除,不覆盖成成功。禁止只交 summary CSV;result-analysis 必须能从 raw evidence 重算。
按此顺序真跑并记录 exit code:
python scripts/experiment_execution_contract.py --spec experiment_execution_contract.json \ --report execution_contract_findings.json --json-out execution_contract_report.json python scripts/review_gate.py src/ --json python scripts/seed_audit.py src/train.py src/reproducibility.py python scripts/repro_gate.py --spec repro_spec.json --report repro_findings.json python scripts/run_artifact_check.py --manifest runs/EXP-01/run-a/manifest.json python scripts/run_artifact_check.py --compare \ runs/EXP-01/run-a/manifest.json runs/EXP-01/run-b/manifest.json python ../light-orchestrator/scripts/run_checkpoint.py \ --file .light/passport.yaml --stage 6 --findings repro_findings.json --write --ts <ISO-8601>
`experiment_execution_contract.py` 消费 `light.experiment_execution_contract.v1`(模板见 [`templates/experiment-execution-contract.example.json`](templates/experiment-execution-contract.example.json),故意 fail-closed):核 `as_of`、frozen scope/evaluator/budget、failure-tree handoff、matrix/DAG、run status/termination/failure class、partial checkpoint/resume command、环境与 cache provenance、repro level 分层、远程/付费执行授权。**timeout/OOM/preempted/max-iterations 不得写 completed**;`frozen_at` 与远程授权 `approved_at` 不得来自未来;`decision=NOT_READY/UNKNOWN` 本身阻断推进;run 必须绑定冻结 `matrix_rows` 中的 row,且每个 row 必须绑定 `failure_tree_refs`(hypothesis_ids、branch_action_ids、适用的 guardrail_ids);新增实验行要先回 research-plan 修订;completed run 若上游要求 guardrail,`completion` 必须留下 `guardrail_evidence_artifacts`,否则不得交 result-analysis;实际 walltime/cost/compute_units 与远程预
Repo: Light0305/Light-skills
Verify scholarly references and claim-citation support for Light stage 10. Use when auditing…
Light 科研主线第 2 步·数据工程:**找得到且用得起的数据**(来源/许可/版本/大小/split)+ **提 idea 前先判数据可行性** (数据够不够支撑研究/统计功效)+…
Light 科研主线第 9 步·图表:图服务论点(每图支撑哪条 claim、删了缺什么)+ 出版级规格(栏宽/字号/色盲安全/ 误差棒+n+显著性)+ 视觉诚实(不偷偷截 y 轴/不双…
Light 多格式文件深度理解常驻技能:强大地读 Word / PDF / PPTX / Excel / CSV / 图片 / 视频 / 代码 / 压缩包,**不只提取文字,而是理解结构…
Light 按需工程技能·前端设计:把模糊的「做个好看的界面」落成**能跑的 React/Tailwind/shadcn 代码 + 设计决策说明**——…