From rescript-lsp
ReScript 12 syntax features. Use when writing ReScript in projects using v12+. Check package.json dependencies for rescript version. Key features include dict literal syntax, unified operators, nested record types, variant pattern spreads, and regex literals.
How this skill is triggered — by the user, by Claude, or both
Slash command
/rescript-lsp:rescript-12The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create and pattern match dictionaries with `dict{}`:
Create and pattern match dictionaries with dict{}:
// Creating dicts
let taskJson = dict{
"id": task.id,
"title": task.title,
"createdAt": Date.toISOString(task.createdAt),
}
// Pattern matching dicts (matches AT LEAST these keys, not exactly)
let parseTask = json =>
switch json {
| dict{"id": id, "title": title} =>
// This matches any dict containing "id" and "title" keys
// Additional keys are ignored
Some(make(~id, ~title))
| _ => None
}
Important: Dict pattern matching is partial—dict{"a": x} matches any dict containing key "a", regardless of other keys present.
Define record types inline without auxiliary type declarations:
type user = {
id: string,
name: string,
address: {
street: string,
city: string,
zip: string,
},
}
let user = {
id: "1",
name: "Alice",
address: {
street: "123 Main St",
city: "Springfield",
zip: "12345",
},
}
Arithmetic operators work across int, float, and bigint with compiler-inferred specialization:
let intResult = 1 + 2
let floatResult = 1.5 + 2.5
let bigintResult = 1n + 2n
// String concat still uses ++
let greeting = "hello" ++ " world"
F#-style bitwise operators replace deprecated OCaml-style functions:
let andResult = a &&& b // AND
let orResult = a ||| b // OR
let xorResult = a ^^^ b // XOR
let notResult = ~~~a // NOT
let leftShift = a << 2 // Logical left shift
let rightShift = a >> 2 // Logical right shift
let unsignedShift = a >>> 2 // Unsigned right shift
Reuse handlers for variant constructor subsets:
type response =
| Success(data)
| NotFound
| Unauthorized
| ServerError(string)
let isError = response =>
switch response {
| Success(_) => false
| ..._ => true // Matches NotFound, Unauthorized, ServerError
}
JavaScript-style regex syntax:
let phonePattern = /\d{3}-\d{3}-\d{4}/
let globalMatch = /\w+/g
// Equivalent to:
let phonePattern = %re("/\d{3}-\d{3}-\d{4}/")
npx claudepluginhub illusionalsagacity/claude-plugins --plugin rescript-lspCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.