ocaml-npm

ocaml-npm is a command for Claude Code from avsm/ocaml-claude-marketplace. It costs 19 tokens per session (911 once invoked), scanned A, original, ISC.

A setup command for publishing an OCaml project through npm, the package registry commonly used for JavaScript libraries. It prepares JavaScript or WebAssembly builds and a separate npm branch.

In plain words
What is it for?
It helps prepare an existing OCaml project that uses js_of_ocaml or wasm_of_ocaml for npm releases, including build rules, generated JavaScript or WebAssembly files, and package metadata.
Why use it?
It removes the need to manually connect OCaml's dune build system with npm publishing files and branches.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Part of the ocaml-dev plugin — 21 skills, 5 commands shipped together

Good fit It helps prepare an existing OCaml project that uses js_of_ocaml or wasm_of_ocaml for npm releases, including build rules, generated JavaScript or WebAssembly files, and package metadata.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/avsm/ocaml-claude-marketplace/ocaml-npm
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/avsm/ocaml-claude-marketplace

Made for: Claude Code.

Or install ocaml-dev, the plugin that ships this one along with the rest of its 21 skills, 5 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ocaml-npm

README.md
[![agentmods](https://agentmods.dev/badge/commands/avsm/ocaml-claude-marketplace/ocaml-npm/github.svg)](https://agentmods.dev/commands/avsm/ocaml-claude-marketplace/ocaml-npm)
Your own site
<a href="https://agentmods.dev/commands/avsm/ocaml-claude-marketplace/ocaml-npm"><img src="https://agentmods.dev/badge/commands/avsm/ocaml-claude-marketplace/ocaml-npm/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ocaml-npm

Your own site · 80×15
<a href="https://agentmods.dev/commands/avsm/ocaml-claude-marketplace/ocaml-npm"><img src="https://agentmods.dev/badge/commands/avsm/ocaml-claude-marketplace/ocaml-npm.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 19 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 911 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00019 $0.00911
Opus 5 $0.00010 $0.00456
Sonnet 5 $0.00004 $0.00182
Haiku 4.5 $0.00002 $0.00091

Measured 7d ago against content hash 100a573d7cf1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

ocaml-npm scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/ocaml-dev/commands/ocaml-npm.md · 160 lines

How it starts

The opening of the file, as written. The whole thing — 160 lines — stays where its author put it; the contents beside it link to each section on GitHub.

OCaml NPM Setup

This command sets up the npm publishing workflow for OCaml projects compiled to JavaScript/WASM.

Arguments

None - operates on the current directory.

Prerequisites

  • Existing OCaml project with dune
  • js_of_ocaml or wasm_of_ocaml dependencies configured
  • Git repository initialized

Two-Branch Workflow

main branch   - OCaml source code, dune build files, opam packages
npm branch    - Built JavaScript/WASM assets, package.json, README for npm

Process

1. Analyze Project

Determine:

  • Project name from dune-project
  • Existing JS build targets
  • Whether to support JS, WASM, or both

2. Create/Update Dune Build Rules

Add or update lib/js/dune (or appropriate location):

(library
 (name <project>_js)
 (public_name <project>-js)
 (libraries <project> brr)
 (modes byte)
 (modules <project>_js))

(executable
 (name <project>_js_main)
 (libraries <project>_js)
 (js_of_ocaml)
 (modes js wasm)
 (modules <project>_js_main))

; Friendly filenames
(rule
 (targets <project>.js)
 (deps <project>_js_main.bc.js)
 (action (copy %{deps} %{targets})))

(rule
 (targets <project>.wasm.js)
 (deps <project>_js_main.bc.wasm.js)
 (action (copy %{deps} %{targets})))

; Install rules
(install
 (package <project>-js)
 (section share)
 (files
  <project>.js
  <project>.wasm.js
  (glob_files_rec (<project>_js_main.bc.wasm.assets/* with_prefix <project>_js_main.bc.wasm.assets))))

3. Update dune-project

Add -js package if not present:

(package
 (name <project>-js)
 (synopsis "Browser library via js_of_ocaml/wasm_of_ocaml")
 (depends
  (ocaml (>= 5.1.0))
  (<project> (= :version))
  (js_of_ocaml (>= 5.0))
  (js_of_ocaml-ppx (>= 5.0))
  (wasm_of_ocaml-compiler (>= 5.0))
  (brr (>= 0.0.6))))

4. Create npm Branch

Create orphan branch with:

  • package.json
  • README.md (browser-focused)
  • LICENSE
  • release.sh
  • .gitignore

5. Generate release.sh Script

#!/bin/bash
# Release script for npm package
set -e

INSTALL_DIR="_build/install/default/share/<project>-js"

# ... copy JS, WASM loader, and assets

Read the full file on GitHub · 160 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago Changed 100a573d7cf1
  2. 11d ago First seen · 160 lines · 19 tokens per session scan A 0c57a370ea88

Subscribe to this mod's changes

ocaml-npm is a command published in the GitHub repository avsm/ocaml-claude-marketplace (35 stars, last pushed 9d ago), licensed ISC. It adds 19 tokens to every session and 911 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.