moonbit-refactoring

Refactor MoonBit code into idiomatic patterns with API minimization and tests.

63|2|Updated Aug 27, 2024
One-click install
npx skills add https://github.com/pnsk-lab/hikkaku --skill moonbit-refactoring-pnsk-lab
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: moonbit-refactoring
Source: https://github.com/pnsk-lab/hikkaku/tree/main/packages/moonscratch/.agents/skills/moonbit-refactoring
Command: npx skills add https://github.com/pnsk-lab/hikkaku --skill moonbit-refactoring-pnsk-lab

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the process of improving MoonBit code quality by making it more idiomatic, maintainable, and efficient.

Core Features & Use Cases

  • API Minimization: Shrinks public APIs to essential exports.
  • Code Transformation: Converts functions to methods and encourages pattern matching.
  • Code Quality: Adds loop invariants and ensures test coverage.
  • Use Case: When updating a MoonBit package, use this skill to refactor its APIs, modules, and tests for better structure and reduced complexity.

Quick Start

Use the moonbit-refactoring skill to refactor the provided MoonBit code 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?

Refactoring MoonBit code involves minimizing public APIs, converting functions to methods, and utilizing pattern matching to enhance maintainability and clarity while preserving original behavior.

What is the best way to minimize public APIs in a MoonBit package?

Minimizing APIs shrinks your MoonBit package exports to essential components. This refactoring process improves code structure and reduces complexity during package updates by adding necessary tests and documentation.

When do I need to convert functions to methods in MoonBit?

Convert functions to methods during MoonBit refactoring to improve code structure and encourage pattern matching utilization. This transformation enhances idiomatic practices and maintainability while ensuring behavioral preservation.

Does MoonBit refactoring affect existing test coverage?

MoonBit refactoring ensures behavioral preservation by adding necessary tests and documentation. It improves code quality by adding loop invariants and ensuring test coverage during API and module updates.

How do I update a MoonBit package without breaking existing behavior?

Updating a MoonBit package requires refactoring APIs, modules, and tests for better structure. The process ensures behavioral preservation by adding loop invariants and necessary test coverage while minimizing public exports.