ast-grep-find

仓库创建 2025年12月23日最近提交 6 个月前SkillHot 收录 20 天前
▸ 精选理由

在大代码库中快速定位语法模式并安全重命名或批量重构,效率高。

这个 Skill 做什么

用 ast-grep 做结构化代码搜索与精准重构(基于语法而非文本)。

用语法树(AST)做结构化代码搜索和精准重构,能按函数调用、导入、类定义等语法模式匹配,而不是简单文本查找。适合跨仓库批量重命名、定位某类调用、做安全或合规扫描时使用。特别之处是忽略注释/字符串干扰,修改更安全、定位更准确,适合大规模代码改造。

▸ 展开 SKILL.md 英文原文

AST-based code search and refactoring via ast-grep MCP

开发编程AST代码搜索重构通用
3.9k
Stars
298
Forks
40
仓库内 Skill
+17
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/parcadei/Continuous-Claude-v3/main/.claude/skills/ast-grep-find/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/parcadei/Continuous-Claude-v3/main/.claude/skills/ast-grep-find/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# AST-Grep Find

Structural code search that understands syntax. Find patterns like function calls, imports, class definitions - not just text.

## When to Use

- Find code patterns (ignores strings/comments)
- Search for function calls, class definitions, imports
- Refactor code with AST precision
- Rename variables/functions across codebase

## Usage

### Search for a pattern
```bash
uv run python -m runtime.harness scripts/ast_grep_find.py \
    --pattern "import asyncio" --language python
```

### Search in specific directory
```bash
uv run python -m runtime.harness scripts/ast_grep_find.py \
    --pattern "async def \$FUNC(\$\$\$)" --language python --path "./src"
```

### Refactor/repl
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有