ast-grep

Community

Structural code search, refactor with precision.

Authordisusered
Version1.0.0
Installs0

System Documentation

What problem does it solve?

This Skill solves the problem of imprecise code searching and refactoring by understanding code structure rather than just text. It helps developers quickly find specific patterns, identify deprecated APIs, and enforce coding standards, saving time and reducing errors in large codebases.

Core Features & Use Cases

  • Syntax-Aware Search: Finds code patterns based on Abstract Syntax Trees (AST), avoiding false positives from comments or or strings.
  • Multi-Language Support: Works across JavaScript, TypeScript, Python, Go, Rust, Java, and more, making it versatile for polyglot environments.
  • Refactoring Aid: Ideal for identifying all instances of a deprecated function or a specific code structure before a large-scale refactor.
  • Use Case: You need to refactor all console.log() statements in your TypeScript project. Instead of a naive text search, use ast-grep --pattern 'console.log($MSG)' --lang ts to precisely locate only executable console.log calls, ignoring those in comments or strings.

Quick Start

Use ast-grep to find all useState calls in my TypeScript files. ast-grep --pattern 'useState($INIT)' --lang ts

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: ast-grep
Download link: https://github.com/disusered/dotfiles-universal/archive/main.zip#ast-grep

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.