Skip to content
Back to skills

M2cgen

ASecurity

"Use m2cgen to transpile fitted Python machine-learning models into

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 8, 2026
developmentjavascriptpythonrustgojavarubyphpc#shellbash

Works with

  • cli
  • api

Security analysis

A96/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 11 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill m2cgen --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of M2cgen?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for M2cgen
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-m2cgen/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-m2cgen)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: m2cgen
description: "Use m2cgen to transpile fitted Python machine-learning models into
  standalone C, C#, Dart, Elixir, F#, Go, Haskell, Java, JavaScript, PHP,
  PowerShell, Python, R, Ruby, Rust, or Visual Basic code through its API or
  CLI."
disable-model-invocation: true
metadata:
  disco-role: operating
license: MIT
---

# m2cgen

Use this repo skill when a task involves converting an already fitted Python estimator or booster into native source code, selecting a supported target language, or diagnosing m2cgen API/CLI export failures.

## Install and verify

Install the public package in the environment that contains the fitted model:

```bash
python -m pip install m2cgen
python -c "import m2cgen; print(m2cgen.__version__)"
```

The package has a base NumPy dependency. The library that created a serialized model (for example scikit-learn, statsmodels, lightning, XGBoost, or LightGBM) must also be installed when the model is fitted or unpickled.

## Route by task

- **Export an in-memory fitted model**: read [`sub-skills/model-export/SKILL.md`](sub-skills/model-export/SKILL.md), then [`sub-skills/model-export/references/api-reference.md`](sub-skills/model-export/references/api-reference.md).
- **Export a pickle/joblib file or pipe stdin**: read [`sub-skills/model-export/references/cli-reference.md`](sub-skills/model-export/references/cli-reference.md).
- **Choose a model family, understand output semantics, or check target support**: read [`sub-skills/model-export/references/model-overview.md`](sub-skills/model-export/references/model-overview.md).
- **Follow an end-to-end recipe or use the bundled smoke check**: read [`sub-skills/model-export/references/workflows.md`](sub-skills/model-export/references/workflows.md).
- **Investigate unsupported models, dependencies, recursion, serialization, or numerical differences**: read [`references/troubleshooting.md`](references/troubleshooting.md) and the sub-skill troubleshooting reference.

## Minimal decision process

1. Confirm that the object is fitted and identify its runtime estimator class.
2. Select one of the 16 supported target-language exporters; do not infer support from a similar language name.
3. Use the Python API for an in-memory object or the CLI for pickle/joblib and shell pipelines.
4. Pass only target-appropriate naming options, then validate the generated source before integrating it into a build.
5. Compare generated predictions with the original model using the correct output semantics and a floating-point tolerance.

## Boundaries

This skill covers public m2cgen usage and export troubleshooting. It does not train models, execute generated programs in foreign runtimes, or reproduce the repository's maintainer-only bulk example generation.

Read [`references/repo-provenance.md`](references/repo-provenance.md) before deciding whether this skill is stale for a changed checkout. The generated skill is self-contained; the original repository's tests, examples, and tools are evidence rather than runtime dependencies.

Files in this skill

  • SKILL.md3 KB
  • references/repo-provenance.md2.9 KB
  • references/repo-routing-metadata.json338 B
  • references/troubleshooting.md2.9 KB
  • sub-skills/model-export/SKILL.md2 KB
  • sub-skills/model-export/references/api-reference.md3.1 KB
  • sub-skills/model-export/references/cli-reference.md4 KB
  • sub-skills/model-export/references/model-overview.md6.4 KB
  • sub-skills/model-export/references/troubleshooting.md4.4 KB
  • sub-skills/model-export/references/workflows.md3.8 KB
  • sub-skills/model-export/scripts/smoke_export.py9 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.