Logo Code Search Assistant

Code Search Assistant

Cộng đồng
ArabelaTso
code-search-assistant

Search code repositories for code related to a given code snippet, ranking results by call chain similarity, textual similarity, and functional similarity. Use when finding related code, locating similar implementations, discovering code dependencies, or identifying code that performs similar operations. Outputs ranked file lists with matching code snippets and relevance scores.

Tổng quan

Nhà phát hànhArabelaTso
Kho mãSkills-4-SE
Tên kỹ năngcode-search-assistant
Sao
258
Bản fork
25
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépApache-2.0
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Đầy đủ trong hướng dẫn

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được ArabelaTso công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Code Search Assistant trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/code-search-assistant
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git /tmp/Skills-4-SE
mkdir -p .claude/skills
cp -r /tmp/Skills-4-SE/skills/code-search-assistant .claude/skills/code-search-assistant
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Code Search Assistant trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Code Search Assistant ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Code Search Assistant không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Code Search Assistant

Overview

Search codebases to find code related to a given snippet using multi-dimensional similarity analysis: call chain patterns, textual structure, and functional behavior. Results are ranked and presented with matching code snippets.

Workflow

1. Analyze Input Snippet

Extract key characteristics from the provided code snippet:

Structural elements:

  • Function/method calls made
  • Classes/types used
  • Control flow patterns (loops, conditionals, try-catch)
  • Data structures (arrays, objects, maps)

Functional elements:

  • Purpose/intent of the code
  • Input/output behavior
  • Side effects (I/O, state changes, API calls)
  • Domain concepts (authentication, validation, transformation)

Textual elements:

  • Variable and function names
  • String literals and constants
  • Comments and documentation
  • Code tokens and keywords

2. Define Search Scope

Determine where to search:

  • Full repository: Search all code files
  • Specific directories: Focus on relevant modules
  • File type filter: Limit to specific languages

Use Glob to identify candidate files:

**/*.js, **/*.py, **/*.java, etc.

3. Search by Call Chain Similarity

Find code with similar function call patterns and dependencies.

Search strategy:

  1. Extract function/method calls from input snippet
  2. Use Grep to find files containing those function calls
  3. Read matching files to analyze call sequences
  4. Score based on:
    • Number of shared function calls (weight: 40%)
    • Order of function calls (weight: 30%)
    • Shared imported modules/libraries (weight: 30%)

Example:

javascript
// Input snippet calls: fetch(), JSON.parse(), setState()
// High match: Code that calls fetch() → JSON.parse() → setState()
// Medium match: Code that calls fetch() and setState() in different order
// Low match: Code that only calls fetch()

4. Search by Textual Similarity

Find code with similar structure and token patterns.

Search strategy:

  1. Extract key identifiers from input snippet (function names, variable names)
  2. Use Grep to find files with similar identifiers
  3. Read matching files to compare code structure
  4. Score based on:
    • Shared variable/function names (weight: 35%)
    • Similar control flow structure (weight: 35%)
    • Shared keywords and operators (weight: 30%)

Similarity indicators:

  • Same loop patterns (for, while, forEach, map)
  • Similar conditional logic (if-else chains, switch statements)
  • Matching data structure operations (array methods, object access)
  • Similar string/number operations

5. Search by Functional Similarity

Find code that performs similar operations or solves similar problems.

Search strategy:

  1. Identify the functional purpose of input snippet
  2. Search for code with similar purpose using semantic patterns
  3. Look for:
    • Similar input/output transformations
    • Equivalent algorithms (different implementations, same result)
    • Parallel business logic
    • Alternative approaches to same problem

Functional categories:

  • Data transformation: Mapping, filtering, reducing, sorting
  • Validation: Input checking, format validation, constraint enforcement
  • I/O operations: File reading/writing, API calls, database queries
  • Authentication/Authorization: Login, permission checks, token handling
  • Error handling: Try-catch patterns, error recovery, logging

Search patterns:

// For validation code, search for:
- "validate", "check", "verify" in function names
- Conditional checks with error throwing
- Regular expression patterns

// For API calls, search for:
- HTTP client usage (fetch, axios, requests)
- Endpoint URLs or API patterns
- Response handling and error cases

6. Rank and Score Results

Combine similarity scores to rank results:

Scoring formula:

Total Score = (Call Chain Score × 0.35) +
              (Textual Score × 0.30) +
              (Functional Score × 0.35)

Score ranges:

  • 0.8-1.0: Very high similarity (likely duplicate or variant)
  • 0.6-0.8: High similarity (related implementation)
  • 0.4-0.6: Medium similarity (similar patterns or purpose)
  • 0.2-0.4: Low similarity (some shared elements)
  • 0.0-0.2: Minimal similarity (weak connection)

Ranking adjustments:

  • Boost files in same directory (+10%)
  • Boost files with similar names (+5%)
  • Penalize test files (-10%) unless input is a test
  • Penalize generated/vendor code (-20%)

7. Format Results

Present results in ranked order with context:

Result format:

markdown
## Search Results for: [Brief snippet description]

### 1. [file_path] (Score: 0.85)

**Similarity breakdown**:
- Call chain: 0.90 (shares fetch, JSON.parse, setState calls)
- Textual: 0.75 (similar variable names and structure)
- Functional: 0.90 (performs same data fetching and state update)

**Matching code** (lines 45-62):
```[language]
[relevant code snippet from the file]

Why it matches: [Brief explanation of similarity]


2. [file_path] (Score: 0.72)

[... repeat format ...]


**Output guidelines**:
- Show top 10 results by default
- Include file path with line numbers
- Show relevant code snippet (10-20 lines)
- Explain why each result matches
- Group results by score tier if many results

## Search Optimization Tips

**For better call chain matching**:
- Include import statements in input snippet
- Provide complete function calls with arguments
- Include chained method calls

**For better textual matching**:
- Use descriptive variable names in input
- Include comments describing intent
- Provide complete code blocks, not fragments

**For better functional matching**:
- Describe what the code does in comments
- Include typical input/output examples
- Show error handling patterns

## Example Usage

**Input snippet**:
```javascript
async function fetchUserData(userId) {
  try {
    const response = await fetch(`/api/users/${userId}`);
    const data = await response.json();
    return data;
  } catch (error) {
    console.error('Failed to fetch user:', error);
    return null;
  }
}

Search process:

  1. Call chain: Search for fetch(), response.json(), console.error()
  2. Textual: Search for async functions with try-catch, similar variable names
  3. Functional: Search for API data fetching patterns, error handling

Expected results:

  • Other API fetch functions (high similarity)
  • Data retrieval functions using different libraries (medium similarity)
  • Functions with similar error handling (low-medium similarity)

Tips

  • Start with a complete, representative code snippet (10-30 lines)
  • Include context (imports, surrounding code) for better matching
  • For large codebases, narrow search scope to relevant directories
  • Adjust score weights based on what matters most (calls vs. structure vs. purpose)
  • Review medium-scored results (0.4-0.6) for unexpected but useful matches
  • Use results to discover alternative implementations or refactoring opportunities

Câu hỏi thường gặp

Kỹ năng AI Code Search Assistant làm được gì?

Search code repositories for code related to a given code snippet, ranking results by call chain similarity, textual similarity, and functional similarity. Use when finding related code, locating similar implementations, discovering code dependencies, or identifying code that performs similar operations. Outputs ranked file lists with matching code snippets and relevance scores.

Vì sao nên dùng Code Search Assistant trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Code Search Assistant là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Code Search Assistant trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/code-search-assistant. TypingMind đọc tệp SKILL.md và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Code Search Assistant?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Code Search Assistant với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Code Search Assistant với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Code Search Assistant có miễn phí không?

Có. Kỹ năng này được ArabelaTso phát hành trên GitHub theo giấy phép Apache-2.0. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇