moonbit-spec-test-development

Installation
SKILL.md

MoonBit Spec & Test Development

Overview

Define a formal API contract in <pkg>_spec.mbt, write type-checked tests against it, and scaffold a minimal MoonBit module so moon check passes before implementation work begins.

Workflow

Confirm API surface (if needed)

  • Infer the package name from context; only ask if ambiguous.
  • Confirm the API surface: core types, entry points, error types, and any versioning needs.

Scaffold the module using moon new (preferred for new projects)

  • If you didn't use moon new, fall back to the moon.mod.json and moon.pkg.json templates.

Write the formal spec (<pkg>_spec.mbt)

  • Use #declaration_only for all types/functions that will be implemented later.
  • Functions with #declaration_only must still have a body: { ... }.
  • Keep the spec as the contract: treat it as read-only after creation; implementation goes in new files under the same package.
  • Use pub(all) for types you need to construct in tests; keep pub for opaque types.
Installs
177
GitHub Stars
30
First Seen
May 21, 2026
moonbit-spec-test-development — moonbitlang/skills