Skip to content
Skillpedia
General coding75k · #2836

es-modules

What it does

This skill reviews JavaScript files that use older module syntax and suggests the modern standard. It is for developers who want leaner, clearer code.

When to use it

  • ✓When your JavaScript files still use require() or module.exports.
  • ✓When your bundle includes code that you never use.
  • ✓When you want your scripts to load as native browser modules.

Skill link

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/es-modules/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/es-modules/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Can you convert the require statements in my JavaScript file to import syntax?”

5 new skills a week. 1 minute to read.

How it works

The agent finds require and module.exports lines and suggests matching import and export statements. It also recommends named exports where they fit.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Use ES modules (import/export)

ES modules are statically analyzable — bundlers can determine at build time what code is actually used and eliminate the rest (tree-shaking). CommonJS require() is dynamic and prevents this optimization. ES modules are also the browser-native standard, reducing the need for build-time transformation.

Quick Reference

  • Use import/export syntax instead of require()/module.exports
  • Named exports improve IDE autocompletion and enable tree-shaking
  • Add type="module" to script tags or use a bundler to load ES modules in browsers
  • Default exports are fine but named exports scale better in large codebases

Check

Identify any use of require(), module.exports, or exports in this JavaScript file that should be converted to ES module syntax.

Fix

Convert all require() and module.exports statements to ES module import/export syntax.

Explain

Explain the benefits of ES modules over CommonJS, including tree-shaking, static analysis, and browser support.

Code Review

Review scripts, client components, and browser execution paths related to Use ES modules (import/export). Flag exact imports, event handlers, runtime side effects, or blocking operations that violate the rule, and state how the change should be verified in the browser.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/javascript/es-modules

FAQ

What is tree-shaking?

It is when a bundler removes code that is never used, which makes files smaller. Modern module syntax makes this possible.

Should I use named exports?

The skill says named exports scale better in large codebases, though default exports are still fine.

How do I load modules in a browser?

The skill suggests adding type=module to the script tag, or using a bundler.

Details

Original description by the author

Use when reviewing scripts, client components, bundles, or runtime behavior related to Use ES modules (import/export). Inspect both source code and the browser execution path so fixes target the real bottleneck or bug.

repo: thedaviddias/Front-End-Checklist

Popularity

GitHub stars
75k
Ranking position
#2836
License
MIT
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills