Token导航 LogoToken导航TokenDH.com
研究检索只读github未标认证来源可访问许可证需确认审计通过

code-semantic-search代码语义搜索

Agent Skill

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

总安装

1,529

周安装

65

GitHub Stars

25

下载量

536
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/oimiragieo/agent-studio --skill code-semantic-search

简介

用于查找、检索和筛选相关信息,支持语义与结构混合搜索。

  • 适合根据关键词或任务场景快速定位候选结果。
  • 提供三种搜索模式:混合(默认)、语义-only 和结构-only。
  • 安装前建议确认权限范围、维护状态及是否触发命令执行。
  • 推荐优先使用混合模式以获得更高准确率。code-semantic-search 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Code Semantic Search

Overview

Semantic code search using Phase 1 vector embeddings and Phase 2 hybrid search (semantic + structural). Find code by meaning, not just keywords.

Core principle: Search code by what it does, not what it's called.

Phase 2: Hybrid Search

This skill now supports three search modes:

  1. Hybrid (Default):

- Combines semantic + structural search - Best accuracy (95%+) - Slightly slower but still <150ms - Recommended for all searches

  1. Semantic-Only:

- Uses only Phase 1 semantic vectors - Fastest (<50ms) - Good for conceptual searches - Use when structure doesn't matter

  1. Structural-Only:

- Uses only ast-grep patterns - Precise for exact matches - Best for finding function/class definitions - Use when you need exact structural patterns

Performance Comparison

ModeSpeedAccuracyBest For
Hybrid<150ms95%General search
Semantic-only<50ms85%Concepts
Structural-only<50ms100%Exact patterns
Phase 1 only<50ms80%Legacy (fallback)

When to Use

Always:

  • Finding authentication logic without knowing function names
  • Searching for error handling patterns
  • Locating database queries
  • Finding similar code to a concept
  • Discovering implementation patterns

Don't Use:

  • Exact text matching (use Grep instead)
  • File name searches (use Glob instead)
  • Simple keyword searches (use ripgrep instead)

Usage Examples

Hybrid Search (Recommended)

// Basic hybrid search
Skill({ skill: 'code-semantic-search', args: 'find authentication logic' });

// With options
Skill({
  skill: 'code-semantic-search',
  args: 'database queries',
  options: {
    mode: 'hybrid',
    language: 'javascript',
    limit: 10,
  },
});

Semantic-Only Search

// Fast conceptual search
Skill({
  skill: 'code-semantic-search',
  args: 'find authentication',
  options: { mode: 'semantic-only' },
});

Structural-Only Search

// Exact pattern matching
Skill({
  skill: 'code-semantic-search',
  args: 'find function authenticate',
  options: { mode: 'structural-only' },
});

Implementation Reference

Hybrid Search: .claude/lib/code-indexing/hybrid-search.cjs

Query Analysis: .claude/lib/code-indexing/query-analyzer.cjs

Result Ranking: .claude/lib/code-indexing/result-ranker.cjs

Integration Points

  • developer: Code exploration, implementation discovery
  • architect: System understanding, pattern analysis
  • code-reviewer: Finding similar patterns, consistency checks
  • reverse-engineer: Understanding unfamiliar codebases
  • researcher: Research existing implementations

Iron Laws

  1. ALWAYS use hybrid mode (semantic + structural) for general searches — semantic-only misses exact matches; structural-only misses conceptual variants; hybrid provides 95% accuracy vs 85% for single mode.
  2. ALWAYS use ripgrep/keyword search first for fast keyword discovery — semantic search is for meaning-based queries; exact strings, function names, and filenames are found faster with ripgrep.
  3. NEVER use semantic search without a meaningful natural-language query — single-word or code-syntax queries produce poor semantic results; describe what the code does, not what it's called.
  4. ALWAYS combine with code-structural-search for precision refinement — start broad with semantic discovery, then use ast-grep patterns to find exact structural matches from the semantic results.
  5. NEVER ignore low-similarity results without checking them — similarity scores are approximations; a 0.7 score result may be more relevant than a 0.9 score result for uncommon patterns.

Anti-Patterns

Anti-PatternWhy It FailsCorrect Approach
Semantic search for exact string matchingSlower and less accurate than text searchUse ripgrep/Grep for exact keyword matching
Single-word queries ("auth")Too vague for semantic matching; returns noiseUse natural-language descriptions ("authentication token validation logic")
Using semantic-only mode for general searchesMisses structural variants; 85% vs 95% accuracyUse hybrid mode (default) for general queries
Ignoring search results that don't match expectationsSemantic results find surprising-but-relevant codeRead all results; unexpected matches are often the most valuable
Not combining with structural searchFinds concepts but not exact patternsUse semantic for discovery → structural for precision

Memory Protocol (MANDATORY)

Before starting: Read .claude/context/memory/learnings.md

After completing:

  • New pattern -> .claude/context/memory/learnings.md
  • Issue found -> .claude/context/memory/issues.md
  • Decision made -> .claude/context/memory/decisions.md
ASSUME INTERRUPTION: If it's not in memory, it didn't happen.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.81%
按下载量换算192

Claude

28.51%
按下载量换算153

Cursor

19.85%
按下载量换算106

Gemini CLI

8.56%
按下载量换算46

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

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

来源信息

继续浏览同类 Skills