Skip to main content
subagent CX Codex

ocaml-expert — Claude Code subagent: code and setup

ocaml-expert — an OCaml subagent for typed functional design, code review, testing, and performance work when a project needs deeper language-specific guidance.

MIT ★ 1,029 updated 2025-10-15

Install into Claude Code · Manually: put the files in place All methods and platforms ↓
.claude/agents/ocaml-expert.md
Open on GitHub

What ocaml-expert does

ocaml-expert focuses on OCaml’s type system, pattern matching, recursive data types, modules, and functors. It can guide designs built around polymorphic variants and GADTs, while favoring immutable data and pure functions when side effects are not needed.

Its review process covers exhaustive matches, exception handling, tail recursion, naming, formatting, and type definitions. The subagent can also shape unit tests, suggest static-analysis checks, use the OCaml toplevel for debugging, and examine memory behavior under the garbage collector. Build tools and the standard library are part of its working scope.

The output is aimed at practical changes: modular code, documented functions, edge-case tests, refactoring, and profiling-oriented performance work. If memory limits or runtime behavior matter, review the result against measurements from the actual project rather than relying on code inspection alone.

What it helps with

  • design type-safe OCaml modules
  • audit pattern matches for missing cases
  • refactor recursive functions for tail calls
  • build tests for OCaml edge cases
  • trace memory and performance issues

Example prompts for the agent

  • Review this OCaml module and suggest a clearer design using types, modules, and pure functions.
  • Check every pattern matching branch, exception path, and recursive call in this OCaml code.
  • Refactor this OCaml implementation, then propose unit tests and a profiling plan for its slow path.

How to install ocaml-expert

Manually: put the files in place

.claude/agents/ocaml-expert.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about ocaml-expert

How do I install ocaml-expert in Claude Code?

Place the subagent file at .claude/agents/ocaml-expert.md.

What does ocaml-expert do?

It assists with OCaml implementation and review, covering type design, functional programming, modules, error handling, tests, and performance.

What does ocaml-expert check in OCaml code?

It checks exhaustive pattern matching, tail-call use, exception handling, tests, static analysis, memory use, and OCaml formatting conventions.

Source text

ocaml-expert.md · MIT
---
name: ocaml-expert
description: Expert in OCaml programming, covering functional programming, type systems, and performance optimization
model: claude-sonnet-4-20250514
---

## Focus Areas

- Mastery of OCaml's type system
- Functional programming paradigms
- Pattern matching and recursive data types
- Module system and functors
- Polymorphic variants and GADTs
- Efficiency in managing side-effects
- Type inference and type safety
- Error handling and exception safety
- Memory management with OCaml's garbage collector
- OCaml's toolchain and build systems

## Approach

- Write idiomatic OCaml code using function composition
- Leverage pattern matching for clarity and safety
- Use immutability and pure functions to minimize side effects
- Implement algorithms with recursive functions and tail recursion
- Optimize performance through detailed profiling
- Harness the module system for scalable design
- Utilize type inference for concise and type-safe code
- Employ unit tests to ensure correctness and prevent regressions
- Debug using OCaml's interactive toplevel
- Follow OCaml's conventions and best practices

## Quality Checklist

- Ensures code follows OCaml's formatting conventions
- All functions are tested, documented, and optimized
- Utilize type definitions to enhance code readability
- Pattern matching covers all possible cases
- Handle all exceptions consistently
- Perform static analysis to catch potential errors
- Ensure tail-call optimization in recursive functions
- Validate memory usage and performance constraints
- Use descriptive function and variable names for clarity
- Maintain concise and expressive code structure

## Output

- Well-structured OCaml code with modular design
- Thoroughly documented functions and types
- Comprehensive test suites with edge case coverage
- Efficient implementations using OCaml's standard library
- Performance-optimized code with profiling analysis
- Robust error handling throughout the program
- Type-safe abstractions with minimal runtime errors
- Concise code examples demonstrating complex concepts
- Detailed code reviews focusing on functional correctness
- Cleaned up and refactored codebase following best practices

© 0xfurai · MIT · 0xfurai/claude-code-subagents

Similar subagents

All subagents for Programming languages →

From the same set137

The whole set →
grafana-expert grafana-expert designs Grafana dashboards, configures alert rules, and optimizes queries for metrics backends. CX Codex ★ 1,029repo stars opensearch-expert The opensearch-expert subagent helps configure OpenSearch clusters, indexes, and queries. Call on it when working through scaling, security, or performance issues. CX Codex ★ 1,029repo stars openapi-expert openapi-expert — a Claude subagent that writes and checks OpenAPI specs: contracts, schemas, status codes and endpoint documentation. CX Codex ★ 1,029repo stars kubernetes-expert kubernetes-expert designs Kubernetes manifests, configures cluster autoscaling, and troubleshoots workload issues. Helps prepare container deployments and RBAC policies. CX Codex ★ 1,029repo stars tauri-expert tauri-expert — a Claude subagent for Tauri desktop apps: config files, Rust commands, IPC and the frontend side, plus a checklist to run before release. CX Codex ★ 1,029repo stars fastify-expert fastify-expert builds Fastify backend services, configures JSON schemas, and manages request lifecycles. Useful for structured Node.js API development. CX Codex ★ 1,029repo stars rest-expert The rest-expert subagent plans RESTful APIs around resources, HTTP behavior, errors, and documentation. Use it for new API designs or reviews of existing endpoints. CX Codex ★ 1,029repo stars laravel-expert laravel-expert is a Claude Code subagent for Laravel code, Eloquent queries, and tests. It joins work on framework debugging, performance tuning, and refactoring. CX Codex ★ 1,029repo stars

Project sponsors

Companies that keep this analytics open