Tool Ast Grep Rules
This skill uses AST and grep rules to efficiently search and extract specific code elements from large files, streamlining development tasks.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add tool-ast-grep-rules npx -- -y @trustedskills/tool-ast-grep-rules
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"tool-ast-grep-rules": {
"command": "npx",
"args": [
"-y",
"@trustedskills/tool-ast-grep-rules"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
What it does
This skill enables AI agents to install and utilize ast-grep rules, which are pattern-matching configurations designed to analyze code structure rather than just text. By applying these rules, agents can automatically detect specific coding patterns, enforce style guidelines, and identify potential issues across large codebases efficiently.
When to use it
- Enforcing consistent coding standards and style guides across a monorepo or multi-language project.
- Automatically refactoring legacy code by identifying deprecated patterns or anti-patterns defined in rules.
- Integrating into CI/CD pipelines to block merges that violate specific structural constraints.
- Auditing third-party dependencies for known vulnerability signatures or insecure coding practices.
Key capabilities
- Parses and analyzes source code based on Abstract Syntax Tree (AST) structures.
- Supports multiple programming languages with dedicated parsers.
- Allows custom rule definitions for complex logic checks beyond simple regex.
- Provides actionable feedback with file locations and specific line numbers.
Example prompts
- "Install the
tool-ast-grep-rulesskill and scan our React frontend repository for unused prop patterns." - "Create a new ast-grep rule to detect any function calls missing error handling in our Python backend services."
- "Run an audit using installed rules to find instances of hardcoded secrets in configuration files across the entire project."
Tips & gotchas
Ensure your codebase has compatible parsers for the languages you intend to analyze, as unsupported syntax may lead to incomplete results. For best performance on large repositories, consider running scans incrementally or filtering by specific file extensions before applying heavy rulesets.
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.