← 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.1
Published
4 months ago
Download
Download ZIP

SHA-256

e89b88636c567fb3ec31134d82667ff8a8919da27a1eb261eb451a027064de9d

Powered by MoonBit

Site sourceReport issueModulesSkillsBuild queueStatistics

© 2026 mooncakes.io