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-problem-juliagit clone https://github.com/VivekKarmarkar/claude-code-os.gitcp claude-code-os/SKILL.MD ~/.claude/skills/vivekkarmarkar-claude-code-os-skills-ode-problem-julia/SKILL.md# ODE Problem Julia — Define an ODEProblem in Julia
Define an ODE initial value problem using Julia's `OrdinaryDiffEq.jl` package. This skill extracts the differential equation, initial condition, independent variable domain, and parameters — then generates a `.jl` file that defines the `ODEProblem`. **Nothing more.** No solving, no plotting, no analysis.
## Arguments
`<path to .pdf or .tex file>` — Optional path to a document containing the ODE information.
Examples:
- `/ode-problem-julia path/to/derivation.pdf`
- `/ode-problem-julia path/to/notes.tex`
- `/ode-problem-julia` — no args, conduct user interview
## What This Skill Does
Generates a single `.jl` file containing:
1. `using OrdinaryDiffEq`
2. The right-hand side function `f(u, p, t)` (scalar) or `f!(du, u, p, t)` (system)
3. The initial condition `u0`
4. The time span `tspan`
5. The parameter vector `p`
6. `prob = ODEProblem(f, u0, tspan, p)`
7. A `println` confirmation block
**That is ALL.** Do not solve the problem. Do not plot. Do not add anything beyond the problem definition.
## Reference Examples
Read the reference examples in `reference-examples/` before generating any output. These show the exact file structure and style to follow:
- `reference-examples/exponential_growth.jl` — Scalar ODE: `du/dt = α*u`
- `reference-examples/lotka_volterra.jl` — System of ODEs: Lotka-Volterra predator-prey
**Match their structure exactly:** header comment block, labeled sections with `# ---` separators, parameter unpacking inside `f`, and the confirmation `println` block at the end.
## Input Modes
This skill supports exactly THREE input modes. Determine which mode to use based on what the user provides:
### Mode 1: PDF File
**When:** The user provides a path to a `.pdf` file (either as an argument or mentioned in conversation).
**Workflow:**
1. Read the PDF file using the Read tool.
2. Extract from the PDF content:
- The differential equation(s) — look for `du/dt`, `dy/dx`, `\frac{d}{dt}`, `\dot{u}`, or similar notation
- The initial condition(s) — look for `u(0) =`, `u_0 =`, `y(0) =`, or "initial condition"
- The independent variable domain — look for `t ∈ [a, b]`, `t \in`, "time span", "domain"
- The parameters and their values — look for Greek letters with assigned values, "where α =", parameter tables
3. If any of the four required pieces is missing or ambiguous in the PDF, ask the user ONLY for the missing piece(s). Do not re-ask for information that was clearly stated.
4. Generate the `.jl` file.
### Mode 2: TEX File
**When:** The user provides a path to a `.tex` file (either as an argument or mentioned in conversation).
**Workflow:**
1. Read the `.tex` file using the Read tool.
2. Parse LaTeX math to extract:
- The differential equation(s) — look for `\frac{d}{dt}`, `\frac{du}{dt}`, `\dot{u}`, `\pd{u}{t}`, or similar
- The initial condition(s) — look for `u(0) =`, `u_0 =`, or `\textbf{IC}`
- The independent variable domain — look for `t \in [a, b]`, `\textbf{Domain}`, `tspan`
- The parameters — look for defined symbols, `\alpha`, `\beta`, etc. with assigned values
3. If any of the four required pieces is missing or ambiguous in the TEX file, ask the user ONLY for the missing piece(s). Do not re-ask for information that was clearly stated.
4. Generate the `.jl` file.
### Mode 3: User Interview
**When:** No PDF or TEX file is provided AND the user has not given the ODE information in conversation context.
**Workflow:**
1. Ask the user a SINGLE structured prompt requesting all four pieces at once:
```
To define the ODE problem, I need four things:
1. **Differential equation** — e.g., du/dt = α*u, or a system like du₁/dt = -u₂, du₂/dt = u₁
2. **Initial condition** — e.g., u(0) = 0.5, or [u₁(0), u₂(0)] = [1.0, 0.0]
3. **Independent variable domain** — e.g., t ∈ [0, 1]
4. **Parameter values** — e.g., α = 1.0, or "no parameters"
Please provide all four.
```
2. Parse the user's response.
3. If anything is unclear, ask ONE follow-up — not a second full interview.
4. Generate the `.jl` file.
**IMPORTANT:** Do NOT use Mode 3 if the user has already provided the ODE information in conversation context (e.g., from a previous `/latex` invocation or earlier discussion). In that case, extract the information from the conversation and proceed directly.
## Input Mode Priority
Determine the input mode in this strict order:
1. If the user provides a `.pdf` path → **Mode 1**
2. If the user provides a `.tex` path → **Mode 2**
3. If neither file is provided AND no ODE info exists in conversation context → **Mode 3**
4. If neither file is provided BUT the ODE info IS in conversation context → extract from context and generate directly (no interview needed)
## Generating the Julia File
### Scalar ODE (single equation)
Use the out-of-place form `f(u, p, t)`:
```julia
function f(u, p, t)
α = p[1]
return α * u
end
u0 = 0.5
tspan = (0.0, 1.0)
p = [1.0] # α
prob = ODEProblem(f, u0, tspan, p)
```
### System of ODEs (multiple equations)
Use the in-place form `f!(du, u, p, t)`:
```julia
function f!(du, u, p, t)
α, β = p
du[1] = α * u[1] - β * u[1] * u[2]
du[2] = -α * u[2] + β * u[1] * u[2]
end
u0 = [1.0, 1.0]
tspan = (0.0, 10.0)
p = [1.5, 1.0] # α, β
prob = ODEProblem(f!, u0, tspan, p)
```
### File Structure Rules
1. **Header comment block** — Contains the ODE in readable math notation, IC, domain, and parameter values. See reference examples for exact format.
2. **`using OrdinaryDiffEq`** — Always this package, never `DifferentialEquations` (lighter import).
3. **Section separators** — Use `# --- Description ---` to separate: RHS function, IC, time span, parameters, problem definition, confirmation.
4. **Parameter unpacking** — Always unpack parameters from `p` inside the function with named variables (e.g., `α = p[1]`), never use `p[1]` directly in the equation.
5. **Parameter comments** — Add an inline comment on the `p = [...]` line listing parameter names in order.
6. **Confirmation println** — Always end with a block printing u0, tspan, and p.
7. **File naming** — Name the file descriptively based on the ODE (e.g., `exponential_growth.jl`, `lotka_volterra.jl`, `heat_equation_ode.jl`).
## Running the Generated File
After generating the `.jl` file, run it with:
```bash
julia --pkgimages=no <filename>.jl
```
The `--pkgimages=no` flag is required on this system to avoid a linker issue with `lld`.
Verify the output shows the correct u0, tspan, and p values.
## Rules
1. **ONLY define the ODEProblem.** Do not solve it. Do not plot it. Do not analyze it. The output is a `.jl` file that ends with the `ODEProblem` definition and a confirmation print.
2. **Read reference examples before generating.** Match their structure exactly.
3. **Use `OrdinaryDiffEq`, not `DifferentialEquations`.** Lighter import, same `ODEProblem`.
4. **Respect the three input modes.** Never interview if a file was provided. Never skip the interview if no context exists.
5. **Run the file after generating.** Use `julia --pkgimages=no`. Verify the println output is correct.
6. **Every equation must be correct.** Double-check the RHS function matches the stated ODE. Verify signs, parameter placement, and variable indexing.
7. **Use Unicode where helpful.** Julia supports Unicode identifiers — `α`, `β`, `γ`, `δ` are valid variable names and make the code more readable.