← All skills

embed

Embed files into a generated MoonBit source file.

$ files
SKILL.md
SKILL.md

embed

Use this skill when a MoonBit project needs small fixture files, examples, templates, or other static assets checked in as generated MoonBit source.

Workflow

  1. Choose the exact file or directory to embed. Do not embed build outputs, dependency caches, secrets, or large generated trees unless the user explicitly asks for them.
  2. Choose an output .mbt path in the package that should own the embedded data. The output path is required; missing parent directories are created.
  3. Run the tool:

moon runwasm moonbit-community/embed <path> -o <output.mbt> [--prune <path> ...]

Use repeated --prune <path> / -p <path> options for paths relative to the input directory:

moon runwasm moonbit-community/embed ./fixtures -o test/fixtures_bundle.mbt --prune _build --prune .mooncakes

  1. Inspect the generated file before handoff. Check that the public names are usable for the surrounding code and that no unintended files were embedded.
  2. Run the package or module checks that cover the output file, normally moon check and the relevant moon test.

Guidance

  • Prefer embedding stable, small inputs used by tests, examples, or code generation. Keep large assets as external files unless embedding is intentional.
  • Prune common project noise such as _build, .mooncakes, tmp, node_modules, coverage output, downloaded dependencies, and editor caches.
  • Binary files are supported, but inspect the generated size before committing.
  • Directory inputs are recursive and keep their nested structure in the generated MoonBit API.
  • If generated names collide or are awkward, rename the source files or choose a narrower input directory, then regenerate.

Skill
Name
moonbit-community/embed
Version
0.1.5
Published
last month
Download
Download ZIP

SHA-256

fead05fe777afd0ffb03d0ea9a24ac6e26bbdb7d30ec02e52b89d1797180f0da

Powered by MoonBit

Site sourceReport issueModulesSkillsBuild queueStatistics

© 2026 mooncakes.io