Codemod Generator for Openclaw

An AI-driven CLI tool that generates jscodeshift scripts to automate complex, large-scale code refactoring via natural language commands.

lxgicstudios
v1.0.2
Jan 29, 2026
0
0
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install codemod-gen

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 codemod-gen 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 Codemod Generator?

The Codemod Generator is a specialized tool designed to handle massive code transformations that go beyond the capabilities of traditional find-and-replace methods. By utilizing Abstract Syntax Tree (AST) manipulation, it allows developers to describe complex refactoring patterns in plain English and receive a production-ready script that safely modifies source code while preserving original formatting and comments.

Part of the Openclaw Skills collection, this utility simplifies the process of modernizing legacy codebases, migrating between libraries, and enforcing new architectural standards. It removes the barrier of entry for writing complex jscodeshift or Babel scripts, enabling teams to execute codebase-wide upgrades with confidence and speed.

Codemod Generator Use Cases

  • Performing major framework upgrades, such as migrating from React Router v5 to v6.
  • Modernizing legacy JavaScript by converting class-based components to functional components with hooks.
  • Replacing deprecated third-party libraries like Lodash or Moment.js with modern native alternatives or lightweight utilities.
  • Enforcing new internal code patterns and standardizing styles across hundreds or thousands of files simultaneously.

How Codemod Generator Works

  1. The developer provides a natural language description of the required code change via the CLI.
  2. The AI interprets the description to determine the necessary Abstract Syntax Tree (AST) modifications.
  3. A custom jscodeshift codemod script is generated specifically for the requested transformation.
  4. The user runs the generated codemod against their codebase to apply the changes safely.
  5. The tool ensures that the logic is updated while keeping the surrounding code style and comments intact.

Codemod Generator Setup

The Codemod Generator requires Node.js 18 or higher. No permanent installation is necessary as it can be executed via npx. You must provide an OpenAI API key to power the transformation logic.

# Set your environment variable
export OPENAI_API_KEY='your_api_key_here'

# Execute a transformation command
npx ai-codemod "replace lodash.get with optional chaining"

Codemod Generator Data Schema & Taxonomy

The skill processes natural language input and outputs executable JavaScript logic. The following table describes the primary data elements involved:

Element Format Description
Transformation Prompt String The natural language instruction describing the code change.
Generated Codemod JavaScript A jscodeshift-compatible script containing the AST logic.
Target Source Filesystem The local code files (JS/TS) being analyzed and modified.
Environment Config ENV Metadata and API keys required for execution.

Codemod Generator Advanced Features

  • Generates robust jscodeshift scripts capable of handling nested logic and complex syntax trees.
  • Provides support for multiple migration types, including framework-specific upgrades and API deprecations.
  • Designed for zero-configuration use cases, making it a highly accessible part of the Openclaw Skills ecosystem.
  • Maintains code integrity by focusing on structural AST changes rather than simple string matching.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*