ast-grep
БесплатноБез исполняемых скриптовНе проверенStructural code search and refactoring via ast-grep. Reach for this when Edit fails with "old_string not unique", when refactoring across formatting…
Об этом скилле
ast-grep
Default invocation:
ast-grep -l LANG -p 'PATTERN' # search
ast-grep -l LANG -p 'OLD' -r 'NEW' # preview rewrite
ast-grep -l LANG -p 'OLD' -r 'NEW' --update-all # apply
-l is required -- auto-detect is unreliable. Interactive mode (-i) does not work from this harness.
Metavariables
$VAR-- one AST node (an expression, an identifier, ...)$$$ARGS-- zero or more items in a list (function args, statement bodies)$$STMT-- multiple statements
Canonical patterns
# Rename a function across all call sites
ast-grep -l typescript -p 'oldFn($$$ARGS)' -r 'newFn($$$ARGS)'
# Rename a method on any receiver
ast-grep -l javascript -p '$OBJ.oldMethod($$$ARGS)' -r '$OBJ.newMethod($$$ARGS)'
# Rewrite imports
ast-grep -l typescript -p 'import $WHAT from "old-pkg"' -r 'import $WHAT from "new-pkg"'
Workflow: run without -r to see matches, run with -r to preview the diff, then add --update-all. For surgical per-site control, use ast-grep to find locations and Edit to apply.
To list a file's or package's structure (functions, types, imports/exports) rather than match a pattern, use the outline subcommand -- see the code-structure skill.
Установить ast-grep в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл ast-grep?
Structural code search and refactoring via ast-grep. Reach for this when Edit fails with "old_string not unique", when refactoring across formatting variations, or when matching code shape rather than text.
Как установить скилл ast-grep?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ast-grep запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic