ES6 Refactor for Openclaw

Automatically transform legacy JavaScript and TypeScript code into modern ES6+ standards using AST-based refactoring.

martinforsulu
v1.0.0
Feb 25, 2026
0
0
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install neo-es6-refactor

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install neo-es6-refactor using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is ES6 Refactor?

ES6 Refactor is a sophisticated code transformation utility designed to modernize aging codebases by converting legacy patterns into clean, modern ES6+ equivalents. By leveraging Babel-powered Abstract Syntax Tree (AST) parsing, the tool identifies and replaces outdated syntax such as var declarations, traditional function expressions, and callback chains with let/const, arrow functions, and async/await.

This skill is an essential part of the Openclaw Skills library for developers looking to maintain high code quality and consistency. It ensures that functional logic remains identical while improving readability and adhering to contemporary ECMAScript standards. It handles everything from simple syntax sugar to complex module system migrations, making it a versatile asset for any modernization project.

ES6 Refactor Use Cases

  • Migrating legacy JavaScript projects to modern ES6+ standards to improve maintainability.
  • Converting CommonJS require statements to ES module imports to support modern build tools and tree-shaking.
  • Replacing deeply nested callback structures with clean, readable async/await patterns.
  • Standardizing variable declarations across a large team repository to eliminate the use of var.
  • Updating TypeScript codebases to utilize modern type inference and newer syntax features like optional chaining.

How ES6 Refactor Works

  1. The skill accepts JavaScript or TypeScript source code and parses it into an Abstract Syntax Tree (AST) using @babel/parser to understand the code's logical structure.
  2. It performs a detailed scope and reassignment analysis to determine which variables can safely be converted to const versus let.
  3. The engine applies a series of rule-based transformations to the AST nodes, replacing legacy patterns with modern syntax as defined in the transformation logic.
  4. For TypeScript files, the tool ensures type annotations are preserved and correctly mapped to the new syntax structures.
  5. The transformed AST is regenerated into source code, utilizing Prettier to ensure the output is perfectly formatted and human-readable.
  6. A final validation step runs the generated code through a syntax check to guarantee no functional regressions were introduced during refactoring.

ES6 Refactor Setup

To begin using this skill within your environment, follow these installation steps:

# Install the ES6 Refactor utility via npm
npm install -g @openclaw/es6-refactor

# Confirm the installation was successful
es6-refactor --help

# Perform a dry run on a directory to see proposed changes
es6-refactor ./src --dry-run --diff

ES6 Refactor Data Schema & Taxonomy

The skill organizes its operations based on the following technical schema:

Component Technical Detail
AST Engine Uses @babel/core for high-fidelity code manipulation and source map preservation.
Rules Engine Driven by a JSON-based pattern library that matches legacy node types to modern templates.
Compatibility References an internal feature matrix to ensure generated code matches target environment versions (e.g., ES2020).
Output Standards Standardized via Prettier with support for custom .prettierrc configurations.
Metadata Tracks transformation logs for audit trails and functional equivalence verification.

ES6 Refactor Advanced Features

  • Dry Run and Unified Diff: Preview all modernization changes in the terminal before committing them to the file system.
  • Openclaw Skills Integration: Native support for agent-mode, allowing AI coding assistants to programmatically refactor code via JSON-RPC style interactions.
  • Module Transformation: Automated conversion of module.exports and require() into export and import statements, including support for dynamic imports.
  • JSX and TSX Support: Fully compatible with React and other JSX-based frameworks, preserving component structure while modernizing internal logic.
  • Custom Transformation Rules: Users can provide a JSON configuration to toggle specific rules or prioritize certain patterns based on project-specific style guides.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*