2.5k
GitHub Stars
4
Bundled Files
2 months ago
Catalog Refreshed
3 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill openclaw/skills --skill neo-es6-refactor- _meta.json280 B
- package.json1.9 KB
- README.md895 B
- SKILL.md7.3 KB
Overview
This skill automatically modernizes JavaScript and TypeScript codebases by applying ES6+ patterns and syntax. It converts legacy constructs—var, callbacks, CommonJS—into let/const, async/await, and ES modules while preserving behavior and comments. The tool is available as a CLI and programmatic agent mode for integration into developer workflows.
How this skill works
The refactorer parses files into an AST using Babel, analyzes variable usage and types, then applies rule-driven transformations (stored as JSON patterns) to replace legacy nodes with modern equivalents. After transformation it generates formatted output consistent with Prettier, validates syntax, and can emit diffs or a dry-run report for review. TypeScript and JSX are supported; type annotations and declaration files are preserved.
When to use it
- Upgrade a legacy codebase from ES5/CommonJS to ES6+ modules and syntax
- Replace callback-based flows with async/await for clearer async code
- Convert var declarations to let/const to reduce scope bugs
- Batch-modernize many files using CLI glob patterns before a major release
- Integrate into CI for automated style and syntax modernization
Best practices
- Run in dry-run mode first and review diffs before writing files
- Back up or version-control the codebase prior to bulk transformations
- Target a specific ECMAScript target (e.g., ES2020) to avoid unsupported features
- Use project-specific JSON configuration to tune rule priorities and guards
- Run unit tests after refactoring to confirm functional equivalence
Example use cases
- Convert a Node.js project from CommonJS require/module.exports to ES module imports/exports
- Refactor UI components written with function expressions to arrow functions and destructuring
- Modernize TypeScript files while preserving type annotations and .d.ts compatibility
- Perform a dry-run across src/ and generate unified diffs for code review
- Automate refactors in an OpenClaw agent pipeline using structured JSON I/O
FAQ
No. Rules are designed to preserve functional equivalence; guards analyze scope and reassignments to avoid behavior changes.
Does it add polyfills for new language features?
No. The tool performs syntax transformations only and does not inject polyfills or alter runtime compatibility.
Can I customize transformation rules?
Yes. Rules and priorities are configurable via JSON to match project style and constraints.
What languages and syntaxes are supported?
JavaScript and TypeScript including JSX are supported; non-JS/TS files are ignored.