Hey everyone, I’ve created a Claude Code agent that creates/verifies/updates ReScript bindings for JS/TS libraries. I’ve included it in the rescript plugin here along with some other skills for writing bindings, and addressing some common mistakes I’ve seen the models do when they aren’t reminded of the newer language features.
How it works:
- Gathers context (task type, library, ReScript version, library vs app use case)
- For create: researches TS types → writes bindings → compiles examples → verifies generated JS matches expected usage
- For verify: systematically compares existing bindings against .d.ts files, reports mismatches
- Handles type fidelity - when TS patterns (conditional types, mapped types) can’t be fully represented in ReScript, reports limitations and presents options rather than silently simplifying
The agent is prompted to include rescript example usage, expected JS output, and a type fidelity report.
I’ve used it a few times with pretty good success, would love to hear anyone’s thoughts on how it does.
Skills
rescript-bindings
This skill gives the agent some examples of how to deal with certain situations, and how to verify the bindings it’s written are correct by checking the generated javascript. It also warns the AI about typescript types that cannot readily be represented, and to not silently substitute those for unsafe types.
rescript-coding-conventions
rescript-coding-conventions/SKILL.md
The coding conventions skill is an attempt to remind the agents to follow some of my opinions about FP code and not write imperative style javascript in ReScript syntax.
rescript-workflow
A phased development workflow that uses %todo to work with the compiler instead of fighting against it when the agent’s edits cause type errors from incomplete work.
Phases:
- Interface Design - Add type signatures to .resi files first
- Implementation Skeletons - Write
let fn: type = %todo("description")placeholders - Write Tests - Complete tests against skeletons (they’ll fail at runtime, that’s fine)
- Implementation - Replace
%todowith working code - Verification - Run
rescript build --warn-error +110to ensure no%todos remains
The compiler becomes an ally showing you what’s left to implement, not a blocker preventing progress.
It also prompts the agent to disclose what assumptions or trade-offs were made, and where it deviated from the plan.