Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计通过

ast-grep搜索结果 grep

Agent Skill

ast-grep 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

1,164

周安装

50

GitHub Stars

公开资料未说明

下载量

408
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:ast-grep(搜索结果 grep)
来源仓库:https://github.com/ulpi-io/skills
仓库路径:skills/ast-grep
安装命令:
npx skills add https://github.com/ulpi-io/skills --skill ast-grep
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/ulpi-io/skills --skill ast-grep

简介

用于查找和筛选相关信息,适合基于关键词或任务场景定位内容。

  • 可在 Codex、Claude 等环境中使用,支持快速检索。
  • 安装命令:npx skills add https://github.com/ulpi-io/skills --skill ast-grep。
  • 建议确认权限和维护状态,避免触发敏感操作。
  • 注意是否涉及外部系统调用或文件读写。

SKILL.md

Non-negotiable rules:

  1. Verify ast-grep is installed before relying on it.
  2. Create a minimal example of the desired pattern before searching the repository.
  3. Inspect the AST with --debug-query when node kinds or match shape are uncertain.
  4. Add stopBy: end to relational rules unless there is a specific reason not to.
  5. Test the rule on the example before running it across the codebase.

ast-grep Code Search

Inputs

  • $request: The structural pattern to find, plus any known language, exclusions, or edge cases

Goal

Produce a reliable structural search by:

  • confirming ast-grep is available
  • clarifying the intended pattern and language
  • building the smallest rule that can work
  • testing it on example code first
  • validating repository results before reporting them

Step 0: Verify availability and resolve the query

First verify ast-grep is installed with ast-grep --version.

If it is not installed:

  • stop
  • tell the user ast-grep is required for this workflow
  • provide installation guidance instead of pretending the search can proceed

Then resolve:

  • the programming language
  • what should match
  • what should not match
  • any edge cases the user cares about

Use AskUserQuestion only if those details are ambiguous enough to risk a bad rule.

Success criteria: ast-grep availability, language, and pattern intent are explicit.

Step 1: Create a minimal example and inspect the AST

Write a tiny example snippet that should match.

Use --debug-query=cst or --debug-query=pattern when needed to understand:

  • the real node kinds
  • how metavariables are parsed
  • where the target structure sits in the tree

Rules:

  • keep the example as small as possible
  • debug the AST when kind names or nesting are uncertain
  • do not skip this step just because the pattern "looks obvious"

Load references/rule_reference.md for syntax details and references/search-recipes.md for common command shapes.

Success criteria: The target shape is represented by a tested example and the AST structure is understood well enough to write the rule.

Step 2: Write the smallest rule that can work

Start from the simplest viable rule:

  • pattern first for direct structural matches
  • kind plus relational rules for more complex structures
  • all, any, or not only when needed

Rules:

  • add stopBy: end to inside and has unless a tighter stop condition is intentional
  • keep the rule minimal until it proves insufficient
  • escape metavariables correctly when using inline shell commands

Load references/rule_reference.md for rule semantics.

Success criteria: The rule is syntactically valid and appropriately simple for the problem.

Step 3: Test the rule on the example

Test the rule against the example snippet using --stdin or a temporary file.

Check:

  • it matches the intended example
  • it does not obviously overmatch
  • relational rules traverse the intended scope

If the rule fails:

  • simplify it
  • re-check the AST
  • adjust kind names or rule shape
  • retest before touching the repository

Success criteria: The rule matches the known example correctly.

Step 4: Search the codebase and validate results

Once the rule works on the example, run it against the repository.

Then validate:

  • total match count
  • representative file paths and lines
  • 3 to 5 spot-checks to confirm the intent
  • edge cases the user explicitly mentioned

Rules:

  • if Grep would have been enough after all, say so, but complete the current ast-grep search if already in motion
  • if the rule becomes too complex or brittle, narrow the query rather than returning unverified noise

Load references/search-recipes.md for common search and debug flows.

Success criteria: The repository results are credible, reproducible, and not obviously noisy.

Step 5: Report the results and reusable rule

Report:

  • pattern description
  • language
  • rule type used
  • match count
  • representative file:line matches
  • the final reusable rule or command shape

If no matches were found, say so explicitly and explain whether that likely means:

  • the pattern does not exist
  • the rule was intentionally narrow
  • more clarification is needed

Success criteria: The user can rerun the search or refine it from your output.

Guardrails

  • Do not add disable-model-invocation; this is a non-destructive search skill.
  • Do not add context: fork; the user usually wants the result in the current flow.
  • Do not add paths:; this is a generic search workflow.
  • Do not search the repository with an untested rule when the query is non-trivial.
  • Do not keep giant CLI manuals, recipe catalogs, or failure encyclopedias inline in SKILL.md.
  • Do not use ast-grep when plain Grep is clearly sufficient.

When To Load References

  • references/rule_reference.md Use for ast-grep rule syntax, relational rules, composite rules, and metavariable semantics.
  • references/search-recipes.md Use for installation guidance, command patterns, common use cases, and debugging flows.

Output Contract

Report:

  1. the structural pattern searched for
  2. the language and rule type used
  3. the match count and representative file:line results
  4. the final rule or reusable command shape
  5. any important caveats or follow-up refinements

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.42%
按下载量换算157

Claude

28.57%
按下载量换算117

Cursor

19.21%
按下载量换算78

Gemini CLI

9.46%
按下载量换算39

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/ulpi-io/skills --skill ast-grep 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills