Add Claude skill to implement AMReX and bridge code for a MOM6 Fortran subroutine#15
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new Claude skill (/generate_amrex_code) intended to generate the C++/AMReX side of a MOM6 Fortran subroutine bridge within a TURBO-ESM/TIM checkout, along with a companion “lessons learned” document based on TIM PR #8.
Changes:
- Introduces
.claude/skills/generate_amrex_code/SKILL.mdas a step-by-step execution checklist for generating bridge/kernel code. - Adds
.claude/skills/generate_amrex_code/lessons.mddocumenting patterns/conventions from TIM PR #8 for bridge marshalling, AMReX kernels, and pointwise device primitives.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .claude/skills/generate_amrex_code/SKILL.md | Defines the user-invocable skill workflow, validation rules, and generation steps. |
| .claude/skills/generate_amrex_code/lessons.md | Captures established implementation patterns and pitfalls from prior bridge work (PR #8). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| the kernel symbol, the bridge symbol, and the | ||
| capture filename. | ||
| <mom6-directory> OPTIONAL. Absolute path to a TURBO-ESM/MOM6 | ||
| checkout. When given, Step 3 grep's the |
| it writes any C++. | ||
|
|
||
| - **If `$2` was supplied**, run | ||
| `grep -irln "^[[:space:]]*subroutine[[:space:]]\+\(<function-name>_fortran\|<function-name>\)\b" $2/src $2/config_src`. |
| (`MOM::<lowercased_$1>`), bridge symbol | ||
| (`<prefix>_<lowercased_$1>_bridge`), target file paths, whether | ||
| each will be created or appended, and whether a `*_point` factor | ||
| is the working assumption (Step 3 may override it). | ||
|
|
||
| ### 2. Gather the bridge contract | ||
| Ask the user for the Fortran-side `bind(C)` interface, either as | ||
| the literal `interface … end interface` block or as a path to a | ||
| MOM6 source file containing | ||
| `<prefix>_<lowercased_$1>_bridge) bind(C)` (the skill `grep`s the | ||
| signature out — if `$2` was supplied, default the search root to | ||
| `$2/src` and `$2/config_src`). |
| Report: | ||
|
|
||
| 1. Bridge symbol implemented and the kernel symbol it dispatches to. | ||
| 2. Source-of-truth for the port: file path + line range (if grep'd |
johnmauff
left a comment
There was a problem hiding this comment.
@sjsprecious, I have the same comment here as for the MOM version. How does Claude know about the function '/generate_amrex_code' before it checks out the repol
see my reply about the MOM6 Claude skill (TURBO-ESM/MOM6#24). |
johnmauff
left a comment
There was a problem hiding this comment.
@sjsprecious as with the matching PR to the MOM6 repo, I think that the GitHub steps #1 and #12 should be optional, which would allow the user of the script to execute or not.
Thanks @johnmauff . I just pushed the changes you suggested and updated the PR description for the new usage. |
johnmauff
left a comment
There was a problem hiding this comment.
@sjsprecious, thanks for the PR. This looks good to me.
This PR adds the Claude skill to implement the AMReX and bridge code for a desired MOM6 Fortran subroutine.
An example of usage in Claude CLI looks like:
An actual example looks like:
or