## 背景 / Background desirecore/desirecore#2248:真机测试中 code-intelligence 技能被绕过——模型未加载技能、未解锁 `Lsp`,直接用 Glob/Grep 文本检索回答语义导航问题,用户无从知道拿到的不是语义结果。 In real-device testing the skill was bypassed entirely: the model answered semantic-navigation questions from Glob/Grep text matching without loading the skill or unlocking `Lsp`, with no disclosure to the user. ## 变更 / Changes - **description(根级 + i18n 双语)改为命令式**:语义导航请求必须先加载本技能解锁隐藏的 `Lsp` 工具,禁止未尝试 `Lsp` 就用文本检索作答(配合主仓库的技能目录 provides.tools 附注,模型在决策点即可看到该指令) - **L1 新增「硬性规则」**(双语):`Lsp` 优先;限定允许回退的三种情形;任何回退到文本检索的回答必须向用户显式声明「结果来自文本匹配而非语义分析」及原因 - **L2 降级策略**同步引用硬性规则 - version 1.0.0 → 1.1.0;重算 i18n `source_hash`(`translated_by: human` 保持锁定) ## 校验 / Validation - `uv run scripts/i18n/validate-i18n.py` → OK - `uv run scripts/i18n/translate.py --check` → code-intelligence 两 locale 均无 stale
7.1 KiB
name, description, version, type, risk_level, status, disable-model-invocation, tags, provides, metadata, market
| name | description | version | type | risk_level | status | disable-model-invocation | tags | provides | metadata | market | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| code-intelligence | 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. 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 用户提到 跳转定义、查找引用、查找实现、类型信息、悬停信息、符号大纲、 工作区符号、调用关系、谁调用了这个函数、这个函数调用了谁、语义代码导航。 | 1.1.0 | procedural | low | enabled | true |
|
|
|
|
code-intelligence Skill
L0: One-line Summary
Use DesireCore's hidden Lsp tool for semantic code navigation through an already-installed Language Server.
L1: When to Use
Activate this skill when the task depends on symbol meaning rather than text matching:
- Jump to a symbol's definition or implementation.
- Find all semantic references to a symbol.
- Inspect type information or documentation at a source position.
- List the symbols in one file or search symbols across the workspace.
- Find callers and callees through the LSP call hierarchy.
Hard rules
- Semantic-navigation requests (definitions, references, implementations, call relations, symbols) MUST try
Lspfirst; never answer them fromGrep/Globtext matching without tryingLsp. - Falling back to text search is allowed only when: the
Lspcall 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/Globdirectly.
L2: Operating Procedure
1. Check the workspace boundary
Lsp starts an external indexing process that can read the authorized workspace. The target file therefore needs directory-level read access. If the tool reports that an exact-file grant is insufficient, ask the user to authorize the project directory through ManageWorkDirs; never widen the scope silently.
2. Choose one operation
| Operation | Purpose | Required input |
|---|---|---|
goToDefinition |
Find where a symbol is defined | file, line, character |
findReferences |
Find semantic references, including the declaration | file, line, character |
hover |
Read type information or documentation | file, line, character |
documentSymbol |
Outline symbols in one file | file |
workspaceSymbol |
Search named symbols in the current workspace | file, non-empty query |
goToImplementation |
Find concrete implementations | file, line, character |
prepareCallHierarchy |
Resolve a callable item at a position | file, line, character |
incomingCalls |
Find functions or methods that call the target | file, line, character |
outgoingCalls |
Find functions or methods called by the target | file, line, character |
line and character are 1-based, matching editor coordinates. Character offsets use UTF-16 semantics.
3. Treat results as bounded navigation evidence
- Results are filtered by the active read scope and workspace
.gitignorerules. - Use
maxResultsto keep broad reference or symbol searches focused; the maximum is 200. - A first request may take longer while the server indexes the workspace.
- Re-run the request after source files change; DesireCore synchronizes the latest saved UTF-8 content.
4. Handle missing servers without modifying the system
DesireCore only discovers installed binaries and returns an installation hint when one is missing. Do not run that installation command unless the user explicitly asks you to install the dependency.
Supported built-in mappings:
- TypeScript/JavaScript:
typescript-language-server - Python:
pyright-langserver - Go:
gopls - Rust:
rust-analyzer
5. Fallbacks
- Unsupported file type or missing server: use
Grep,Glob, andReadfor 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.