c-cpp-to-lean4-translator

c-cpp-to-lean4-translator is a skill for Claude Code, Codex from ArabelaTso/Skills-4-SE. It costs 85 tokens per session (2,768 once invoked), scanned A, original, Apache-2.0.

A source-code translator converts C or C++ programs into Lean4, a programming language that also supports formal proofs about whether code is correct.

In plain words
What is it for?
Use it when converting C or C++ code to Lean4, including programs with functions, data structures, control flow, input and output, and dependencies.
Why use it?
It reduces the manual work of porting programs while requiring attention to differences such as pointers, mutable data, loops, memory management, and undefined behavior.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when converting C or C++ code to Lean4, including programs with functions, data structures, control flow, input and output, and dependencies.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/arabelatso/skills-4-se/c-cpp-to-lean4-translator
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 ArabelaTso/Skills-4-SE --skill c-cpp-to-lean4-translator
Clone the repo
git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE

Made for: Claude Code, Codex.

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 c-cpp-to-lean4-translator

README.md
[![agentmods](https://agentmods.dev/badge/skills/arabelatso/skills-4-se/c-cpp-to-lean4-translator/github.svg)](https://agentmods.dev/skills/arabelatso/skills-4-se/c-cpp-to-lean4-translator)
Your own site
<a href="https://agentmods.dev/skills/arabelatso/skills-4-se/c-cpp-to-lean4-translator"><img src="https://agentmods.dev/badge/skills/arabelatso/skills-4-se/c-cpp-to-lean4-translator/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 c-cpp-to-lean4-translator

Your own site · 80×15
<a href="https://agentmods.dev/skills/arabelatso/skills-4-se/c-cpp-to-lean4-translator"><img src="https://agentmods.dev/badge/skills/arabelatso/skills-4-se/c-cpp-to-lean4-translator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 85 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,768 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.00085 $0.02768
Opus 5 $0.00043 $0.01384
Sonnet 5 $0.00017 $0.00554
Haiku 4.5 $0.00009 $0.00277

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

Security

Grade A, and why

c-cpp-to-lean4-translator 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 10d 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.

skills/c-cpp-to-lean4-translator/SKILL.md · 442 lines

How it starts

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

C/C++ to Lean4 Translator

Overview

Transform C or C++ programs into equivalent Lean4 code that preserves the original semantics while leveraging Lean4's functional programming paradigm, strong type system, and proof capabilities.

Translation Workflow

Step 1: Analyze Input Code

Understand the C/C++ program structure and semantics:

  1. Identify program components:

    • Functions and their signatures
    • Data structures (structs, classes, arrays)
    • Control flow patterns (loops, conditionals)
    • Memory management (allocation, pointers)
    • I/O operations
    • Dependencies and includes
  2. Understand semantics:

    • What does the program compute?
    • What are the inputs and outputs?
    • Are there side effects?
    • What are the invariants and preconditions?
  3. Note translation challenges:

    • Pointer arithmetic
    • Mutable state
    • Imperative loops
    • Manual memory management
    • Undefined behavior

Step 2: Design Lean4 Structure

Plan the Lean4 equivalent before writing code:

  1. Choose appropriate types:

    • Int for signed integers
    • Nat for unsigned integers and array indices
    • Float for floating-point numbers
    • Array for dynamic arrays
    • List for linked lists
    • Custom structure types for structs/classes
  2. Determine purity:

    • Pure functions: return values directly
    • Side effects: use IO monad
    • Mutable state: use IO.Ref or ST monad
  3. Plan control flow translation:

    • Loops → Recursive functions
    • Mutable variables → Function parameters
    • Early returns → Conditional expressions
  4. Handle memory:

    • Stack allocation → Direct values
    • Heap allocation → Automatic memory management
    • Pointers → Direct values or references

Step 3: Translate Code

Follow these translation principles:

Functions

Pattern: Pure function

// C/C++
int add(int a, int b) {
    return a + b;
}
-- Lean4
def add (a b : Int) : Int :=
  a + b

Read the full file on GitHub · 442 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 10d ago First seen · 442 lines · 85 tokens per session scan A 3e1e46b9078a

Subscribe to this mod's changes

c-cpp-to-lean4-translator is a skill published in the GitHub repository ArabelaTso/Skills-4-SE (251 stars, last pushed 20d ago), licensed Apache-2.0. It adds 85 tokens to every session and 2,768 once invoked, about $0.0004 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.

Related

Other skills, from other repositories

cpp-pro

Writes, optimizes, and debugs C++ applications using modern C++20/23 features, template metaprogramming, and high-performance systems techniques. Use when building or refactoring C++ code requiring concepts, ranges, coroutines, SIMD optimization, or careful memory management — or when addressing performance…

Jeffallan/claude-skills · 79 tokens

cpp

Use when writing modern C++ (17/20/23). Covers RAII, smart-pointer ownership, move semantics, ranges, concepts, and eliminating undefined behavior with sanitizers.

nimadorostkar/Claude-Skills-collection · 38 tokens

unreal-thirdparty

Expert guide for integrating third-party C/C++ libraries into Unreal Engine 5.x projects and plugins. Covers static linking, dynamic linking (DLL/SO/dylib), Build.cs configuration, ModuleType.External, delay loading, runtime dependency staging, wrapping patterns, cross-platform considerations (Windows/macOS/Linux)…

maystudios/claude-skills · 176 tokens

llama-cpp

Guide for llama.cpp, the C/C++ LLM inference framework by ggml-org. Covers the C API (llama.h), GGUF format, quantization (Q4KM, Q80, IQ4XS), CMake builds, GPU backends (CUDA, Vulkan, Metal, ROCm), HTTP server with OpenAI-compatible API, embeddings, grammar constraints, function calling, LoRA, speculative decoding…

maystudios/claude-skills · 185 tokens

unreal-gas

Expert guide for Unreal Engine 5.x Gameplay Ability System (GAS) C++ development. Covers AbilitySystemComponent, GameplayAbilities, GameplayEffects, Attributes/AttributeSets, GameplayTags, GameplayCues, AbilityTasks, prediction/replication, and common patterns. Use when the user asks about GAS, gameplay abilities…

maystudios/claude-skills · 149 tokens

plooc-integration

Use when integrating, refactoring, or debugging PLOOC object-oriented C - defclass encapsulation, privatemember protection, vtable dispatch, or inheritance-style structs.

easyzoom/aix-skills · 38 tokens