Simulation Safety
DevelopmentSimulation Safety is an Agent Skill for development published in the RocketPy-Team/RocketPy repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Use when editing rocketpy/simulation code, including Flight state updates, Monte Carlo orchestration, post-processing, or cached computations. Covers simulation state safety, unit/reference-frame clarity, and regression checks.
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/RocketPy-Team/RocketPy/blob/HEAD/.agents/skills/simulation-safety/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/simulation-safety, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Simulation Safety Guidelines
- Keep simulation logic inside
rocketpy/simulationand avoid leaking domain behavior that belongs inrocketpy/rocket,rocketpy/motors, orrocketpy/environment. - Preserve public API behavior and exported names used by
rocketpy/__init__.py. - Prefer extending existing simulation components before creating new abstractions:
flight.py: simulation state, integration flow, and post-processing.monte_carlo.py: orchestration and statistical execution workflows.flight_data_exporter.pyandflight_data_importer.py: persistence and interchange.flight_comparator.py: comparative analysis outputs.
- Be explicit with physical units and reference frames in new parameters, attributes, and docstrings.
- For position/orientation-sensitive behavior, use explicit conventions (for example
tail_to_nose,nozzle_to_combustion_chamber) and avoid implicit assumptions. - Treat state mutation carefully when cached values exist.
- If changes can invalidate
@cached_propertyvalues, either avoid post-computation mutation or explicitly invalidate affected caches in a controlled, documented way. - Keep numerical behavior deterministic unless stochastic behavior is intentional and documented.
- For Monte Carlo and stochastic code paths, make randomness controllable and reproducible when tests rely on it.
- Prefer vectorized NumPy operations for hot paths and avoid introducing Python loops in performance-critical sections without justification.
- Guard against numerical edge cases (zero/near-zero denominators, interpolation limits, and boundary conditions).
- Do not change default numerical tolerances or integration behavior without documenting motivation and validating regression impact.
- Add focused regression tests for changed behavior, including edge cases and orientation-dependent behavior.
- For floating-point expectations, use
pytest.approxwith meaningful tolerances. - Run focused tests first, then broader relevant tests (
make pytestandmake pytest-slowwhen applicable).
See:
docs/development/testing.rstdocs/development/style_guide.rstdocs/development/setting_up.rstdocs/technical/index.rst