ast-refactor

Identify and transform code patterns structurally using AST-based searches and refactoring.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/Jimmy-Jung/claude_symbiote --skill ast-refactor
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: ast-refactor
Source: https://github.com/Jimmy-Jung/claude_symbiote/tree/main/.claude/skills/ast-refactor
Command: npx skills add https://github.com/Jimmy-Jung/claude_symbiote --skill ast-refactor

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Structural code transformations are error-prone when done by text-based search. This skill provides AST-based search and refactoring to reliably locate and replace code patterns across large codebases.

Core Features & Use Cases

  • AST-based search and replace across JavaScript, TypeScript, Python, and other languages.
  • Pattern-driven refactoring with meta-variables to target specific constructs.
  • Safe transformations with a defined workflow: define pattern, scan, review, apply, and verify.

Quick Start

Refactor a codebase by defining an AST pattern and executing it on your target files.

Frequently Asked Questions about ast-refactor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor code patterns reliably across a multi-language codebase?▼

AST-based refactoring locates and replaces code patterns structurally instead of relying on text. It analyzes the abstract syntax tree to ensure safe transformations across large multi-language repositories like JavaScript, TypeScript, and Python.

Why does text-based search and replace fail for large repository refactoring?▼

Text-based refactoring is brittle because it ignores code structure and easily breaks syntax. Pattern matching with meta-variables on an abstract syntax tree avoids these errors by targeting specific constructs structurally across the codebase.

What is the workflow for safely applying AST pattern search and transformations?▼

The safe transformation workflow involves five steps: define the AST pattern, scan the target files, review the matched code, apply the structural replacements, and verify the results to ensure accurate multi-language refactoring.

Can I use ast-grep to find and replace specific code constructs with meta-variables?▼

Yes, ast-grep supports pattern-driven refactoring with meta-variables. You can define structural patterns to target specific code constructs and execute reliable AST-based search and replace operations across your codebase.

Does AST refactoring work for both JavaScript and Python files?▼

Yes, AST-based search and replace supports multi-language codebases including JavaScript, TypeScript, and Python. It uses structural pattern matching to safely refactor code across different programming languages within the same repository.