ast-grep
Writing AST-based patterns to transform TypeScript code, Converting guard clauses to optional chaining, Converting self-assignment to nullish coalescing assignment
Its pattern language reads almost like the code itself, making it easier to reason about transformations.
Related Tools
FIRST-HAND READS
What people reported, in their own words. Every line links to where it was said.
“Using ast-grep as a skill in claude code makes it a lot easier to edit code as well”
POSITIVE · ease of use · Hacker News · 2026-01-12
“I did experiment with giving tree sitter and ast-grep to agents and my experience the results are mixed”
MIXED · performance · Hacker News · 2025-11-22
“I've also poked around with a custom MCP server that attempts to teach the LLM how to use ast-grep, but that didn't really work as hoped. It helps sometimes”
NEGATIVE · performance · Hacker News · 2025-08-06
“Used CST (<3 ast-grep) instead of AST - really useful here IMO esp. for any heuristic-based checks.”
POSITIVE · features · Hacker News · 2025-06-03
“I have used `ast-grep` to devise my own linters with crushing success.”
POSITIVE · features · Hacker News · 2024-09-05
“Used ast-grep successfully to locate bad code blocks (dynamic typing, don't even get me started) and also to replace them with others. Highly recommended.”
POSITIVE · features · Hacker News · 2024-09-02
Have You Used This Tool?
Sign in to share your experience with this tool.
Sign in