file-search

Locate text and structural code patterns across large codebases using ripgrep and ast-grep.

1.1k|171|Updated Jul 18, 2025
One-click install
npx skills add https://github.com/massgen/MassGen --skill file-search-massgen
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: file-search
Source: https://github.com/massgen/MassGen/tree/main/massgen/skills/file-search
Command: npx skills add https://github.com/massgen/MassGen --skill file-search-massgen

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps agents quickly locate text patterns and structural code patterns across large codebases using ripgrep and ast-grep, enabling rapid understanding of unfamiliar projects.

Core Features & Use Cases

  • Text search with ripgrep to match strings, patterns, and code across files
  • Structural search with ast-grep to find language-aware patterns in abstract syntax trees
  • Use case: quickly identify function usages, API calls, security-relevant code, and code duplication across repositories

Quick Start

Use the file-search skill to locate all references to a function named "processData" across a codebase, optionally filtering by language and directory.

Frequently Asked Questions about file-search

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I search for code patterns across a large codebase?

Locate code patterns across large codebases using ripgrep for text matching and ast-grep for structural syntax tree matching. This combination quickly identifies function usages, API calls, and code duplication across repositories.

What is syntax-aware code search and when do I need it?

Syntax-aware code search uses ast-grep to analyze abstract syntax trees instead of plain text, matching structural code patterns. You need it to find language-aware patterns like function definitions or specific API calls while ignoring strings or comments.

Can I use ripgrep to find all references to a function in a specific directory?

Yes, you can use ripgrep to find all references to a function, optionally filtering by language and directory. It matches strings and text patterns across files in large codebases to help you rapidly understand unfamiliar projects.

What is the best way to find security-relevant code in a repository?

The best way to find security-relevant code is using structural search with ast-grep to identify language-aware patterns in the abstract syntax tree, or text search with ripgrep to match specific patterns across files in the codebase.

Does structural code search work with any programming language?

Structural code search with ast-grep works with languages supported by its abstract syntax tree parsing capabilities. It enables language-aware pattern matching to find structural code elements rather than relying on basic string matching.

Why use ast-grep instead of plain text search for code analysis?

Use ast-grep instead of plain text search because ast-grep performs structural syntax tree matching, allowing you to find language-aware code patterns without false positives from matching variable names inside comments or strings.