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.mdCopy 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
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
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.
Popularity
- GitHub stars
- 75k
- Ranking position
- #2836
- License
- MIT
- Updated
- 10/31/2026
Comments
- …
More skills from this repository
frontendchecklist
75kChecks frontend code and live pages against 380+ rules for accessibility, speed, SEO and security, using a command-line tool.
frontend-checklist-global
75kAudits a frontend project against all 386 Front-End Checklist rules, and gives a specific fix for each issue found.
404-page
75kChecks that your missing-page screen offers helpful links and returns a real 404 status, to help lost visitors find their way.
about-page
75kReviews whether your site has a clear About page that explains who runs it, to build trust with visitors and search engines.
Similar skills
diffs
394kLets your agent produce a real, shareable diff of edits as a viewer link or image file, instead of a hand-written summary.
coding-agent
394kHelps your agent hand a larger coding job to Codex, Claude Code, or OpenCode as a background worker, then check on its progress.
gh-issues
394kHelps your agent find GitHub issues, pick the ones to work on, and open pull requests with fixes, including follow-up on review comments.