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.
Install
npx skills add https://github.com/agentskillexchange/skills/tree/main/skills/ast-grep-structural-code-search-rewrite
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install agentskillexchange-skills@llmmart
git clone https://github.com/agentskillexchange/skills.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole agentskillexchange/skills collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
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, 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, pip, cargo, [cargo-binstall](...
Basic usage or getting-started notes:
bash
pnpm approve-builds may be needed
Extracted from upstream docs: https://raw.githubusercontent.com/ast-grep/ast-grep/HEAD/README.md
Source
Files (skills)
-
SKILL.md 1.8 KB
--- 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/)
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.