csml-rpi/ai-cfd-scientist/cfd-code-modify
Claude Code and agent skill by csml-rpi/ai-cfd-scientist
- community
Checking that the SKILL.md file is still in the repository.
Implement a custom OpenFOAM model (viscosity / turbulence / source term / fvOption) inside a case-local customModels directory. Self-contained — embeds the full openfoam_literature_change_agent_prompt_v2 protocol AND the compile_fix prompts verbatim. Builds payload, generates C++, compiles with wmake, smoke-tests. NEVER edits OpenFOAM installation directories.
Install
npx vskill@latest install csml-rpi/ai-cfd-scientist/cfd-code-modifySKILL.md
cfd-code-modify
⚠ HARD STOP — read this before any other step
If you are reading this skill and <out-dir>/checkpoints/requirements_done.json does not exist, STOP. The user typed a code-modification topic, but the orchestrator chain starts at literature, not here. Return to Skill cfd-orchestrator and start over. Compiling a custom .so before the upstream chain (literature → baseline_setup → metric_setup → hypothesis → requirements) has run is the exact failure mode this gate exists to prevent — there is no "I'll skip ahead because the topic is obvious" path. The requirement text dictates which model the code must produce; without it, you are guessing.
Custom OpenFOAM model implementation. Case-local, compiled, validated. The agent acts as the OPENFOAM 10 LITERATURE CHANGE AGENT (full protocol embedded below) plus the compile-fix loop.
When to use
Topics with: "implement", "modify", "viscosity model", "turbulence model change", "Bingham", "power-law", "Carreau", "source term", "fvOption", "custom SA modification", "k-omega correction", "custom model".
For OED of turbulence models, this skill is invoked inside the cfd-open-discovery loop for each candidate.
Step 0 — Preflight gate (HARD; slice 14)
Before any other work (before reading payload, before drafting C++, before wmake), run:
If rc != 0, STOP. The route-2 predecessors are literature_done, baseline_setup_done, metric_setup_done, hypothesis_done, requirements_done. Code-mod is downstream of the hypothesis-then-requirement chain by design: the requirement text dictates which model the code change must produce. Compiling a custom .so before the upstream chain runs is the exact "fast-validate shortcut" failure mode slice 14 closes. Run cfd-literature → cfd-hypothesis → cfd-requirements → baseline_setup/metric_setup first, then re-invoke this skill.
Hard rules
- Never edit
$WM_PROJECT_DIR,$FOAM_SRC, or any OpenFOAM installation/source directory. - All custom code goes in
<case_path>/customModels/<ClassName>/. - Compile case-locally with
wmake libso. Link viacontrolDict.libs (...)and one activation dictionary. - One request per invocation (see protocol §3 below).
Inputs
out-dir(required)case_path(required) — wherecustomModels/<ClassName>/will be created- One of:
- User's natural-language description of the model + formula
payload.jsonalready constructed (matches the INPUT CONTRACT in §9 below)lit.json(optional) — for grounding the model in literature
Outputs
<case_path>/customModels/<ClassName>/<ClassName>.H<case_path>/customModels/<ClassName>/<ClassName>.C<case_path>/customModels/<ClassName>/Make/files<case_path>/customModels/<ClassName>/Make/options<case_path>/customModels/<ClassName>/lib<ClassName>.so(the case-local compiled library — built inside the case, never in$FOAM_USER_LIBBIN)<case_path>/customModels/<ClassName>/build.log<case_path>/customModels/<ClassName>/smoke_test.log<case_path>/runtime_dependencies.json(every.sothe case'scontrolDictloads, with source + sha256 — see Step 7)<out-dir>/code_mod/<ClassName>/build_result.json:
``json { "status": "OK | NEEDS_INFO | UNSUPPORTED | UNSUPPORTED_WITHOUT_SOLVER_EDIT", "mode": "custom_source | custom_viscosity | custom_turbulence_model_modification", "parent_model": "...", "class_name": "...", "library_relpath": "customModels/<ClassName>/lib<ClassName>.so", "activation_dictionary": "constant/momentumTransport | constant/fvModels | constant/turbulenceProperties", "files_created": [...], "dictionary_patches": [...], "build_commands": [...], "verification_commands": [...] } ``
OPENFOAM 10 LITERATURE CHANGE AGENT — Full protocol
The protocol below is the canonical specification (mirrored verbatim from openfoam_literature_change_agent_prompt_v2.txt at the repo root). Treat this as the system prompt the agent operates under. If you spot a discrepancy with the file, the file at the root is the authority — but they are kept in sync.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 98 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcfd-skills/cfd-code-modify/SKILL.md
Popularity
- Repository stars
- 51
- Repository forks
- 6
- 7-day trend score
- 20
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/csml-rpi/ai-cfd-scientist/cfd-code-modify)