sl:ast-replace

Apply AST-driven code pattern replacements across a codebase after preview confirmation.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/HuynhHoangPhuc/solon --skill sl-ast-replace
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sl:ast-replace
Source: https://github.com/HuynhHoangPhuc/solon/tree/main/plugins/solon-cli/skills/ast-replace
Command: npx skills add https://github.com/HuynhHoangPhuc/solon --skill sl-ast-replace

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This tool enables safe, pattern-based code transformations by applying AST-driven replacements with a built-in preview mode.

Core Features & Use Cases

  • Semantic replacements: transform code structures across languages using AST patterns.
  • Safe preview: verify changes before applying, minimizing risk to the codebase.
  • Use Case: refactor repeated function calls or API usages in a large TypeScript/JavaScript project without manual edits.

Quick Start

Preview semantic code replacements across your project using ast patterns before applying changes.

Frequently Asked Questions about sl:ast-replace

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

FAQPage Schema
How do I safely refactor repeated function calls across a large TypeScript codebase?

You can refactor repeated function calls using AST-driven pattern matching to identify replacement targets and preview changes before applying them. This ensures safe code transformations across your project without manual edits.

How does AST pattern matching work for code refactoring?

AST pattern matching works by parsing code into an abstract syntax tree and identifying structural patterns rather than matching plain text. This allows semantic replacements that understand code structure, ensuring accurate transformations.

Can I use AST-based replacements for both JavaScript and Rust code?

Yes, AST-based replacements support multi-language patterns including JavaScript, TypeScript, and Rust. The tool uses AST guidance to apply semantic code transformations across different languages within your project.

What is the best way to preview code changes before applying refactoring?

The best way to preview code changes is using a preview-first workflow that shows all AST-driven replacements before applying them. You verify the semantic transformations first, minimizing risk to your codebase.

Do I need the sg binary to perform AST-based code replacements?

Yes, you need the sg binary to perform pattern-based edits and integrate with your project tooling. It handles the AST pattern matching and replacement execution required for safe code transformations.

What are the limitations of AST-driven code pattern replacements?

AST-driven replacements require valid syntax for pattern matching and depend on the sg binary for execution. Complex transformations may need precise pattern definitions, and all changes should be verified in preview mode before application.