Syntic

Skills may execute instructions and code that could affect your environment. Marketplace scans reduce risk but do not guarantee safety. Always review files, run your own security checks, and use at your own risk.

LanguagesFree Safe

Ocaml Developer

Security Scan Summary

Status: Safe

Source: Syntic Skills registry

Automated security scan completed with no high-risk patterns detected. Manual review is still required.

About This Skill

Use when building correct, performant OCaml applications with type inference, pattern matching, Dream web framework, and opam ecosystem.

Downloadable SKILL.md

Download SKILL.md and place it in your Syntic skills folder. For Syntic Code, install in your local skills directory, review contents, and run in a controlled environment first. Acknowledge the risk notice above to enable the download.

SKILL.md
---
name: Ocaml Developer
description: Use when building correct, performant OCaml applications with type inference, pattern matching, Dream web framework, and opam ecosystem.
category: Languages
version: 1.0.0
tools: []
---

# OCaml Type-Safe Development

Build correct, performant applications using OCaml's powerful type system and exhaustive pattern matching.

## Type System Design

- Define domain types as variants (sum types) and records (product types); make invalid states unrepresentable
- Use polymorphic variants (`[`A | `B]`) for extensible types across module boundaries; regular variants for closed sets
- Leverage type inference; annotate function signatures in `.mli` interface files; let compiler infer in `.ml` implementations
- Use phantom types to encode constraints: `type readonly` and `type readwrite` as phantom parameters
- Use GADTs for type-safe expression evaluators, serialization, protocol definitions

## Pattern Matching

- Match exhaustively; compiler warns on non-exhaustive matches
- Use `when` guards sparingly; extract complex guards into named functions
- Use `as` bindings to capture destructured parts and whole value: `| (Point (x, y) as p) ->`
- Use `or` patterns to merge cases: `| Red | Blue ->`
- Use `function` keyword for single-argument pattern matching

## Module System

- Define `.mli` interface files for every public module; signature is the API contract
- Use functors to parameterize modules; common use case: data structures parameterized over comparison functions
- Use first-class modules for runtime module selection
- Organize code into libraries with `dune` `(library ...)` stanzas
- Use `include M` to extend modules; use `module type of` to capture signatures

## Dream Web Framework

- Define routes with `Dream.get`, `Dream.post`; group with `Dream.scope` for shared middleware
- Use `Dream.param` for path parameters, `Dream.query` for query strings
- Use `Dream.sql` with Caqti for typed database access via Caqti request values
- Apply middleware: `Dream.logger`, `Dream.csrf`, `Dream.memory_sessions` or `Dream.sql_sessions`
- Return proper status codes with `Dream.respond ~status:`; use `Dream.json` or `Dream.html`

## Error Handling & Performance

- Use `Result.t` (`Ok | Error`) for recoverable errors; `Option.t` only for genuinely optional values
- Define error types as variants: `type error = Not_found | Permission_denied | Validation of string`
- Use `Result.bind` or `let*` operator to chain fallible operations
- Use `Array` for random access; `List` for sequential processing
- Profile with `landmarks` or `perf` integration; use `Core_bench` for micro-benchmarks
- Use Flambda compiler optimizations (`-O3 -flambda`) for release builds

## Build & Tooling

- Use `dune` as build system; define `dune-project` at root with `(lang dune 3.x)`
- Use `opam` for dependency management; pin production dependencies to exact versions
- Use `ocamlformat` for consistent formatting; configure in `.ocamlformat`
- Use `merlin` for IDE integration

## Before Completing

- Run `dune build @all` with zero warnings
- Run `dune runtest` to execute all tests
- Run `ocamlformat --check` on all source files
- Verify `.mli` files expose only intended public API

Bundle Download

Includes SKILL.md and bundled support files where provided. Risk acknowledgement is required.

Install Targets

Syntic App

  1. 1. Create a dedicated folder for this skill in your local skills library.
  2. 2. Place SKILL.md into that folder.
  3. 3. Restart Syntic and invoke this skill on matching tasks.

Syntic Code (CLI)

  1. 1. Save SKILL.md in your local Syntic Code skills directory.
  2. 2. Keep related files in the same skill folder.
  3. 3. Run in a safe environment and validate outputs.

Source

https://github.com/rohitg00/awesome-claude-code-toolkit/blob/main/agents/language-experts/ocaml-developer.md

Open Source Link
Languages

Related Skills