dune-migration
Migrating OCaml projects from ocamlbuild/topkg to dune. Use when discussing _tags files, .mllib files, pkg/pkg.ml, topkg, or build system migration.
What this skill does
# OCaml Build System Migration
## When to Use This Skill
Invoke this skill when:
- Converting a project from ocamlbuild to dune
- Discussing _tags, .mllib, or pkg.ml files
- Migrating from topkg to dune
- Understanding ocamlbuild artifacts
## Process Overview
### 1. Analyze the Existing Build
Read these files to understand the project:
- `_tags` - ocamlbuild compilation flags and package dependencies
- `pkg/pkg.ml` - topkg package description
- `pkg/META` - findlib metadata
- `*.mllib` files - module lists for libraries
- `opam` - package dependencies
### 2. Create dune-project
```dune
(lang dune 3.20)
(name <package-name>)
(generate_opam_files true)
```
### 3. Create Library dune Files
For each library (from `.mllib` files):
```dune
(library
(name <library_name>)
(public_name <package.subname>)
(libraries <dependencies>))
```
For optional libraries (from `pkg/pkg.ml`):
```dune
(library
(name <library_name>)
(public_name <package.subname>)
(optional)
(libraries <dependencies>))
```
### 4. Handle Toplevel Init Files
Files like `*_top_init.ml` shouldn't be compiled as modules:
```dune
(library
(name lib_name)
(modules lib_module) ; Explicitly list modules
(libraries deps))
(install
(package pkg)
(section lib)
(files lib_top_init.ml))
```
### 5. Handle Warnings
If the original code triggers warnings:
```dune
(library
(name lib)
(flags (:standard -w -27)))
```
Common warnings to suppress in vendored code:
- `-w -27` - unused variable
### 6. Create Test dune File
```dune
(test
(name test_name)
(libraries lib_name alcotest))
```
For optional tests:
```dune
(executable
(name test_optional)
(modules test_optional)
(optional)
(libraries lib some_optional_lib))
```
### 7. Update opam File
1. Rename `opam` to `<package>.opam`
2. Remove ocamlbuild/topkg dependencies
3. Add dune:
```
depends: [
"ocaml" {>= "4.14.0"}
"dune" {>= "3.0"}
]
```
4. Update build commands:
```
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}
]
```
### 8. Documentation dune File
If there's a `doc/` directory:
```dune
(documentation
(package <package-name>))
```
### 9. Remove ocamlbuild Files
Files to delete:
- `_tags`
- `.merlin`
- `pkg/pkg.ml`
- `pkg/META`
- `*.mllib` files
- `*.itarget` files
- The `pkg/` directory
## Mapping Reference
| 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` |
## Common Issues
### "Library not found" for optional deps
Use `(optional)` on the library stanza.
### Unused variable warnings
Add `(flags (:standard -w -27))`.
### Module in wrong library
Use `(modules ...)` to explicitly list modules.
### Toplevel init files
Exclude from library with `(modules ...)` and use `(install ...)`.
## Verification
After migration:
```bash
dune build @check # Verify syntax
dune build # Build project
dune runtest # Run tests
dune build @doc # Build docs
```
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.