Migrating OCaml projects from ocamlbuild/topkg to dune. Use when discussing _tags files, .mllib files, pkg/pkg.ml, topkg, or build system migration.
/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:
Read these files to understand the project:
_tags - ocamlbuild compilation flags and package dependenciespkg/pkg.ml - topkg package descriptionpkg/META - findlib metadata*.mllib files - module lists for librariesopam - package dependencies(lang dune 3.20)
(name <package-name>)
(generate_opam_files true)
For each library (from .mllib files):
(library
(name <library_name>)
(public_name <package.subname>)
(libraries <dependencies>))
For optional libraries (from pkg/pkg.ml):
(library
(name <library_name>)
(public_name <package.subname>)
(optional)
(libraries <dependencies>))
Files like *_top_init.ml shouldn't be compiled as modules:
(library
(name lib_name)
(modules lib_module) ; Explicitly list modules
(libraries deps))
(install
(package pkg)
(section lib)
(files lib_top_init.ml))
If the original code triggers warnings:
(library
(name lib)
(flags (:standard -w -27)))
Common warnings to suppress in vendored code:
-w -27 - unused variable(test
(name test_name)
(libraries lib_name alcotest))
For optional tests:
(executable
(name test_optional)
(modules test_optional)
(optional)
(libraries lib some_optional_lib))
opam to <package>.opamdepends: [
"ocaml" {>= "4.14.0"}
"dune" {>= "3.0"}
]
build: [
["dune" "subst"] {dev}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
["dune" "build" "@doc" "-p" name "-j" jobs] {with-doc}
]
If there's a doc/ directory:
(documentation
(package <package-name>))
Files to delete:
_tags.merlinpkg/pkg.mlpkg/META*.mllib files*.itarget filespkg/ directory| ocamlbuild | dune |
|---|---|
_tags: package(foo) | (libraries foo) |
_tags: thread | (libraries threads) |
foo.mllib with Foo | (library (name foo) (modules foo)) |
pkg/pkg.ml: Pkg.mllib ~cond:x | (library ... (optional)) |
pkg/META | Auto-generated by dune |
opam | <package>.opam |
Use (optional) on the library stanza.
Add (flags (:standard -w -27)).
Use (modules ...) to explicitly list modules.
Exclude from library with (modules ...) and use (install ...).
After migration:
dune build @check # Verify syntax
dune build # Build project
dune runtest # Run tests
dune build @doc # Build docs
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.