AgentSkillsCN

serena-navigator

当用户请求“高效导航代码”、“查找函数定义”、“理解文件结构”、“探索代码库”、“获取符号概览”、“查找符号的使用位置”,或提及 Serena 的 LSP 工具,如 get_symbols_overview、find_symbol、find_referencing_symbols 时,可使用此技能。

SKILL.md
--- frontmatter
name: serena-navigator
description: |
  This skill should be used when the user asks to "navigate code efficiently",
  "find function definition", "understand file structure", "explore codebase",
  "get symbols overview", "find symbol usages", or mentions Serena's LSP tools
  like get_symbols_overview, find_symbol, find_referencing_symbols.

Serena Semantic Navigation

Token-Efficient Reading Pattern

Instead of reading entire files:

  1. Get overview first: get_symbols_overview(file) - See all functions/classes
  2. Locate specific symbol: find_symbol(name) - Get exact location
  3. Read targeted section: read_file(path, start_line, end_line) - Only what's needed

This pattern saves 90%+ tokens on large files.

Tool Selection Guide

TaskTool
See file structureget_symbols_overview(file_path)
Find definitionfind_symbol(name)
Find all usagesfind_referencing_symbols(symbol_name)
Search text/commentssearch_for_pattern(pattern)

Example Workflow: Understanding Code

code
1. get_symbols_overview("src/services/payment.py")
   → See PaymentProcessor class with all methods

2. find_symbol("process_payment")
   → Get exact location and signature

3. find_referencing_symbols("process_payment")
   → Find all call sites

4. read_file("src/services/payment.py", start_line=45, end_line=80)
   → Read only the relevant method

When to Use Text Search

Use search_for_pattern for:

  • String literals and comments
  • Configuration values
  • Non-code patterns

Memory Integration

Check existing project knowledge:

code
list_memories()
read_memory("architecture_overview")

Save discoveries:

code
write_memory(key="architecture_overview", content="...")