Skip to content
Back to skills

Ast Grep Structural Code Search Rewrite

BSecurity

Use ast-grep (sg) to search, lint, and rewrite code across large codebases using AST pattern matching. A blazing-fast alternative to regex-based code transformations that understands syntax structure.

  • 36 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added June 8, 2026
ai-agentsrustgobashnodeexpressgitsecurity

Works with

  • claude code
  • cli

Security analysis

B84/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned June 8, 2026

npx -y skills add agentskillexchange/skills --skill ast-grep-structural-code-search-rewrite --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Ast Grep Structural Code Search Rewrite?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Ast Grep Structural Code Search Rewrite
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/agentskillexchange-ast-grep-structural-code-search-rewrite/badge)](https://www.skillsdirectory.com/skills/agentskillexchange-ast-grep-structural-code-search-rewrite)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: "ast-grep Structural Code Search and Rewrite"
slug: "ast-grep-structural-code-search-rewrite"
description: "Use ast-grep (sg) to search, lint, and rewrite code across large codebases using AST pattern matching. A blazing-fast alternative to regex-based code transformations that understands syntax structure."
github_stars: 13245
verification: "security_reviewed"
source: "https://github.com/ast-grep/ast-grep"
category: "Code Quality & Review"
framework: "Claude Code"
tool_ecosystem:
  github_repo: "ast-grep/ast-grep"
  github_stars: 13245
---

# ast-grep Structural Code Search and Rewrite

Use ast-grep (sg) to search, lint, and rewrite code across large codebases using AST pattern matching. A blazing-fast alternative to regex-based code transformations that understands syntax structure.

## Installation

Use the upstream install or setup path that matches your environment:
- npm install --global @ast-grep/cli
- pip install ast-grep-cli
- brew install ast-grep
- cargo install ast-grep --locked

Requirements and caveats from upstream:
- You can use $ sign + upper case letters as a [wildcard](https://en.wikipedia.org/wiki/Wildcard_character), e.g. $MATCH, to match any single AST node. Think of it as [regular expression dot](https://regexone.com/lesson...
- You can install it from [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), [pip](https://pypi.org/), [cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html), [cargo-binstall](...

Basic usage or getting-started notes:
- bash
- # pnpm approve-builds may be needed
- <details>

- Source: https://github.com/ast-grep/ast-grep
- Extracted from upstream docs: https://raw.githubusercontent.com/ast-grep/ast-grep/HEAD/README.md

## Source

- [Agent Skill Exchange](https://agentskillexchange.com/skills/ast-grep-structural-code-search-rewrite/)

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.