# Ast Grep

> Codex built-in skill for structural code search with ast-grep when queries depend on AST shapes, call patterns, decorators, scopes, or required child nodes.

- Skill: `rycen7822/ast-grep` (Agent Skill)
- Install (CLI): `npx skillmds@latest add rycen7822/ast-grep`
- Raw SKILL.md: https://api.skillmd.com/api/skills/rycen7822/ast-grep/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: Rycen7822 (https://skillmd.com/u/rycen7822)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/rycen7822/ast-grep

---

# ast-grep
## When to Use
Use when the task needs AST-aware structural search instead of plain text grep, such as finding function definitions, call shapes, imports, decorators, or missing child nodes.
## Do Not Use When
Do not use for ordinary keyword, filename, documentation, or broad repository text search.
## Required Inputs
Target language, structural pattern, repository path, and a small validation snippet when possible.
## Workflow
1. Narrow the candidate files if the repository is large.
2. Write an ast-grep pattern or rule.
3. Run ast-grep on a small target.
4. Expand only after validating the match shape.

