Openclaw-skills code-search

Fast codebase search combining glob file matching and ripgrep content search. Find files by pattern, search code by regex, explore project structure. Use when needing to find files, search for patterns in code, understand codebase structure, or explore unfamiliar projects. Triggers on "find files", "search code", "grep for", "where is", "find all uses of", "explore this codebase", "project structure".

install
source · Clone the upstream repo
git clone https://github.com/EasyJoy-Technologies/openclaw-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/EasyJoy-Technologies/openclaw-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/code-search" ~/.claude/skills/easyjoy-technologies-openclaw-skills-code-search && rm -rf "$T"
OpenClaw · Install into ~/.openclaw/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/EasyJoy-Technologies/openclaw-skills "$T" && mkdir -p ~/.openclaw/skills && cp -r "$T/skills/code-search" ~/.openclaw/skills/easyjoy-technologies-openclaw-skills-code-search && rm -rf "$T"
manifest: skills/code-search/SKILL.md
source content

Code Search — Fast Codebase Exploration

Efficient file and content search. Always prefer

rg
over raw
grep
.

File Search

find <dir> -type f -name "*.ts" | head -50           # by extension
find <dir> -type f -name "*.ts" -mtime -7 | head -30  # recently modified
find <dir> -path "*/services/*.ts" -type f             # by path pattern

Content Search (ripgrep)

rg -l "pattern" <dir>                                  # file list only
rg -n -C 2 "pattern" <dir>                             # with context
rg -n "pattern" --type ts <dir>                        # filter by type
rg -n "TODO" -g "*.ts" -g "!node_modules" <dir>       # glob filter
rg -c "pattern" <dir>                                  # count per file
rg -n -U "interface\s*\{[^}]*\}" <dir> --type ts      # multiline

Project Structure Discovery

  1. find <dir> -maxdepth 2 -type d | sort | head -50
  2. find <dir> -maxdepth 2 \( -name "package.json" -o -name "tsconfig.json" -o -name "Makefile" -o -name "*.toml" \) | sort
  3. rg -l "main\(|export default|app\." <dir> --type ts --type js | head -20
  4. find <dir> -type f | sed 's/.*\.//' | sort | uniq -c | sort -rn | head -15

Common Patterns

TaskCommand
Where is X defined?
rg -n "(?:function|class|const|type|interface)\s+X" <dir> --type ts
What calls X?
rg -n "X\(" <dir> --type ts -g "!*.test.*"
What changed recently?
git log --oneline -20
/
git diff --stat HEAD~5
API surface
rg -n "export\s+(function|class|const|type)" <dir>/src --type ts | head -40

Tips

  • Exclude
    node_modules
    ,
    .git
    ,
    dist
    ,
    build
    : use
    -g "!node_modules"
  • Pipe through
    head -N
    to avoid flooding context
  • Use
    rg -F "literal"
    for exact strings with special chars
  • Use
    rg -l
    first (files only), then
    rg -n -C 2
    for detail
  • Fallback:
    grep -rn --include="*.ts"
    if
    rg
    unavailable