equivalence-test
Skill4 starsChanged 6 days agoMITView on GitHub
Tests whether translated code reproduces the source: reference outputs, tolerances, cell-by-cell comparison, edge cases, diagnosis of differences and a verdict.
In this repository210 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/ai-ml-code.mdcCursor rule
- .cursor/rules/code-translation.mdcCursor rule
- .cursor/rules/data-pipelines.mdcCursor rule
- .cursor/rules/documentation.mdcCursor rule
- .cursor/rules/dsge-code.mdcCursor rule
- .cursor/rules/econometrics-code.mdcCursor rule
- .cursor/rules/eviews-code.mdcCursor rule
- .cursor/rules/forecasts.mdcCursor rule
- .cursor/rules/gempack-code.mdcCursor rule
- .cursor/rules/lego-manifests.mdcCursor rule
- .cursor/rules/llm-code.mdcCursor rule
- .cursor/rules/model-code.mdcCursor rule
- .cursor/rules/notebooks-and-scripts.mdcCursor rule
- .cursor/rules/r-code.mdcCursor rule
- .cursor/rules/restricted-data.mdcCursor rule
- .cursor/rules/rl-code.mdcCursor rule
- .cursor/rules/sectoral-trade-climate-code.mdcCursor rule
- .cursor/rules/semi-structural-code.mdcCursor rule
- .cursor/rules/stata-code.mdcCursor rule
- .cursor/rules/tests.mdcCursor rule
- .cursor/rules/validation.mdcCursor rule
- adoptSkill
- ai-auditSkill
- backtestSkill
- build-abmSkill
- build-causal-mlSkill
- build-cgeSkill
- build-climate-macroSkill
- build-deep-forecasterSkill
- build-drl-policySkill
- build-dsgeSkill
- build-financial-programmingSkill
- build-fpasSkill
- build-game-modelSkill
- build-hankSkill
- build-io-samSkill
- build-llm-agentsSkill
- build-llm-pipelineSkill
- build-multicountrySkill
- build-neural-solverSkill
- build-rag-kbSkill
- build-semi-structuralSkill
- build-sfcSkill
- build-trade-modelSkill
- calibrate-modelSkill
- calibration-planSkill
- carbon-pricing-analysisSkill
- chart-packSkill
- climate-scenarioSkill
- code-inventorySkill
- code-reviewSkill
- country-typologySkill
- create-exerciseSkill
- data-requirementsSkill
- debt-decompositionSkill
- debt-sustainabilitySkill
- design-trainingSkill
- distributional-analysisSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
If reference or translated outputs are ABSENT, that comparison is NOT ASSESSED — NO DATA: name what is missing and which skill produces it.
- Very specific: line 29
Collaboration: Follow .claude/docs/collaboration-protocol.md: ask questions first, present options, get approval before writing files, and …
- Distinctive: line 48
Check provenance of reference outputs (software, version, date, command) and run the translation from a clean start.
- Very specific: line 49
Run python tools/translate.py compare <reference-dir> <translated-dir> [--key id year] [--rtol R] [--atol A] --out equivalence/report.md.
- Distinctive: line 51
Run edge cases through both codes where the source can be run.
- Very specific: line 52
If the comparison is part of a translation, run python tools/translate.py verify-source <workspace>.
- Distinctive: line 53
Write the verdict with its evidence.
- Distinctive: line 56
Before comparing: approve outputs and tolerances
- Distinctive: line 57
After comparing: review each explained difference
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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.
Files
<!-- Generated from .claude/skills/equivalence-test/SKILL.md by tools/sync_agents.py. Edit the source, then run the script. -->/equivalence-test — Equivalence Test
Category: Code Translation · Primary agent: translation-equivalence-auditor
Tests whether translated code reproduces the source: reference outputs, tolerances, cell-by-cell comparison, edge cases, diagnosis of differences and a verdict.
Arguments: whatever the user wrote after the command name.
Purpose
Show, with evidence, whether two codes compute the same thing: a translation and its source, two implementations of a model, or a code before and after refactoring. Outputs are compared at full precision with tolerances fixed in advance (python tools/translate.py compare), differences are traced to their first point of divergence, and the auditor issues a verdict. The output is an equivalence report.
Use it when a translation or refactor is finished or disputed, or two implementations of the same model disagree.
Do not use it when there are no reference outputs and no way to produce them; record NOT ASSESSED — NO REFERENCE OUTPUTS instead.
Before you start
- Check required inputs. For each input below record
FOUNDorABSENT(never 'assumed'):- Reference outputs (from the source)
- Translated outputs (from a clean-start run of the translation)
- Tolerances (from the plan, or agreed now before comparing)
If reference or translated outputs are
ABSENT, that comparison isNOT ASSESSED — NO DATA: name what is missing and which skill produces it.
- Check confidentiality. Identify the classification of the outputs (
.claude/docs/confidentiality-and-ai-use.md). - Collaboration. Follow
.claude/docs/collaboration-protocol.md: ask questions first, present options, get approval before writing files, and updateproduction/session-state/active.mdafter each approved section.
Agents
translation-equivalence-auditor— primary agent; designs the test, compares and gives the verdictreplication-auditor— Checks the provenance of reference outputs and the clean-start runreproducibility-engineer— Sets up the clean environment for both runs
Each agent is defined in .claude/agents/<name>.md. If your tool runs subagents, run these agents as subagents, in parallel where the steps are independent; otherwise read each agent's file and apply its instructions in turn. Subagents only write to the paths named in your instructions.
Key design decisions (present options, let the user choose)
| Decision | Typical options | What it changes |
| Tolerances | exact; relative 1e-6; 1e-4 for solvers; by output | Pass criteria |
| Matching rows | by order; by key columns | Robustness to sorting differences |
| Random draws | source draws read by the target; distribution tests | What "equal" means for simulations |
| Edge cases | normal run only; plus constructed edge inputs | Coverage |
Workflow
- Fix the outputs to compare and the tolerances before looking at results; record them.
- Check provenance of reference outputs (software, version, date, command) and run the translation from a clean start.
- Run
python tools/translate.py compare <reference-dir> <translated-dir> [--key id year] [--rtol R] [--atol A] --out equivalence/report.md. Files are matched by name; use--pair ref.csv=new.csvwhen names differ. - For each difference, compare intermediate outputs in order to find where the codes diverge; classify the cause (translation error, default, numerical tolerance, library version, source bug).
- Run edge cases through both codes where the source can be run.
- If the comparison is part of a translation, run
python tools/translate.py verify-source <workspace>. - Write the verdict with its evidence.
Checkpoints with the user
- Before comparing: approve outputs and tolerances
- After comparing: review each explained difference
Common pitfalls
- Changing tolerances after seeing the differences
- Comparing display-rounded outputs
- Treating any difference below the eye's resolution as rounding without finding the cause
Output
translations/<name>-to-<target>/equivalence/report.md (or validation/<model>/equivalence-report.md outside a translation)
The report gives tolerances, per-file results with maximum differences, the diagnosis of each difference and the verdict.
Gate / verdict
- EQUIVALENT, EQUIVALENT WITH EXPLAINED DIFFERENCES, NOT EQUIVALENT, or NOT ASSESSED
Suggested next steps
/validate-model/replicate/model-release
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
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.

