Free SKILL.md scraped from GitHub. Clone the repo or copy the file directly into your Claude Code skills directory.
npx versuz@latest install vivekkarmarkar-claude-code-os-skills-ode-solve-juliagit clone https://github.com/VivekKarmarkar/claude-code-os.gitcp claude-code-os/SKILL.MD ~/.claude/skills/vivekkarmarkar-claude-code-os-skills-ode-solve-julia/SKILL.md# ODE Solve Julia — Solve an ODEProblem in Julia
Take a `.jl` file that defines an `ODEProblem` and add a `solve()` call to it. **Nothing more.** No plotting, no analysis, no post-processing.
## Arguments
`<path to .jl file>` — **Required.** Path to a Julia file containing an `ODEProblem` definition.
Examples:
- `/ode-solve-julia exponential_growth.jl`
- `/ode-solve-julia path/to/lotka_volterra.jl`
- `/ode-solve-julia` — no args, look for a `.jl` file in conversation context or the working directory
## What This Skill Does
Takes an existing `.jl` file that defines an `ODEProblem` and generates a new `.jl` file that:
1. Copies the entire problem definition from the source file
2. Adds `sol = solve(prob, Tsit5())`
3. Adds a confirmation `println` block showing retcode, time points, and endpoint values
**That is ALL.** Do not plot. Do not analyze. Do not compute errors. Do not add anything beyond the solve call and confirmation output.
## Reference Examples
Read the reference examples in `reference-examples/` before generating any output:
- `reference-examples/solve_exponential_growth.jl` — Scalar ODE solve
- `reference-examples/solve_lotka_volterra.jl` — System of ODEs solve
**Match their structure exactly.**
## Workflow
### Step 1: Locate the source file
- If a path is provided as an argument, use that file.
- If no path is provided, check:
1. Was a `.jl` file recently generated in this conversation (e.g., by `/ode-problem-julia`)? Use that.
2. Is there a `.jl` file in the current working directory containing `ODEProblem`? Use that.
3. If multiple candidates exist, ask which one.
4. If none found, tell the user: "No ODEProblem file found. Use `/ode-problem-julia` to create one first."
### Step 2: Read and validate the source file
Read the source `.jl` file and verify it contains:
- `using OrdinaryDiffEq` (or `using DifferentialEquations`)
- A right-hand side function (`f` or `f!`)
- `u0` — initial condition
- `tspan` — time span
- `prob = ODEProblem(...)`
If any of these are missing, tell the user the file is not a valid ODEProblem definition.
### Step 3: Generate the solve file
Create a new `.jl` file named `solve_<original_name>.jl` with this structure:
```julia
# =============================================================================
# ODE Solve: <Problem Name>
# =============================================================================
#
# Source: <original_filename>.jl
# ODE: <equation in readable notation>
# IC: <initial condition>
# Domain: <time span>
# Params: <parameter values>
#
# =============================================================================
using OrdinaryDiffEq
# --- Problem definition (from source file) ---
<copy the complete problem definition: f/f!, u0, tspan, p, prob>
# --- Solve ---
sol = solve(prob, Tsit5())
# --- Confirmation ---
println("ODE solved successfully:")
println(" retcode = ", sol.retcode)
println(" t length = ", length(sol.t))
println(" t range = [", sol.t[1], ", ", sol.t[end], "]")
println(" u(0) = ", sol.u[1])
println(" u(end) = ", sol.u[end])
```
### Step 4: Run the file
```bash
julia --pkgimages=no solve_<name>.jl
```
Verify `retcode = Success` in the output. If it fails, diagnose and fix.
## Solver Choice
Use `Tsit5()` as the default solver. It is:
- A 5th-order Runge-Kutta method (Tsitouras 2011)
- The recommended default for non-stiff ODEs in DifferentialEquations.jl
- Equivalent in spirit to MATLAB's `ode45`
**Do not change the solver** unless the problem fails to converge, in which case:
- For stiff problems: switch to `Rodas5()` or `TRBDF2()`
- Note the change in the header comment
## File Naming
The output file is always named `solve_<source_name>.jl`:
- Input: `exponential_growth.jl` → Output: `solve_exponential_growth.jl`
- Input: `lotka_volterra.jl` → Output: `solve_lotka_volterra.jl`
- Input: `my_ode.jl` → Output: `solve_my_ode.jl`
## Rules
1. **Input is a `.jl` file with an ODEProblem.** If no valid file exists, stop and tell the user.
2. **ONLY add solve and confirmation output.** No plotting. No analysis. No error computation. No post-processing.
3. **Read reference examples before generating.** Match their structure exactly.
4. **Use `Tsit5()` by default.** Only change if convergence fails.
5. **Run the file after generating.** Use `julia --pkgimages=no`. Verify `retcode = Success`.
6. **Copy the problem definition verbatim.** Do not modify the RHS function, IC, tspan, or parameters from the source file.
7. **The output file is self-contained.** It must run independently — do not `include()` the source file.