diff --git a/skills/code-intelligence/SKILL.md b/skills/code-intelligence/SKILL.md index 24ca570..5566358 100644 --- a/skills/code-intelligence/SKILL.md +++ b/skills/code-intelligence/SKILL.md @@ -4,13 +4,15 @@ description: >- Use this skill when the user needs semantic code navigation backed by a Language Server: jump to definitions or implementations, find references, inspect hover/type information, list document or workspace symbols, or trace - incoming and outgoing calls. Activate it for requests such as "where is this + incoming and outgoing calls. For such requests you MUST load this skill first + to unlock the hidden `Lsp` tool; do NOT answer them from `Grep`/`Glob` text + matching without trying `Lsp`. Activate it for requests such as "where is this symbol defined", "find usages", "who calls this function", "show the file outline", or "search symbols in the workspace". A compatible Language Server must already be installed; this skill never installs one automatically. Use when 用户提到 跳转定义、查找引用、查找实现、类型信息、悬停信息、符号大纲、 工作区符号、调用关系、谁调用了这个函数、这个函数调用了谁、语义代码导航。 -version: 1.0.0 +version: 1.1.0 type: procedural risk_level: low status: enabled @@ -26,7 +28,7 @@ provides: - Lsp metadata: author: desirecore - updated_at: '2026-07-22' + updated_at: '2026-08-31' i18n: default_locale: en-US source_locale: zh-CN @@ -37,17 +39,17 @@ metadata: name: 代码智能 short_desc: 基于 Language Server 的定义、引用、符号与调用关系导航 description: >- - 使用已安装的 Language Server 执行语义代码导航,包括定义、引用、实现、悬停类型、符号大纲和调用层级。 + 使用已安装的 Language Server 执行语义代码导航,包括定义、引用、实现、悬停类型、符号大纲和调用层级。此类请求必须先加载本技能解锁隐藏的 `Lsp` 工具,禁止未尝试 `Lsp` 就用文本检索作答。 body: ./SKILL.zh-CN.md - source_hash: sha256:cf613ab2572810e5 + source_hash: sha256:ebfecf4d2982632d translated_by: human en-US: name: Code Intelligence short_desc: Language Server powered definitions, references, symbols, and call navigation description: >- - Use an installed Language Server for semantic code navigation, including definitions, references, implementations, hover types, symbols, and call hierarchies. + Use an installed Language Server for semantic code navigation, including definitions, references, implementations, hover types, symbols, and call hierarchies. Load this skill first to unlock the hidden `Lsp` tool for such requests; never answer them from text search alone without trying `Lsp`. body: ./SKILL.md - source_hash: sha256:cf613ab2572810e5 + source_hash: sha256:ebfecf4d2982632d translated_by: human market: icon: >- @@ -84,7 +86,12 @@ Activate this skill when the task depends on symbol meaning rather than text mat - List the symbols in one file or search symbols across the workspace. - Find callers and callees through the LSP call hierarchy. -Use `Grep` or `Glob` instead when the task is purely textual or no compatible Language Server is installed. +### Hard rules + +- Semantic-navigation requests (definitions, references, implementations, call relations, symbols) **MUST try `Lsp` first**; never answer them from `Grep`/`Glob` text matching without trying `Lsp`. +- Falling back to text search is allowed only when: the `Lsp` call errors, the target language is not in the supported mappings, or the Language Server is missing and the user has not asked to install it. +- Every answer that falls back to text search **MUST explicitly tell the user** that the result comes from text matching, not semantic analysis, and why (for example "typescript-language-server is not installed"). In large repositories, or with same-named symbols, overloads, or inheritance, text matching can be wrong — never let the user mistake it for semantic navigation. +- Purely textual searches (string literals, log copy) are out of scope for this skill; use `Grep`/`Glob` directly. ## L2: Operating Procedure @@ -128,6 +135,6 @@ Supported built-in mappings: ### 5. Fallbacks -- Unsupported file type or missing server: use `Grep`, `Glob`, and `Read` for text-level investigation. +- Unsupported file type or missing server: use `Grep`, `Glob`, and `Read` for text-level investigation, and explicitly tell the user — per the hard rules — that the result comes from text matching, not semantic analysis, and why. - Server does not advertise an operation: report that capability mismatch instead of guessing. - Empty semantic result: explain that the symbol may be unresolved, excluded, or filtered by access rules; do not claim the symbol has no usages without qualification. diff --git a/skills/code-intelligence/SKILL.zh-CN.md b/skills/code-intelligence/SKILL.zh-CN.md index 72b0445..781bdc8 100644 --- a/skills/code-intelligence/SKILL.zh-CN.md +++ b/skills/code-intelligence/SKILL.zh-CN.md @@ -16,7 +16,12 @@ - 列出单个文件的符号大纲,或在工作区内搜索符号。 - 通过 LSP 调用层级查找调用者与被调用者。 -如果需求只是文本搜索,或者没有兼容的 Language Server,改用 `Grep` 或 `Glob`。 +### 硬性规则 + +- 语义导航类请求(定义、引用、实现、调用关系、符号)**必须先尝试 `Lsp`**;禁止在未尝试 `Lsp` 的情况下,直接用 `Grep`/`Glob` 的文本匹配结果作答。 +- 只有以下情形才允许回退到文本检索:`Lsp` 调用报错、目标语言不在支持映射中、或 Language Server 未安装且用户未要求安装。 +- 任何回退到文本检索的回答,**必须向用户显式声明**结果来自文本匹配而非语义分析,并说明原因(如「typescript-language-server 未安装」)。大型仓库、同名符号、重载/继承场景下文本匹配可能给出错误答案,不得让用户误以为拿到的是语义导航结果。 +- 需求只是纯文本搜索(如查找字符串字面量、日志文案)时不适用本技能,直接用 `Grep`/`Glob`。 ## L2:操作流程 @@ -60,7 +65,7 @@ DesireCore 只探测用户已经安装的二进制,缺失时返回安装提示 ### 5. 降级策略 -- 文件类型不支持或 Server 未安装:使用 `Grep`、`Glob`、`Read` 做文本级调查。 +- 文件类型不支持或 Server 未安装:使用 `Grep`、`Glob`、`Read` 做文本级调查,并在回答中按「硬性规则」显式声明结果来自文本匹配而非语义分析及原因。 - Server 未声明某项能力:如实报告 capability 不匹配,不得猜测结果。 - 语义结果为空:说明符号可能未解析、被排除或被访问规则过滤;不能直接断言“没有引用”。