hs-to-rocq: Command for Claude Code

.claude/commands/new-example.md

new-example is a command for Claude Code from plclub/hs-to-rocq. It costs 0 tokens per session (2,349 once invoked), scanned C, original, MIT.

A command for adding an example that translates a Haskell library into Coq, a proof assistant used to formally check mathematical and software properties.

In plain words
What is it for?
Use it to create the example directory, add the Haskell repository, identify source files, and produce translated Coq code.
Why use it?
It provides a repeatable project structure and workflow for importing a library and handling the translation work.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md.

This is plclub/hs-to-rocq's own configuration. It tells Claude Code how to work on hs-to-rocq itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything hs-to-rocq configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is include ../../common.mk.

Reuse

Borrowing it

Nothing to install: this file belongs to plclub/hs-to-rocq. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/plclub/hs-to-rocq/master/.claude/commands/new-example.md
Clone the repo
git clone --depth 1 https://github.com/plclub/hs-to-rocq

Made for: Claude Code.

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 new-example

README.md
[![agentmods](https://agentmods.dev/badge/commands/plclub/hs-to-rocq/new-example.svg)](https://agentmods.dev/commands/plclub/hs-to-rocq/new-example)
Your own site
<a href="https://agentmods.dev/commands/plclub/hs-to-rocq/new-example"><img src="https://agentmods.dev/badge/commands/plclub/hs-to-rocq/new-example.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,349 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. 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.00000 $0.02349
Opus 5 $0.00000 $0.01175
Sonnet 5 $0.00000 $0.00470
Haiku 4.5 $0.00000 $0.00235

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

Security

Grade C, and why

new-example scanned grade C with 1 finding 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.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf $(OUT) hs-spec
.claude/commands/new-example.md · 306 lines

How it starts

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

New hs-to-rocq Example

Create a new hs-to-rocq example that translates a Haskell library to Coq. This skill sets up the directory structure, configures the build system, and iteratively translates the library following the Translation Principles from CLAUDE.md.

Arguments

The argument should be the library name and its Git repository URL, e.g.:

/new-example mtl https://github.com/haskell/mtl.git

If only a name is given, ask the user for the repository URL.

Phase 1: Setup

1.1 Create directory structure

examples/<name>/
├── Makefile
├── README.md
├── edits                    # Start empty
├── <name>/                  # Git submodule
├── lib/                     # Generated output (created by make)
├── module-edits/            # Per-module edits (created as needed)
└── theories/                # Proofs (created later if needed)

1.2 Add Git submodule

git submodule add <REPO_URL> examples/<name>/<name>

Pin to a specific tag/commit if the user specifies one. Ask:

  • "Which version/tag/commit of the library should I use?"

1.3 Identify Haskell source files

Explore the submodule to find:

  • The src/ or lib/ directory containing Haskell sources
  • The .cabal file to understand module structure and dependencies
  • Which modules are "exposed" (public API) vs internal

Ask the user:

  • "I found N modules. Should I translate all of them, or start with a subset?"

1.4 Create Makefile

Use the graph/containers Makefile as a template. The Makefile must:

include ../../common.mk

ifeq (,$(wildcard <name>))
$(error Please run git submodule update --init examples/<name>/<name>)
endif

OUT=lib

MODULES = \
  Module/Path/One \
  Module/Path/Two

VFILES_GEN = $(addprefix $(OUT)/,$(addsuffix .v,$(MODULES)))
VFILES = $(VFILES_GEN)

all: vfiles coq

vfiles: $(OUT)/edits $(OUT)/_CoqProject $(OUT)/README.md $(VFILES)

$(OUT)/_CoqProject: Makefile
	mkdir -p $(OUT)
	> $@
	echo '-Q . ""' >> $@
	echo '-Q ../../../base ""' >> $@
	$(foreach f,$(addsuffix .v,$(MODULES)),echo '$(f)' >> $@;)

$(OUT)/edits:
	ln -fs ../edits $(OUT)/edits

$(OUT)/README.md:
	mkdir -p $(OUT)
	> $@
	echo 'This directory contains generated Coq files. Do not edit directly.' >> $@

coq: $(OUT)/_CoqProject $(VFILES)
	cd $(OUT) && coq_makefile -f _CoqProject -o Makefile
	$(MAKE) -C $(OUT)

HS_TO_ROCQ_OPTS := \
  -e ../../base/edits \
  -e edits \
  --iface-dir ../../base/ \
  --iface-dir $(OUT) \
  -N \
  -i <name>/<src-path>

.SECONDEXPANSION:
$(VFILES_GEN): $(OUT)/%.v : $$(wildcard module-edits/$$*/preamble.v) \
                            $$(wildcard module-edits/$$*/midamble.v) \
                            $$(wildcard module-edits/$$*/edits) \
                            $$(wildcard module-edits/$$*/flags) \
                            edits $(OUT)/README.md
	$(HS_TO_ROCQ) $(addprefix -e , $(wildcard module-edits/$*/edits)) \
	             $(addprefix -p , $(wildcard module-edits/$*/preamble.v)) \
	             $(addprefix --midamble , $(wildcard module-edits/$*/midamble.v)) \
	             $(HS_TO_ROCQ_OPTS) \
	             -o $(OUT) \
	             <name>/<src-path>/$*.hs
	test -e $@

clean:
	rm -rf $(OUT) hs-spec

theories: coq
	@if test -f theories/_CoqProject; then \
	  cd theories && coq_makefile -f _CoqProject -o Makefile && $(MAKE); \
	fi

Read the full file on GitHub · 306 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 First seen · 306 lines · 0 tokens per session scan C 52766849e42a

Subscribe to this mod's changes

new-example is a command published in the GitHub repository plclub/hs-to-rocq (96 stars, last pushed 2mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,349 tokens. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-01.