AgentSkillsCN

git-ai-code-search

借助git-ai MCP工具,实现语义化代码搜索与代码库深度理解。适用场景包括:(1) 搜索符号、函数或语义概念;(2) 理解项目架构;(3) 分析调用图与代码依赖关系。触发关键词:“查找X”、“搜索X”、“谁调用了X”、“X在哪里”、“理解这段代码库”。

SKILL.md
--- frontmatter
name: git-ai-code-search
description: |
  Semantic code search and codebase understanding using git-ai MCP tools. Use when: (1) Searching for symbols, functions, or semantic concepts, (2) Understanding project architecture, (3) Analyzing call graphs and code relationships. Triggers: "find X", "search for X", "who calls X", "where is X", "understand this codebase".

git-ai Code Search

Semantic code search with AST analysis and change tracking.

Quick Start

For Agents - 3-step pattern:

code
1. check_index({ path }) → verify index exists
2. semantic_search({ path, query }) → find relevant code  
3. read_file({ path, file }) → read the actual code

For Users - build index first:

bash
cd your-repo
git-ai ai index        # build index
git-ai ai semantic "authentication logic"  # search

Core Tools

NeedToolExample
Search by meaningsemantic_search{ path, query: "error handling", topk: 10 }
Search by namesearch_symbols{ path, query: "handleAuth", mode: "substring" }
Who calls Xast_graph_callers{ path, name: "processOrder" }
What X callsast_graph_callees{ path, name: "processOrder" }
Call chainast_graph_chain{ path, name: "main", direction: "downstream" }
Project overviewrepo_map{ path, max_files: 20 }

Rules

  1. Always pass path - Every tool requires explicit repository path
  2. Check index first - Run check_index before search tools
  3. Read before modify - Use read_file to understand code before changes

References