ast-grep
Hacker ApprovedRanked 2 of 15 code search tools by recommenders
A syntax-aware command-line tool for searching and refactoring code without regex headaches, which people also expose to AI agents as a skill. Some report mixed results.
A syntax-aware command-line tool for searching and refactoring code without regex headaches, which people also expose to AI agents as a skill. Some report mixed results.
24 people gave an opinion
- recommend it
- 21
- criticize it
- 3
- approval share
- 88%
Recommended in 9 of 13 months
- November 2025: recommended
- December 2025: not recommended
- January 2026: recommended
- February 2026: recommended
- March 2026: recommended
- April 2026: recommended
- May 2026: recommended
- June 2026: not recommended
- July 2026: recommended
- August 2026: not recommended
- September 2026: recommended
- October 2026: recommended
- November 2026: not recommended (month in progress)
Why it carries the badge
- 21 people recommend itNeeds 10 or more, met.
- 7 recommenders for every criticNeeds 2 to 1 or better, met.
- Recommended in 9 of 13 monthsNeeds 4 or more, met.
The same three rules apply to every product, and the badge can’t be bought. How the badge works
What people say about it
The reasons people give, with the number of comments that give each one. Open a reason to read what they said.
Why people recommend it
Each mark is one comment
Efficient syntax-aware code refactoring
“an AST-aware CLI that can search and refactor code -- and you can expose it to your AI agent using a skill”
Comment from 28 Feb 2026 in “Everything Changes, and Nothing Changes” “CLI tools that effectively give me the things an IDE would offer such as astgrep for refactoring”
Comment from 13 May 2026 in “The vi family” “making these refactors with ast-grep is quite efficient”
Comment from 20 Jul 2026 in “Stop Using OpenCode” - Comment from 5 Apr 2026 in “Writing Lisp Is AI Resistant and I'm Sad”
- Comment from 21 Apr 2026 in “Less human AI agents, please”
Useful as an AI agent skill
“an AST-aware CLI that can search and refactor code -- and you can expose it to your AI agent using a skill”
Comment from 28 Feb 2026 in “Everything Changes, and Nothing Changes” “Using ast-grep as a skill in claude code makes it a lot easier to edit code as well.”
Comment from 12 Jan 2026 in “Ask HN: What Are You Working On? (January 2026)” “The only useful generic skill I have is the ast-grep one.”
Comment from 7 Sep 2026 in “Ask HN: How do you manage skills files?” - Comment from 27 Jul 2026 in “How AST-grep Rewrote Tree-sitter in Rust and Made It 30% Faster”
Builds linters and deterministic repo maps
“It is better to build the repomap deterministically using something like ast-grep”
Comment from 12 Feb 2026 in “Show HN: CodeRLM – Tree-sitter-backed code indexing for LLM agents” “write a poor man's linter using ast-grep”
Comment from 28 Jan 2026 in “Karpathy: A few random notes from Claude coding quite a bit last few weeks” “bridges the linter gaps nicely”
Comment from 20 Mar 2026 in “Be intentional about how AI changes your codebase”
Other code search tools people recommend
The four most recommended other code search tools, with the same counts for each, so you can compare like for like. The tick on each bar marks the 2 to 1 line the badge needs.
| Product | Recommend | Criticize | Approval | Months | Owned | Badge |
|---|---|---|---|---|---|---|
| ripgrep | 122 | 18 | 87% | 12 | — | Approved |
| ast-grepThis page | 21 | 3 | 88% | 9 | — | Approved |
| Semble | 20 | 7 | 74% | 4 | — | Approved |
| Graft (Claude Code hooks) | 13 | 4 | 76% | 4 | — | Approved |
| Lat.md | 11 | 3 | 79% | 3 | — | — |
What people said
25 of the 29 comments that mention it, newest first. Each links to the original comment.
“some general ast-grep rules have pretty much been an absolute necessity”
“ast-grep is a fantastic tool.”
“The only useful generic skill I have is the ast-grep one.”
“would be a huge intelligence and performance boost”
“I like ast-grep and I think the changes are interesting”
“Really helps with agentic work.”
“all the performance gains came from optimising for fixed files with no error recovery”
“making these refactors with ast-grep is quite efficient”
“They already know how to use it.”
“saves me from having to memorize that syntax myself”
“CLI tools that effectively give me the things an IDE would offer such as astgrep for refactoring”
“perform such mechanical code changes”
“The proper tool for this is ast-grep (sg)”
“leverages ast-grep for ast-safe replacement”
“llms really mess up on them”
“bridges the linter gaps nicely”
“It's syntax-aware so you don't need care about whitespace, indentation etc. Very easy to dip your toes in where a regex would get complex fast”
“The tool itself is solid!”
“an AST-aware CLI that can search and refactor code -- and you can expose it to your AI agent using a skill”
“allows this for far more languages, since it is based on the tree-sitter parser library”
“It is better to build the repomap deterministically using something like ast-grep”
“write a poor man's linter using ast-grep”
“I don't see ast-grep as being very useful to an agent.”
“Using ast-grep as a skill in claude code makes it a lot easier to edit code as well.”
“my experience the results are mixed”
Counts come from 1,795,640 Hacker News comments, November 2025 to November 2026. How we count. Report a mistake.