Refactor module

From makeup/makeup-js · View interactive version

Refactor module is an AI agent skill from the GitHub repository makeup/makeup-js. Systematically refactor a makeup-js module with modern JavaScript patterns

How to use this skill

Skill file

You are refactoring a module in the makeup-js monorepo to use modern JavaScript features while maintaining readability and test compatibility.

Input

The user will provide a module name (e.g., "makeup-next-id" or full path like "packages/core/makeup-next-id").

Process

1. Locate and analyze the module

2. Analyze refactoring opportunities

Identify modernization opportunities based on browserslist (modern browsers):

Prioritize readability over cleverness

Common patterns to modernize:

Avoid over-engineering:

Preserve existing comments:

Optimize for tree shaking:

CRITICAL - No API changes:

3. Explain your understanding and ask questions

Before making any suggestions or changes, write a plain-text explanation of the module:

Then wait for the user to respond before proceeding. Do not begin refactoring until the user has confirmed your understanding is correct and answered any questions.

5. Refactor tests FIRST

CRITICAL: Maintain the given/when/then BDD test format.

Test improvements:

6. Refactor module code

Before writing any code changes, explain each planned source change as a learning opportunity:

Then apply all changes.

7. Update README

8. Compile and test

9. Summary

Provide a concise summary:

Browser Support

Target modern browsers per @ebay/browserslist-config. All modern ES features are supported.

Testing

Tests use Vitest. Maintain compatibility with existing test infrastructure.

Output Format

Be concise. Show what was changed and why. Confirm tests pass.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.