本文へスキップ
Skillpedia
一般的なプログラミング6.2k · #14387

code-search

できること

ripgrepとGitを使って、ファイル全体を読むのではなく、コードを素早く検索するのを支援します。関数がどこで定義され、どこで使われているかを見つけたい開発者向けです。

使う場面

  • ✓関数、クラス、シンボルがどこで定義されているかを見つけたいとき。
  • ✓プロジェクトで名前が使われているすべての箇所を知りたいとき。
  • ✓コードの行がいつ、なぜ変わったかを調べたいとき。

スキルのリンク

https://github.com/agentscope-ai/agentscope-java/blob/main/agentscope-examples/agents/agentscope-codingagent/src/main/resources/workspace-templates/skills/code-search/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/agentscope-ai/agentscope-java/blob/main/agentscope-examples/agents/agentscope-codingagent/src/main/resources/workspace-templates/skills/code-search/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“このプロジェクトで関数calculateTaxが定義されている、または呼び出されているすべての箇所を見つけてください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

スキルは、ファイルの種類で絞り込んだ正規表現の検索にripgrepを使います。Gitの履歴のコマンドを使うと、ある文字列がいつ追加されたか、誰が行を変えたかを追跡できます。結果を絞り、出力を短く保ちます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Code Search

The built-in grep tool matches LITERAL text only. For real regular-expression search and history-aware lookups, drive ripgrep and git through execute.

Ripgrep (regex)

  • Symbol definition: rg -n "fn\s+\w+\(" src/, rg -n --type java "class \w+Service".
  • Usages of a name: rg -n "\bmyFunction\b".
  • Limit by file type: rg -n --type ts "useEffect\(".
  • List files only: rg -l "TODO"; find files by name: rg --files | rg <name> or use glob.

Git history search

  • When a string was introduced/removed: git log -S "<string>" --oneline.
  • Who/why a line changed: git blame -L <start>,<end> <file>.
  • Search tracked files: git grep -n "<regex>".

Tips

  • Prefer a targeted regex over reading whole files when locating symbols or call sites.
  • Escape regex metacharacters when you want a literal match, or pass -F to ripgrep.
  • Narrow scope with a path argument to keep output small (tool output is truncated).
よくある質問

ripgrepが必要ですか?

はい。正規表現の検索にripgrepを使います。

Gitの履歴も検索できますか?

はい。文字列がいつ追加または削除されたか、誰が行を変えたかを見つけられます。

ファイル全体を読まないのはなぜですか?

的を絞った検索により、結果が短くなり、扱いやすくなります。

詳細

作者による元の説明

Search a codebase efficiently with ripgrep regular expressions, file globs, and git history search. Use to locate symbols, usages, and definitions instead of reading whole files.

repo: agentscope-ai/agentscope-java

人気

GitHubのスター
6.2k
ランキング
#14387
ライセンス
Apache-2.0
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル