code-style

code-style is a skill for Claude Code from avsm/ocaml-claude-marketplace. It costs 44 tokens per session (1,417 once invoked), scanned A, original, ISC.

A set of guidelines and refactoring patterns for OCaml code. Refactoring means changing code to make it clearer or easier to maintain without changing what it does.

In plain words
What is it for?
Use it to tidy, review, or refactor OCaml code, including naming, module design, option and result handling, and reducing complexity.
Why use it?
It gives consistent rules for interfaces, naming, modules, error handling, and simpler code when cleaning up or reviewing an OCaml project.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

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

Good fit Use it to tidy, review, or refactor OCaml code, including naming, module design, option and result handling, and reducing complexity.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/avsm/ocaml-claude-marketplace/code-style
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.

Any agent
npx skills add avsm/ocaml-claude-marketplace --skill code-style
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 code-style

README.md
[![agentmods](https://agentmods.dev/badge/skills/avsm/ocaml-claude-marketplace/code-style/github.svg)](https://agentmods.dev/skills/avsm/ocaml-claude-marketplace/code-style)
Your own site
<a href="https://agentmods.dev/skills/avsm/ocaml-claude-marketplace/code-style"><img src="https://agentmods.dev/badge/skills/avsm/ocaml-claude-marketplace/code-style/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 code-style

Your own site · 80×15
<a href="https://agentmods.dev/skills/avsm/ocaml-claude-marketplace/code-style"><img src="https://agentmods.dev/badge/skills/avsm/ocaml-claude-marketplace/code-style.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,417 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00044 $0.01417
Opus 5 $0.00022 $0.00709
Sonnet 5 $0.00009 $0.00283
Haiku 4.5 $0.00004 $0.00142

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

Security

Grade A, and why

code-style 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 5d 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/skills/code-style/SKILL.md · 186 lines

How it starts

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

OCaml Code Style

Core Philosophy

  1. Interface-First: Design .mli first. Clean interface > clever implementation.
  2. Modularity: Small, focused modules. Compose for larger systems.
  3. Simplicity (KISS): Clarity over conciseness. Avoid obscure constructs.
  4. Explicitness: Explicit control flow and error handling. No exceptions for recoverable errors.
  5. Purity: Prefer pure functions. Isolate side-effects at edges.
  6. NEVER use Obj.magic: Breaks type safety. Always a better solution.

Naming Conventions

Element Convention Example
Files lowercase_underscores user_profile.ml
Modules Snake_case User_profile
Types snake_case, primary type is t type user_profile, type t
Values snake_case find_user, create_channel
Variants Snake_case Waiting_for_input, Processing_data

Function naming:

  • find_* returns option (may not exist)
  • get_* returns value directly (must exist)

Avoid: Long names with many underscores (get_user_profile_data_from_database_by_id).

Refactoring Patterns

Option/Result Combinators

(* Before *)
match get_value () with Some x -> Some (x + 1) | None -> None

(* After *)
Option.map (fun x -> x + 1) (get_value ())

Prefer: Option.map, Option.bind, Option.value, Result.map, Result.bind

Monadic Syntax (let*/let+)

(* Before - nested matches *)
match fetch_user id with
| Ok user -> (match fetch_perms user with Ok p -> Ok (user, p) | Error e -> Error e)
| Error e -> Error e

(* After *)
let open Result.Syntax in
let* user = fetch_user id in
let+ perms = fetch_perms user in
(user, perms)

Pattern Matching Over Conditionals

(* Before *)
if x > 0 then if x < 10 then "small" else "large" else "negative"

(* After *)
match x with
| x when x < 0 -> "negative"
| x when x < 10 -> "small"
| _ -> "large"

Function Design

Keep functions small: Under 50 lines. One purpose per function.

Read the full file on GitHub · 186 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. 5d ago Changed · +35 lines eb93265740c5
  2. 9d ago First seen · 151 lines · 44 tokens per session scan A 32f331a5b810

Subscribe to this mod's changes

code-style is a skill published in the GitHub repository avsm/ocaml-claude-marketplace (35 stars, last pushed 7d ago), licensed ISC. It adds 44 tokens to every session and 1,417 once invoked, about $0.0002 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.