ReScript Bindings Writer Agent + Skills

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:

  1. Gathers context (task type, library, ReScript version, library vs app use case)
  2. For create: researches TS types → writes bindings → compiles examples → verifies generated JS matches expected usage
  3. For verify: systematically compares existing bindings against .d.ts files, reports mismatches
  4. 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

rescript-bindings/SKILL.md

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

rescript-workflow/SKILL.md

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:

  1. Interface Design - Add type signatures to .resi files first
  2. Implementation Skeletons - Write let fn: type = %todo("description") placeholders
  3. Write Tests - Complete tests against skeletons (they’ll fail at runtime, that’s fine)
  4. Implementation - Replace %todo with working code
  5. Verification - Run rescript build --warn-error +110 to 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.

4 Likes

Amazing!

Do you have any examples of what it has produced?

1 Like

I have a couple examples thus far: