ex-ast-refactor
БесплатноБез исполняемых скриптовНе проверенSearch, analyze, and refactor Elixir code with `ex_ast` AST patterns in projects that already depend on `ex_ast`. Use only when syntax-aware matching…
от dkarter★ 130 звёзд на GitHubОб этом скилле
ExAST Refactor
Overview
Use ex_ast for Elixir refactors and investigations where AST structure matters: call shape, function context, matched captures, equivalent piped/direct calls, or safe batch replacements. Keep normal Glob/Grep/apply_patch as the default for simple text edits.
Activation Gate
- Confirm the project already has
ex_astbefore using it. Checkmix.exs,mix.lock, or available mix tasks. Do not addex_astjust to use this skill unless the user explicitly asks. - Use this skill only when AST semantics reduce risk or effort. Prefer plain Grep and patches for exact strings, one-off edits, documentation, config text, or non-Elixir files.
- Prefer the CLI for quick searches and mechanical dry-run replacements. Prefer
mix run -eor a scratch Elixir script when queries needExAST.Query, capture guards, custom output, or multi-pattern analysis. - Always preview broad or write operations before modifying files.
Core Workflow
- Define the code shape in normal Elixir syntax. Use wildcards, captures, ellipsis, or relationship filters only when needed.
- Run a limited search first, for example
mix ex_ast.search --limit 20 'IO.inspect(...)' lib/. - Inspect representative matches and refine the pattern. Use
--inside,--not-inside,--contains, or a query when context matters. - For replacements, run
mix ex_ast.replace --dry-run 'PATTERN' 'REPLACEMENT' PATHfirst. - Apply the replacement only after the dry run matches the intended scope.
- Run
mix formator the repository formatting task after replacements because generated formatting may differ. - Verify with targeted tests, compile, or the repository's check task.
Common Commands
mix ex_ast.search 'PATTERN' PATH
mix ex_ast.search --limit 20 --inside 'defp _ do ... end' 'Repo.get!(_, _)' lib/
mix ex_ast.replace --dry-run 'PATTERN' 'REPLACEMENT' PATH
mix ex_ast.replace 'dbg(expr)' 'expr' lib/
mix ex_ast.diff lib/old.ex lib/new.ex --summary
Reference Files
- Read Pattern Language when designing or debugging
ex_astpatterns. - Read Querying, CLI, and API when context filters, capture guards, programmatic searches, or command options are needed.
- Read Safe Refactoring Workflow before making project-wide replacements or when deciding whether
ex_astis justified.
Guardrails
- Avoid broad patterns like
_unless using--limitor--allow-broadintentionally. - Treat generated replacements as code changes, not text substitutions. Review the diff before finalizing.
- Do not rely on semantic alias expansion or macro expansion.
ex_astis syntax-aware, not a compiler. - Captured remote or field access can render differently in replacements, such as
record.field()instead ofrecord.field. Review and clean up generated code. - Replacement formatting may use
Macro.to_string/1; run the project formatter afterward. - Use apply_patch for manual cleanup around generated changes when the AST replacement is too broad or awkward.
Установить ex-ast-refactor в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл ex-ast-refactor?
Search, analyze, and refactor Elixir code with `ex_ast` AST patterns in projects that already depend on `ex_ast`. Use only when syntax-aware matching, captures, pipe normalization, ancestor/child/sibling filters, multi-pattern scans, or dry-run AST replacements provide a clear benefit over regular grep/search and manual patches. Do not use for simple literal text searches or in projects that do not already contain `ex_ast`.
Как установить скилл ex-ast-refactor?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ex-ast-refactor запускает скрипты?
Нет, скилл состоит только из инструкций (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