agentleFS
berkeley-humanoidsberkeley-humanoids/Skills/skills/research-code-validation/SKILL.md

research-code-validation

Skill4 starsChanged 34 days agoCC0-1.0View on GitHub

Validate ML/RL research code before expensive runs. Use when building, changing, reviewing, or debugging training frameworks, data pipelines, simulation environments, losses, checkpoints, or evaluation. Use before training/evaluation launch, resume, or scale-up, and for NaNs, silent fallbacks, or suspect metrics. Exclude unrelated application builds, formatting-only edits, and general ML explanations.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 1

    1. berkeley-humanoids/skills★ 4100% same

    Edited · 0

    None found.

    Wrote their own version · 0

    None found.

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository8 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

9 rules. About 0 are common, 7 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Stop invalid experiments early.

    line 8
  2. Distinctive:

    Read project instructions, the entry point, resolved configuration, and relevant tests.

    line 12
  3. Distinctive:

    Keep smoke-test outputs and state separate.

    line 15
  4. Very specific:

    Treat clipping, masking, nan_to_num, reset-on-error, and filtering as explicit algorithm or protocol choices.

    line 24
  5. Distinctive:

    Run the cheapest relevant checks first:

    line 28
  6. Distinctive:

    Read validation patterns for contracts, numerical checks, reproducibility, and recovery details.

    line 39
  7. Distinctive:

    Keep required boundary and finite-loss checks active.

    line 43
  8. Very specific:

    Keep restart/retry budgets in the runner or scheduler.

    line 59
  9. Distinctive:

    If a check fails, fix its scoped cause and repeat it.

    line 67

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Research Code Validation

Stop invalid experiments early. Recover only through a defined procedure that preserves the experiment.

Scope the work

  • Read project instructions, the entry point, resolved configuration, and relevant tests. Identify the objective, data, backend, and run budget.
  • Limit edits and checks to concrete failure modes. Reuse existing validators and runners. Avoid unrelated refactors, speculative abstractions, and full experiments for code review.
  • Reuse passing checks when code, configuration, data, and environment remain unchanged. Repeat checks that a change invalidates.
  • Keep smoke-test outputs and state separate. Start the experiment from its intended initialization or checkpoint.

Preserve failure information

  • Validate inputs at actual boundaries. Avoid duplicate checks for guaranteed internal states.
  • Let unexpected exceptions retain their traceback and nonzero job status. Never replace failures with defaults, zero losses, skipped samples, or silent backend changes.
  • Raise explicit exceptions for required checks. Python can remove assert under -O.
  • Catch specific exceptions only for defined recovery, useful context, or cleanup. Preserve the original cause. Avoid redundant wrappers and logs.
  • Record the step, sample/episode ID, rank, expected contract, and observed value. Make fatal worker errors stop the whole job.
  • Treat clipping, masking, nan_to_num, reset-on-error, and filtering as explicit algorithm or protocol choices.

Validate before scaling

Run the cheapest relevant checks first:

StageEvidence to obtain
Entry checksValidate configuration, data/assets, splits, outputs, checkpoint compatibility, device/backend/precision, and hyperparameters. Reject ignored options. Resolve imports and builds.
One batch or rolloutRun actual preprocessing and inference or simulation. Validate shapes, dtypes, devices, finite values, masks, ranges, units, frames, and timing. Visualize ambiguous data.
Objective and updateValidate the initial-loss baseline, gradient flow, and optimizer update. For RL, validate rewards, actions, resets, termination, and truncation.
Tiny problemFor supervised learning, fit a fixed batch with controlled randomness and regularization. For other objectives, use a controlled task, rollout, or noise sample. Set an objective-specific target. Zero is not universal.
Short end-to-end runExercise the real runner, logging, evaluation accounting, and checkpoint save/load. Test resume and workers when relevant.
Scale-upRun authorized experiments after applicable checks pass. Complete cheaper checks before expensive closed-loop or hardware evaluation. Smoke tests do not prove convergence or correctness.

Read validation patterns for contracts, numerical checks, reproducibility, and recovery details.

Keep runtime checks meaningful

  • Keep required boundary and finite-loss checks active. Validate ordinary gradients before updates. For AMP, inspect unscaled gradients and preserve recorded overflow recovery.
  • Validate intended parameter updates in diagnostics. Allow frozen or conditionally unused parameters. Validate checkpoint state before resume.
  • Limit exhaustive checks and expensive diagnostics to bounded runs. Measure their cost. Use and record comparable validation modes in benchmarks.
  • Repeat a bounded case with controlled RNGs in a pinned setup. Use justified tolerances or repeated-seed statistics. Matching seeds do not guarantee identical curves across systems.

Recover only under a defined contract

EventRequired behavior
Invalid configuration/data, shape error, nonfinite forward loss, or unexpected simulator failureStop and expose the cause. Fix it or document a versioned data/protocol change before retrying.
Transient I/O failureRetry only defined exceptions/statuses with timeouts, bounded backoff, and logs. Preserve operation identity. Prevent duplicate effects. Fail after exhaustion.
Checkpoint write failureRetry or save to an explicit, reported fallback destination. Preserve the last valid checkpoint. Never mark an incomplete save as resumable or successful.
Evaluation failureRetain planned IDs and outcomes. Count task failures per protocol. Mark unresolved infrastructure failures incomplete. Never present surviving cases as the full evaluation.
OOM, backend fallback, or reduced workloadRecord failed and replacement configurations. Treat batch size, precision, backend, environment count, or data changes as explicit experiment changes.
Normal episode termination or documented AMP overflowFollow the algorithm/framework behavior and record counts.

Keep restart/retry budgets in the runner or scheduler. Do not repeat deterministic failures indefinitely or resume from suspect checkpoints. Preserve KeyboardInterrupt and SystemExit.

Finish with evidence

Report commands, configuration, completed checks, results, unresolved failures, and skipped checks with reasons.

Record revision/local changes, resolved configuration, data/split identity, seeds/RNGs, software/hardware/backend, precision, checkpoint lineage, and validation mode in existing run metadata.

If a check fails, fix its scoped cause and repeat it. Continue the authorized run after checks pass. State missing evidence or resources. For active jobs, report running status and log/output location. Do not claim completion or validation without evidence.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.