moonbit-refactoring

Refactor MoonBit code into idiomatic APIs while preserving behavior.

Updated Jan 17, 2026
One-click install
npx skills add https://github.com/f4ah6o/http11.mbt --skill moonbit-refactoring
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moonbit-refactoring
Source: https://github.com/f4ah6o/http11.mbt/tree/main/.codex/skills/moonbit-refactoring
Command: npx skills add https://github.com/f4ah6o/http11.mbt --skill moonbit-refactoring

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

MoonBit refactoring aims to reduce surface area and improve maintainability by converting free functions to methods, adopting pattern matching with views, and enforcing consistent architecture across packages while preserving public contracts.

Core Features & Use Cases

  • Minimize public API surface while preserving behavior.
  • Convert functions to methods and apply fluent chaining where beneficial.
  • Use view types (ArrayView/StringView/BytesView) to minimize copies.
  • Split large files and packages to improve readability and testing.
  • Update tests and docs alongside refactors.

Quick Start

Run the MoonBit refactor workflow on a target package to begin a safe modernization pass.

Frequently Asked Questions about moonbit-refactoring

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I minimize public API surface in MoonBit without changing behavior?

You can minimize public API surface in MoonBit by converting free functions to methods, adopting pattern matching with views, and splitting packages while running moon check and moon test to preserve behavior.

What is the best way to convert free functions to methods in MoonBit?

The best way to convert free functions to methods in MoonBit is through a structured refactoring workflow that splits files, applies fluent chaining, and updates tests and docs alongside the changes to maintain idiomatic code.

How do I use view types like ArrayView and StringView to minimize copies in MoonBit?

Use ArrayView, StringView, and BytesView in MoonBit to refactor pattern matching and minimize data copies. This approach reduces memory overhead while preserving the original public contracts of your packages.

Can I refactor large MoonBit packages to improve readability and testing?

Yes, you can refactor large MoonBit packages by splitting files and packages to improve readability and testing. The workflow enforces adding tests and docs alongside structural changes to maintain code quality.

Do I need external dependencies to run the MoonBit refactoring workflow?

No, you do not need external dependencies beyond the standard MoonBit tooling. The refactoring workflow relies entirely on running moon check and moon test to validate changes during package restructuring and API minimization.

Why does MoonBit refactoring enforce running moon check and moon test?

MoonBit refactoring enforces running moon check and moon test to ensure that converting functions to methods, applying view types, and splitting packages preserve the original behavior and public contracts throughout the modernization pass.