Codemod Migration Assistant for Openclaw

An AI-powered skill for orchestrating codebase migrations, library upgrades, AST-first code refactoring, and custom codemod authoring using the Codemod CLI.

mohebifar
v1.0.0
May 21, 2026
1
762
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install codemod

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 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 Migration Assistant?

The Codemod Migration Assistant is a powerful automation capability designed to streamline framework migrations, dependency upgrades, API surface updates, and large-scale mechanical edits. By prioritizing deterministic, registry-based code transformations over open-ended AI rewrites, this skill ensures that codebase refactoring is repeatable, predictable, and highly aligned with industry standards. As one of the key Openclaw Skills, it helps maintain high code quality across repositories without the manual overhead of traditional manual refactoring.

The skill seamlessly integrates with the Codemod CLI and MCP (Model Context Protocol) to offer interactive search, AST (Abstract Syntax Tree) visualization, and automated verification. Developers can inspect AST shapes, execute dry-runs, validate package configurations, and even author new codemod packages with detailed guidance from the built-in documentation and troubleshooting workflow systems.

Codemod Migration Assistant Use Cases

  • Framework and SDK Migrations: Upgrading application frameworks (e.g., React, Next.js, or Vue) or library SDKs across breaking change boundaries.
  • Deprecation Updates: Automatically finding and replacing deprecated API surface calls with their modern equivalents across thousands of files.
  • AST-First Refactoring: Performing large-scale, structural code refactors based on AST nodes rather than fragile regex heuristics.
  • Custom Codemod Package Authoring: Scaffolding, testing, and building custom codemod packages (via JS/TS or ast-grep) locally or for publishing to the registry.
  • Automated Verification: Running dry-runs, defining edge-case fixtures, and validating migration safety before applying any modification.

How Codemod Migration Assistant Works

  1. Registry Discovery: When a migration request is received, the agent immediately runs codemod search to locate existing, verified packages in the Codemod Registry.
  2. Environment & Target Inspection: The skill analyzes representative files in the target repository to align scopes, languages, and configure local project settings.
  3. Prerequisite & Documentation Retrieval: It queries Codemod CLI AI tools or MCP resources (like codemod ai docs) to pull specific CLI, JSSG, or troubleshooting instructions.
  4. Dry-Run & Simulation: Prior to application, the skill executes code modifications in a dry-run state (--dry-run) to preview the exact diffs and verify transformations.
  5. Scaffolding and Authoring (If New): If no matching registry package is found, it initializes a new codemod via codemod init <path> --no-interactive and scaffolds the AST rules, test fixtures, and metadata files.
  6. Validation & Execution: The skill runs validate_codemod_package to ensure no starter scaffolds remain, verifies tests pass, and applies the final changes across the target codebase.

Codemod Migration Assistant Setup

# Ensure you have npx available and install the Codemod CLI globally or run on-demand
npx codemod --help

# Search for available codemods to verify connection
npx codemod search <migration-intent>

For offline or non-MCP environments, the Openclaw Skills integration leverages the fallback CLI commands directly, ensuring full capability reproduction through npx codemod ai commands.

Codemod Migration Assistant Data Schema & Taxonomy

The skill interacts with and generates files following a highly structured codemod package layout. Below is the metadata taxonomy and directory structure managed by the skill:

File / Path Type Description
codemod.yaml Configuration Defines target language, engine parameters, and general metadata.
workflow.yaml Execution Workflow Describes the execution steps, including inclusion/exclusion file globs and step order.
package.json Package Metadata Defines node dependencies, scripts, and runtime engines (e.g., JSSG, LLRT).
README.md Documentation Contains clear usage instructions, prerequisites, and code transformation descriptions.
__testfixtures__/ Test Directory Contains positive, negative, and edge-case code inputs and expected outputs to guard against regressions.

The data processed during runtime includes AST structure representations obtained via npx codemod ai dump-ast and node type identifiers retrieved from npx codemod ai node-types <language>.

Codemod Migration Assistant Advanced Features

  • AST Visualization and Inspection: Direct integration with tree-sitter and AST parsers via npx codemod ai dump-ast and node-types tools to inspect code structure prior to writing rules.
  • Fallback CLI Execution: Full feature parity between direct MCP calls and codemod ai shell scripts, allowing uninterrupted operation in constrained runtime environments.
  • Comprehensive Validation Harness: Out-of-the-box support for validate_codemod_package to programmatically detect template leftovers, missing fixtures, or failing tests.
  • JSSG and AST-Grep Support: Advanced, semantic, and binding-aware code manipulation capabilities using TS/JS and ast-grep engines.
  • Monorepo and Sharding Management: Automated guidelines for splitting large repository migrations into multiple structured PRs and handling mono-repo configurations.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*