Refactoring and tidying OCaml code to be more idiomatic. Use when the user asks to tidy, clean up, refactor, or improve OCaml code, or when reviewing Claude-generated OCaml code for consolidation.
/plugin marketplace add avsm/ocaml-claude-marketplace/plugin install avsm-ocaml-dev-plugins-ocaml-dev@avsm/ocaml-claude-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Invoke this skill when:
Replace verbose pattern matching with combinators:
(* Before *)
match get_value () with
| Some x -> Some (x + 1)
| None -> None
(* After *)
Option.map (fun x -> x + 1) (get_value ())
Common combinators to prefer:
Option.map, Option.bind, Option.value, Option.iter, Option.foldResult.map, Result.bind, Result.map_error, Result.joinUse let (bind) and let+ (map) for cleaner chaining:*
(* Before *)
match fetch_user id with
| Ok user ->
(match fetch_permissions user with
| Ok perms -> Ok (user, perms)
| Error e -> Error e)
| Error e -> Error e
(* After *)
let open Result.Syntax in
let* user = fetch_user id in
let+ perms = fetch_permissions user in
(user, perms)
(* Before *)
if x > 0 then
if x < 10 then "small"
else "large"
else "negative"
(* After *)
match x with
| x when x < 0 -> "negative"
| x when x < 10 -> "small"
| _ -> "large"
Identify and extract repeated patterns:
(* Before - repeated pattern *)
let parse_int s =
try int_of_string s
with Failure _ -> raise (Parse_error ("Invalid integer: " ^ s))
let parse_float s =
try float_of_string s
with Failure _ -> raise (Parse_error ("Invalid float: " ^ s))
(* After - factored out *)
let with_parse_error ~kind f s =
try f s
with Failure _ ->
raise (Parse_error (Printf.sprintf "Invalid %s: %s" kind s))
let parse_int = with_parse_error ~kind:"integer" int_of_string
let parse_float = with_parse_error ~kind:"float" float_of_string
Abstract type t pattern:
module User : sig
type t
val create : name:string -> email:string -> t
val name : t -> string
val email : t -> string
val pp : Format.formatter -> t -> unit
end = struct
type t = { name : string; email : string }
let create ~name ~email = { name; email }
let name t = t.name
let email t = t.email
let pp fmt t = Format.fprintf fmt "%s <%s>" t.name t.email
end
Avoid generic module names:
Util, Utils, Helpers, Common, MiscString_ext, File_io, Json_codecUse labeled arguments for clarity:
(* Instead of: *)
let create name email age = ...
(* Use: *)
let create ~name ~email ~age = ...
Use local opens:
let open Option.Syntax in
let* x = get_x () in
let* y = get_y () in
return (x + y)
match x with Some v -> Some (f v) | None -> Nonecreate name true false is unclearMake code more readable, maintainable, and idiomatic to experienced OCaml developers. Not just shorter, but clearer.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.