Token导航 LogoToken导航

Agent Skill · 研究检索

rg-code-search(rg 代码搜索)

rg-code-search 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

rg-code-search 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 42,822。

总安装 1,038周安装 42GitHub Stars 28下载 326核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:rg-code-search(rg 代码搜索)
来源仓库:https://github.com/laurigates/claude-plugins
仓库路径:skills/rg-code-search
安装命令:
npx skills add https://github.com/laurigates/claude-plugins --skill rg-code-search
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/laurigates/claude-plugins --skill rg-code-search

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

rg-code-search 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中快速定位候选结果。适用于基于关键词或任务场景的信息聚合场景。可通过 npx 命令从 claude-plugins 仓库安装,建议查看原始 README 了解具体用法。

使用前需确认权限范围和维护状态,警惕可能的联网或文件读写行为。输出内容应以原始 README 和项目事实为依据,不直接作为最终结论。

来源仓库内路径:skills/rg-code-search

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/laurigates/claude-plugins --skill rg-code-sear…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

rg-code-search 怎么安装?

在终端执行 npx skills add https://github.com/laurigates/claude-plugins --skill rg-code-search。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

rg-code-search 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

rg-code-search 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

rg-code-search 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

rg-code-search 用的人多吗?

公开数据是累计安装 1,038 次,近一周安装 42 次,下载 326 次,GitHub 28 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

rg-code-search 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
rg-code-search

rg 代码搜索 · 本页

1,03828需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

rg Code Search

Expert knowledge for using rg (ripgrep) as a blazingly fast code search tool with powerful filtering and pattern matching.

When to Use This Skill

Use this skill when...Use fd-file-finding instead when...
Searching file contents for text or regex patternsSearching for files by name, extension, or path
Filtering matches by file type (-t py, -t js)Filtering files by mtime, size, or -type
Multi-line pattern matching across source filesLocating files to feed into another tool
Use this skill when...Use binary-analysis instead when...
Searching source code or text-encoded filesExtracting strings from compiled binaries or firmware
Auditing repos for hardcoded patterns in tracked filesHunting for credentials inside ELF, Mach-O, or .bin blobs

Core Expertise

ripgrep Advantages

  • Extremely fast (written in Rust)
  • Respects .gitignore automatically
  • Smart case-insensitive search
  • Recursive by default
  • Colorized output
  • Multi-line search support
  • Replace functionality

Basic Usage

Simple Search

# Basic search
rg pattern                  # Search in current directory
rg "import numpy"           # Search for exact phrase
rg function_name            # Search for function name

# Case-sensitive search
rg -s Pattern               # Force case-sensitive
rg -i PATTERN               # Force case-insensitive

File Type Filtering

# Search specific file types
rg pattern -t py            # Python files only
rg pattern -t rs            # Rust files only
rg pattern -t js            # JavaScript files
rg pattern -t md            # Markdown files

# Multiple types
rg pattern -t py -t rs      # Python and Rust

# List available types
rg --type-list              # Show all known types

Extension Filtering

# Filter by extension
rg pattern -g '*.rs'        # Rust files
rg pattern -g '*.{js,ts}'   # JavaScript and TypeScript
rg pattern -g '!*.min.js'   # Exclude minified files

Advanced Patterns

Regular Expressions

# Word boundaries
rg '\bfunction\b'           # Match whole word "function"
rg '\btest_\w+'             # Words starting with test_

# Line anchors
rg '^import'                # Lines starting with import
rg 'return$'                # Lines ending with return
rg '^class \w+:'            # Python class definitions

# Character classes
rg 'TODO|FIXME|XXX'         # Find markers
rg '[Ee]rror'               # Error or error
rg '\d{3}-\d{4}'            # Phone numbers

Multi-line Search

# Multi-line patterns
rg -U 'fn.*\{.*\}'          # Function definitions (Rust)
rg -U 'struct.*{[^}]*}'     # Struct definitions

# Context lines
rg -A 5 pattern             # Show 5 lines after
rg -B 3 pattern             # Show 3 lines before
rg -C 2 pattern             # Show 2 lines before and after

Output Formatting

# Control output
rg -l pattern               # List files with matches only
rg -c pattern               # Count matches per file
rg --count-matches pattern  # Total match count

# Show context
rg -n pattern               # Show line numbers (default)
rg -N pattern               # Don't show line numbers
rg --heading pattern        # Group by file (default)
rg --no-heading pattern     # Don't group by file

# Customize output
rg --vimgrep pattern        # Vim-compatible format
rg --json pattern           # JSON output

Advanced Filtering

Path Filtering

# Search in specific directories
rg pattern src/             # Only src/ directory
rg pattern src/ tests/      # Multiple directories

# Exclude paths
rg pattern -g '!target/'    # Exclude target/
rg pattern -g '!{dist,build,node_modules}/'  # Exclude multiple

# Full path matching
rg pattern -g '**/test/**'  # Only test directories

Content Filtering

# Search only in files containing pattern
rg --files-with-matches "import.*React" | xargs rg "useState"

# Exclude files by content
rg pattern --type-not markdown

# Search only uncommitted files
rg pattern $(git diff --name-only)

Size and Hidden Files

# Include hidden files
rg pattern -u               # Include hidden
rg pattern -uu              # Include hidden + .gitignore'd
rg pattern -uuu             # Unrestricted: everything

# Exclude by size
rg pattern --max-filesize 1M  # Skip files over 1MB

Code Search Patterns

Finding Definitions

# Function definitions
rg '^def \w+\('             # Python functions
rg 'fn \w+\('               # Rust functions
rg '^function \w+\('        # JavaScript functions
rg '^\s*class \w+'          # Class definitions

# Interface/type definitions
rg '^interface \w+'         # TypeScript interfaces
rg '^type \w+ ='            # Type aliases
rg '^struct \w+'            # Struct definitions (Rust/Go)

Finding Usage

# Find function calls
rg 'functionName\('         # Direct calls
rg '\.methodName\('         # Method calls

# Find imports
rg '^import.*module_name'   # Python imports
rg '^use.*crate_name'       # Rust uses
rg "^import.*'package'"     # JavaScript imports

Code Quality Checks

# Find TODOs and FIXMEs
rg 'TODO|FIXME|XXX|HACK'    # Find all markers
rg -t py '#\s*TODO'         # Python TODOs
rg -t rs '//\s*TODO'        # Rust TODOs

# Find debug statements
rg 'console\.log'           # JavaScript
rg 'println!'               # Rust
rg 'print\('                # Python

# Find security issues
rg 'password.*=|api_key.*=' # Potential secrets
rg 'eval\('                 # Eval usage
rg 'exec\('                 # Exec usage

Testing Patterns

# Find tests
rg '^def test_' -t py       # Python tests
rg '#\[test\]' -t rs        # Rust tests
rg "describe\(|it\(" -t js  # JavaScript tests

# Find skipped tests
rg '@skip|@pytest.mark.skip' -t py
rg '#\[ignore\]' -t rs
rg 'test\.skip|it\.skip' -t js

File Operations

Search and Replace

# Preview replacements
rg pattern --replace replacement

# Perform replacement (requires external tool)
rg pattern -l | xargs sed -i 's/pattern/replacement/g'

# With confirmation (using fd and interactive)
fd -e rs | xargs rg pattern --files-with-matches | xargs -I {} sh -c 'vim -c "%s/pattern/replacement/gc" -c "wq" {}'

Integration with Other Tools

# Pipe to other commands
rg -l "TODO" | xargs wc -l          # Count lines with TODOs
rg "function" --files-with-matches | xargs nvim  # Open files in editor

# Combine with fd (prefer fd's native -x execution)
fd -e py -x rg "class.*Test" {}     # Find test classes
fd -e rs -x rg "unsafe" {}          # Find unsafe blocks

# Count occurrences
rg -c pattern | awk -F: '{sum+=$2} END {print sum}'

Stats and Analysis

# Count total matches
rg pattern --count-matches --no-filename | awk '{sum+=$1} END {print sum}'

# Find most common matches
rg pattern -o | sort | uniq -c | sort -rn

# Files with most matches
rg pattern -c | sort -t: -k2 -rn | head -10

Performance Optimization

Speed Tips

# Limit search
rg pattern --max-depth 3    # Limit directory depth
rg pattern -g '*.rs' -t rust  # Use type filters

# Parallel processing (default)
rg pattern -j 4             # Use 4 threads

# Memory management
rg pattern --mmap           # Use memory maps (faster)
rg pattern --no-mmap        # Don't use memory maps

Large Codebase Strategies

# Narrow scope first
rg pattern src/             # Specific directory
rg pattern -t py -g '!test*'  # Specific type, exclude tests

# Use file list caching
rg --files > /tmp/files.txt
rg pattern $(cat /tmp/files.txt)

# Exclude large directories
rg pattern -g '!{target,node_modules,dist,build}/'

Best Practices

When to Use rg

  • Searching code for patterns
  • Finding function/class definitions
  • Code analysis and auditing
  • Refactoring support
  • Security scanning

When to Use grep Instead

  • POSIX compatibility required
  • Simple one-off searches
  • Piped input (stdin)
  • System administration tasks

Tips for Effective Searches

  • Escape regex special characters in patterns
  • Use -u flags when searching ignored/hidden files
  • Exclude large binary/generated files with --glob '!vendor'
  • Prefer rg over grep for speed and smart defaults

Quick Reference

Essential Options

OptionPurposeExample
-t TYPEFile type filterrg -t py pattern
-g GLOBGlob patternrg -g '*.rs' pattern
-iCase-insensitiverg -i pattern
-sCase-sensitiverg -s Pattern
-wMatch whole wordsrg -w word
-lFiles with matchesrg -l pattern
-cCount per filerg -c pattern
-A NLines afterrg -A 5 pattern
-B NLines beforerg -B 3 pattern
-C NContext linesrg -C 2 pattern
-UMulti-linerg -U 'pattern.*'
-uInclude hiddenrg -u pattern
--replaceReplace textrg pattern --replace new

File Types (Common)

TypeExtensions
-t pyPython (.py,.pyi)
-t rsRust (.rs)
-t jsJavaScript (.js,.jsx)
-t tsTypeScript (.ts,.tsx)
-t goGo (.go)
-t mdMarkdown (.md,.markdown)
-t yamlYAML (.yaml,.yml)
-t jsonJSON (.json)

Common Command Patterns

# Find function definitions across codebase
rg '^\s*(def|fn|function)\s+\w+' -t py -t rs -t js

# Find all imports
rg '^(import|use|require)' -t py -t rs -t js

# Find potential bugs
rg 'TODO|FIXME|XXX|HACK|BUG'

# Find test files and count tests
rg -t py '^def test_' -c

# Find large functions (50+ lines)
rg -U 'def \w+.*\n(.*\n){50,}' -t py

# Security audit
rg 'password|api_key|secret|token' -i -g '!*.{lock,log}'

This makes rg the preferred tool for fast, powerful code search in development workflows.

平台分布

Codex

34.57%
按下载量换算113

Claude

31.28%
按下载量换算102

Cursor

18.08%
按下载量换算59

Gemini CLI

11.03%
按下载量换算36

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills