スキル一覧に戻る
convective

ast-grep

by convective

Demo Agentic AI app

0🍴 0📅 2025年12月19日
GitHubで見るManusで実行

SKILL.md


name: ast-grep description: Search code using Abstract Syntax Tree patterns with ast-grep. Use when finding code structures, bug patterns, or refactoring candidates that depend on syntax rather than text. allowed-tools: Bash, Read, Glob

ast-grep - Structural Code Search

ast-grep searches code by matching AST patterns, not text. This finds code based on structure regardless of formatting or variable names.

Basic Usage

ast-grep run -p 'PATTERN' -l LANGUAGE

Pattern Syntax

  • $VAR - Match any single node (like a wildcard)
  • $$$ - Match zero or more nodes
  • Literal code matches itself

Common Patterns

GoalPatternLanguage
Find subtraction with specific left operanddiscount - $VARtypescript
Find all useEffect with empty depsuseEffect($FN, [])tsx
Find console.log callsconsole.log($$$)typescript
Find async functionsasync function $NAME($$$) { $$$ }typescript

Example: Finding Reversed Operands

To find where discount appears on the left side of subtraction:

ast-grep run -p 'discount - $VAR' -l typescript

This would find bugs like discount - basePrice (should be basePrice - discount).

When to Use

  • Finding bug patterns based on code structure
  • Locating specific API usage patterns
  • Identifying refactoring candidates
  • Searching for security anti-patterns

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です