ast-grepstructuralcodesearchandrewrite
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "ast-grepstructuralcodesearchandrewrite" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-bcd8095aac0a1f50680c675b5aaab9899671a84df3b3eb3d0b2c0954e0dcc78f. Verify the upstream source and version against https://skillhub.cn/skills/user_3c6cb52e/ast-grep-structural-code-search-rewrite before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Use ast-grep (sg) to search, inspect, and rewrite code in large repositories via AST pattern matching. A faster alternative to regex-based transformations that understands syntax structure.
Introduction source: third_party · user_3c6cb52e · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: "ast-grep Structural Code Search and Rewrite"
slug: "ast-grep-structural-code-search-rewrite"
version: "1.0.0"
displayName: "ast-grep Structural Code Search and Rewrite"
summary: "使用 ast-grep (sg) 通过 AST 模式匹配在大型代码库中搜索、检查和重写代码。一种比基于正则表达式的代码转换更快的替代方案,它理解语法结构。"
license: "MIT"
description: "使用 ast-grep (sg) 通过 AST 模式匹配在大型代码库中搜索、检查和重写代码。一种比基于正则表达式的代码转换更快的替代方案,它理解语法结构。"
github_stars: 13245
verification: "security_reviewed"
source: "https://github.com/1991513ccie-png/skills"
category: "Code Quality & Review"
framework: "Claude Code"
tool_ecosystem:
github_repo: "1991513ccie-png/skills"
github_stars: 13245ast-grep 结构化代码搜索与重写
使用 ast-grep (sg) 通过 AST 模式匹配在大型代码库中搜索、检查和重写代码。一种比基于正则表达式的代码转换更快的替代方案,它理解语法结构。
安装
使用与您的环境匹配的上游安装或设置路径:
- npm install --global @ast-grep/cli
- pip install ast-grep-cli
- brew install ast-grep
- cargo install ast-grep --locked
来自上游的要求和注意事项:
- 您可以使用 $ 符号 + 大写字母作为 通配符,例如 $MATCH,来匹配任何单个 AST 节点。可以将其视为 [正则表达式点](https://regexone.com/lesson...
- 您可以从 npm、pip、cargo、[cargo-binstall](...
基本用法或入门笔记:
-
bash
-
可能需要 pnpm approve-builds
-
<details>
-
Extracted from upstream docs: https://raw.githubusercontent.com/ast-grep/ast-grep/HEAD/README.md
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 提供 ast-grep 工具的结构化代码搜索与重写能力,解决开发者代码重构和质量优化需求
- 支持多种编程语言和安装方式,具有明确的实用场景和受众群体
Areas to improve
-
触发词描述不够具体 Reported severity: Minor
description 描述了核心功能但未提供具体触发词示例或使用边界说明
Recommendation: 建议补充具体触发词示例,如'ast-grep search'、'代码重构'等,帮助用户准确触发
Highlights
- description 清晰说明了 AST 模式匹配的核心优势和与正则表达式的区别
Areas to improve
-
文档内容较为简略 Reported severity: Minor
主体内容相对简略,缺少详细的操作指南和最佳实践
Recommendation: 建议扩展文档内容,添加更多实际使用场景和注意事项
Highlights
- frontmatter 信息完整,包含版本、许可证、GitHub 信息等必要元数据
Areas to improve
-
缺少异常处理和错误恢复机制 Reported severity: Minor
提供了多种安装方式但未覆盖常见异常情况和错误处理建议
Recommendation: 建议添加安装失败、环境不兼容等常见问题的解决方案
Highlights
- 提供了完整的安装方式覆盖(npm/pip/brew/cargo),工具来源明确可靠
- 引用了官方文档和 GitHub 仓库,确保信息的准确性和时效性
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 26, 27, 28
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- doc.rust-lang.org
- docs.npmjs.com
- en.wikipedia.org
- github.com
- pypi.org
- raw.githubusercontent.com
- regexone.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.