moonbit-refactoring

Refactor MoonBit code to idiomatic style with API minimization and test coverage.

40|3|Updated May 28, 2025
One-click install
npx skills add https://github.com/justjavac/moonbit-webview --skill moonbit-refactoring-justjavac
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moonbit-refactoring
Source: https://github.com/justjavac/moonbit-webview/tree/main/.agents/skills/moonbit-refactoring
Command: npx skills add https://github.com/justjavac/moonbit-webview --skill moonbit-refactoring-justjavac

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill streamlines MoonBit code by making it more idiomatic, improving maintainability, and ensuring code quality through API minimization, pattern matching, and test coverage.

Core Features & Use Cases

  • API Minimization: Shrinks public APIs to essential exports.
  • Code Style: Converts functions to methods, utilizes pattern matching with views, and adds loop invariants.
  • Test Coverage: Ensures tests are updated and comprehensive without regressions.
  • Use Case: When updating a MoonBit package, use this Skill to refactor its APIs, modules, and tests to adhere to best practices, making the codebase cleaner and more robust.

Quick Start

Refactor the MoonBit code in the current directory to be more idiomatic.

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 be more idiomatic?

To refactor MoonBit code idiomatically, shrink public APIs, convert functions to methods, use pattern matching with views, and add loop invariants. This enforces MoonBit's declarative style and functional programming principles while updating your modules.

What does idiomatic MoonBit code look like?

Idiomatic MoonBit code minimizes public APIs to essential exports and leverages pattern matching with views. It also uses methods over standalone functions and includes loop invariants to align with MoonBit's declarative style and functional programming principles.

How do I minimize public APIs in a MoonBit package?

Minimize public APIs in a MoonBit package by shrinking exports to only essential components. Refactoring tools convert functions to methods and apply pattern matching, ensuring a cleaner, more maintainable, and robust codebase.

Can I update MoonBit tests without causing regressions during refactoring?

Yes, you can update MoonBit tests without regressions by ensuring comprehensive test coverage during the refactoring process. The refactoring workflow maintains test integrity while applying API minimization and declarative style improvements.

When should I use pattern matching with views in MoonBit?

Use pattern matching with views in MoonBit when refactoring code to adhere to best practices. It replaces complex conditional logic, supporting the functional programming principles and declarative style required for idiomatic MoonBit packages.

Does MoonBit refactoring require adding loop invariants?

Yes, idiomatic MoonBit refactoring requires adding loop invariants to ensure code robustness. This practice aligns with MoonBit's declarative style and functional programming principles, improving overall code quality and maintainability.