Logo vun Code Search Assistant

Code Search Assistant

Communautéit
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.

Iwwersiicht

EditeurArabelaTso
RepositorySkills-4-SE
Skill-Nummcode-search-assistant
Stären
258
Forks
25
Matgeliwwert Fichieren
Nëmmen Instruktiounen
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    Vum ArabelaTso op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Code Search Assistant an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/code-search-assistant
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

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
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Code Search Assistant an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Code Search Assistant automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Code Search Assistant net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

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

Heefeg gestallte Froen

Wat mécht de KI-Skill 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.

Firwat Code Search Assistant op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Code Search Assistant besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Code Search Assistant an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/code-search-assistant an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Code Search Assistant benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Code Search Assistant benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Code Search Assistant domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Code Search Assistant gratis?

Jo. De Skill gëtt vum ArabelaTso ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇