moonbit-refactoring

Refactor MoonBit code to idiomatic practices with API minimization and function-to-method conversion.

5|1|Updated Mar 2, 2026
One-click install
npx skills add https://github.com/golemcloud/moonbit-sdk --skill moonbit-refactoring-golemcloud
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moonbit-refactoring
Source: https://github.com/golemcloud/moonbit-sdk/tree/main/.agents/skills/moonbit-refactoring
Command: npx skills add https://github.com/golemcloud/moonbit-sdk --skill moonbit-refactoring-golemcloud

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers refactor MoonBit code to be more idiomatic, efficient, and maintainable by applying best practices for API design, code structure, and pattern matching.

Core Features & Use Cases

  • API Minimization: Shrinks public APIs to only expose necessary elements.
  • Code Style: Converts functions to methods, encourages pattern matching, and promotes the use of views for efficiency.
  • Maintainability: Adds loop invariants and ensures test coverage to prevent regressions.
  • Use Case: When updating MoonBit packages or refactoring existing MoonBit APIs, modules, or tests to improve code quality and reduce complexity.

Quick Start

Use the moonbit-refactoring skill to refactor the MoonBit code in the current directory to shrink public APIs and convert functions to methods.

Frequently Asked Questions about moonbit-refactoring

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

FAQPage Schema
How do I refactor MoonBit code to make it more idiomatic?

Idiomatic MoonBit refactoring involves minimizing public APIs, converting functions to methods, applying pattern matching with views, and adding loop invariants to ensure behavioral preservation and enhanced maintainability across your modules.

What is the best way to minimize a public API in MoonBit packages?

The best way to minimize a public API in MoonBit is to perform an architecture review and API inventory, iteratively applying refactoring themes to expose only necessary elements, which shrinks the API surface and reduces module complexity.

How do I convert MoonBit functions to methods and use pattern matching views?

Converting MoonBit functions to methods and using pattern matching views requires iteratively applying specific refactoring themes. This code style conversion promotes efficient views and ensures structural improvements while preserving behavior.

Does MoonBit refactoring handle test coverage and loop invariants?

Yes, MoonBit refactoring handles test coverage and loop invariants by adding them during the iterative refactoring process. This maintains behavioral preservation and prevents regressions when updating modules.

Can I refactor MoonBit APIs and tests without breaking existing behavior?

Yes, you can refactor MoonBit APIs, modules, and tests without breaking behavior by following specific workflow steps. This includes architecture review, API inventory, and iterative application of refactoring themes to ensure behavioral preservation.