Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

hardening-research-code

БесплатноЗапускает вложенные скриптыНе проверен

Use when research or scientific code must be shown correct before its numbers are relied on, as in a paper. Triggers: harden this code, is this numerically…

uw-ssecот uw-ssec★ 33 звезды на GitHub

Об этом скилле

Hardening Research Code

Make research code trustworthy: state what "correct" means, test it, and show each test can fail. Default mode: Direct (protocol: ai-research-workflows:using-research-workflows). Not for provenance (ai-research-workflows:ensuring-reproducibility), plan checks (ai-research-workflows:validating-implementations) or pytest mechanics (scientific-python-development:python-testing).

Iron Law: a regression baseline is not a correctness check

Pinned outputs prove only that behavior hasn't changed. Before pinning, check whether an analytic, reference, published or invariant criterion (table below) is reasonably derivable; test against it first. Label every pinned value not checked against an independent reference UNVERIFIED, in the test and its data file, and tell the user it shows no change, not correctness. Recovering known parameters from synthetic data checks the method, not the pinned values.

Quick Reference: correctness criteria

Criterion Example Test shape
Analytic / closed form on-bin sine: one nonzero one-sided bin exact expected value
Reference implementation numpy, scipy, astropy same input, both outputs
Published result a paper's table reproduce within its stated error
Invariant / property Parseval; weights ≥ 0, sum to 1 many inputs plus edge cases
Stability shuffled order, float32 vs float64 bounded, numbers reported
Regression (fallback) current outputs pinned, UNVERIFIED unless verified

Tolerances

Never use exact float equality:

assert abs(result - expected) <= atol + rtol * abs(expected)

Derive the bound from the numerics, starting at atol ≈ N · eps · scale (N accumulating operations; for a sum, scale is Σ|xᵢ|), and widen it only for a documented reason (solver tolerance, truncation error, stochastic variance). Justify every bound in the test, including atol and near-zero thresholds. Never tune a tolerance to make a failing test pass.

Workflow

  1. Pick criteria; state each in its test's docstring.
  2. Write one small test per criterion, on observable outputs, across inputs that break numerics (even and odd sizes, float32, edge cases). Read references/techniques.md first.
  3. Run, then see each test fail. Perturb the expected value or input, watch it go red, restore, watch it go green. A test never seen to fail proves nothing.
  4. A test failing on the current code is a finding, not a test to loosen. Report criterion, expected and actual values, and note the defect in the test's docstring. Fix the code only when the cause is clear and in scope; otherwise leave it failing and ask.
  5. Report tolerances, reference-data location, pass/fail, seen-to-fail evidence, perturbation numbers and UNVERIFIED baselines.

Red flags: STOP, you're locking in a wrong result

Thought Reality
"Looks plausible, I'll pin it" Check a reference, or label it UNVERIFIED.
"It's been right for years" Untested isn't verified.
"== is fine, same machine" CI and the next person aren't.
"Widen rtol so CI passes" A bound fitted to the result hides the bug. Derive it.
Полный SKILL.md на GitHub

Установить hardening-research-code в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

evals/evals.jsonevals/files/fit-model/data/decay.csvevals/files/fit-model/fit_model.pyevals/files/mass-balance/mass_balance.pyevals/files/pendulum/pendulum.pyevals/files/solver/docs/rse/specs/plan-solver.mdevals/files/solver/src/__init__.pyevals/files/solver/src/solver.pyevals/files/spectral/spectral_power.pyevals/files/weights/src/__init__.pyevals/files/weights/src/pipeline.pyevals/files/weights/src/weights.pyreferences/techniques.mdskill-card.md

FAQ

Что делает скилл hardening-research-code?

Use when research or scientific code must be shown correct before its numbers are relied on, as in a paper. Triggers: harden this code, is this numerically correct, golden test, regression baseline, known analytic result, tolerance, float equality, numerical stability. Not for capturing provenance (use ensuring-reproducibility) or pytest setup (use python-testing).

Как установить скилл hardening-research-code?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл hardening-research-code запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить hardening-research-code с