- Home
- Skills
- Testing & Debugging
- Physics Simulator Vitest Verification
Works with the AI Agents you already use
Physics Simulator Vitest Verification
by Andres Lopez
Prove your physics simulation obeys real-world laws with rigorous math tests using Vitest and TypeScript.
$4
What it does
- Writes tests that check for energy conservation over thousands of simulation steps
- Detects math errors across 25 orders of magnitude using relative error formulas
- Verifies vector calculus rules like zero divergence to ensure field accuracy
- Calculates convergence rates to prove your math gets more accurate as you refine it
- Creates benchmarks for physical constants and standard SI units to prevent unit errors
Who it's for
Educational software developers building physics labs
Verify that your virtual experiments follow real laws of nature before students use them.
Try asking: “Write tests for a virtual pendulum to make sure gravity and energy loss are calculated correctly.”
Scientific simulation researchers using TypeScript
Stop relying on visual checks and start using math to prove your simulation works.
Try asking: “Create a test suite for a magnetic field simulation that checks for zero divergence.”
Game developers building realistic engines
Ensure your game physics are stable over thousands of steps without exploding.
Try asking: “Check if my car suspension physics drift or lose energy over a long simulation run.”
Physics Simulator Vitest Verification
Example session with this skill installed
I have a TypeScript simulation for a solar system. I need Vitest tests to make sure the planets don't lose energy and follow the right math over a long time.
- Read your context and instructions
- Compiled the physics simulator vitest
I will help you build a verification suite for your solar system simulation. We will focus on energy conservation (making sure the planets don't spiral in or out) and unit accuracy.
- Relative Error Helper: I will add a
relErrfunction. This ensures that a tiny rounding error in a planet's position doesn't cause a test to fail or pass incorrectly. - Conservation of Energy: We will run a 200,000-step test. This checks if the total kinetic and potential energy stays the same. If it drifts more than
1e-9, the test will fail. - Orbital Stability: I'll write a test for "Störmer closest approach" to verify that planets return to their original distance from the sun as expected by physics.
import { describe, it, expect } from 'vitest';
import { World, Planet } from './solar-system';
const relErr = (actual: number, expected: number) => Math.abs(actual - expected) / Math.abs(expected);
describe('Solar System Physics', () => {
it('should conserve total orbital energy over 200,000 steps', () => {
const world = new World();
const planet = new Planet({ mass: 100, position: [1, 0, 0], velocity: [0, 1, 0] });
world.add(planet);
const initialEnergy = world.getTotalEnergy();
for (let i = 0; i < 200000; i++) world.step();
const finalEnergy = world.getTotalEnergy();
expect(relErr(finalEnergy, initialEnergy)).toBeLessThan(1e-9);
});
});
Does this cover the planets you have currently defined, or should we add specific checks for things like gravitational softening or multiple moons?
Connects securely to your tools. The creator never sees your data.
About this skill
This skill helps you prove that your scientific or physics software follows the laws of nature. It moves beyond simple visual checks to verify that your math is actually right. Your AI agent will help you write tests that check for energy conservation, correct units, and mathematical accuracy across different scales.
How it works
- You describe the physics law or simulation you are building to your AI agent.
- The skill analyzes the math and suggests specific checks like energy balance or vector calculus rules.
- Your AI agent writes code using the Vitest tool to run these checks automatically.
- You get a set of tests that tell you exactly where your math fails, even after thousands of steps.
Frameworks & tools
This skill works with the Vitest testing tool and TypeScript code. It uses mathematical formulas for things like electromagnetism, gravity, and calculus to check your work.
Why this beats prompting it yourself
Standard AI prompts often suggest "close enough" checks that fail when numbers get very small or very large. This skill uses scientific error math that works across all scales. It also knows how to test for "drift" where a simulation slowly breaks over time, which a normal chat would miss.
Use cases
- Proving a satellite simulation keeps its orbit perfectly over 100,000 steps.
- Checking that a magnetic field simulation doesn't "leak" energy.
- Verifying that doubling a time step changes the error exactly by the predicted amount.
- Making sure a physics engine handles zero gravity or tiny particles without crashing.
Known limitations
This skill works specifically with Vitest and TypeScript. It is meant for checking math and logic, not for testing how things look on a screen or visual animations.
This skill implements a 7-pillar verification workflow for TypeScript scientific simulations. It focuses on Vitest-based testing of numerical integrators (like Boris Pusher/RK4), symplectic stability, and vector calculus identities ($\nabla\cdot\mathbf{B} = 0$). It generates code using relative error (relErr) instead of toBeCloseTo to handle SI unit scaling. It includes logic for calculating $O(h^p)$ convergence rates and provides templates for long-horizon conservation testing and independent quadrature cross-checks.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed today
Permissions
No special permissions declared or detected
What's inside
Frequently Asked Questions
New in Testing & Debugging
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.