Ast Grep
Ast Grep efficiently searches within AST (Abstract Syntax Tree) data for specific patterns or code elements, aiding in debugging and analysis.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add ast-grep npx -- -y @trustedskills/ast-grep
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"ast-grep": {
"command": "npx",
"args": [
"-y",
"@trustedskills/ast-grep"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
The ast-grep skill allows users to search and analyze code using abstract syntax trees (ASTs). It enables powerful, context-aware queries that can locate specific patterns or structures within source code files. This makes it particularly useful for tasks like finding all instances of a certain function call, identifying unused variables, or searching for specific syntactic constructs across large codebases.
When to use it
- You need to find all occurrences of a particular JavaScript function in a project.
- You want to identify and refactor outdated syntax patterns in a codebase.
- You're debugging an issue that spans multiple files and requires precise code pattern matching.
Key capabilities
- Search for code patterns using AST-based queries.
- Analyze and traverse source code structures efficiently.
- Support for multiple programming languages via compatible parsers.
Example prompts
- "Find all instances of
console.login the JavaScript files." - "Show me every use of the
mapfunction in this React component." - "List all unused variables in the Python script."
Tips & gotchas
- Ensure your code is properly parsed before querying; some languages may require additional configuration.
- AST-based queries can be complex—start with simple patterns and gradually build more advanced searches.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.