Serena Usage
This skill should be used when the user asks to "use serena", "semantic search", "symbol analysis", "find references", "code navigation", or needs Serena MCP guidance. Provides Serena tool usage patterns.
$ 安裝
git clone https://github.com/takeokunn/nixos-configuration /tmp/nixos-configuration && cp -r /tmp/nixos-configuration/home-manager/programs/claude-code/skills/serena-usage ~/.claude/skills/nixos-configuration// tip: Run this command in your terminal to install the skill
name: Serena Usage description: This skill should be used when the user asks to "use serena", "semantic search", "symbol analysis", "find references", "code navigation", or needs Serena MCP guidance. Provides Serena tool usage patterns.
Before making changes
think_about_task_adherence
When task seems complete
think_about_whether_you_are_done
Step 2: Explore class members get_symbols_overview relative_path="src/main.ts" depth=1
Step 3: Get specific implementation find_symbol name_path_pattern="MyClass/myMethod" include_body=true
Step 2: Find all callers find_referencing_symbols name_path="processData" relative_path="src/processor.ts"
Step 3: Recursively trace for full dependency graph Repeat steps 1-2 for each caller to build complete dependency tree
Step 2: Identify all usages find_referencing_symbols name_path="MyClass/oldMethod" relative_path="src/myclass.ts"
Step 3: Perform the change replace_symbol_body name_path="MyClass/oldMethod" relative_path="src/myclass.ts" body="..."
Step 4: Update references if interface changed If method signature changed, update all calling sites identified in step 2
Search in all files including configs search_for_pattern substring_pattern="api-key" restrict_search_to_code_files=false
Include context around matches search_for_pattern substring_pattern="function.*async" context_lines_before=2 context_lines_after=3
During implementation Follow the patterns loaded from memory
After implementation write_memory "api-client-pattern" "HTTP client pattern using fetch with retry logic..."
<decision_tree name="tool_selection"> What type of operation is needed? Use find_symbol with name_path_pattern Use get_symbols_overview with appropriate depth Use find_referencing_symbols Use search_for_pattern with regex Use replace_symbol_body Use rename_symbol for consistent updates Use insert_before_symbol or insert_after_symbol Use list_memories then read_memory Use write_memory </decision_tree>
<anti_patterns> Reading entire files when only specific symbols are needed Use get_symbols_overview for file structure and find_symbol with include_body for specific implementations
<best_practices> Always check memories with list_memories and read_memory before implementing new features Use symbol operations (get_symbols_overview, find_symbol) over reading entire files Restrict searches by relative_path when scope is known to improve performance Use substring_matching for uncertain symbol names to broaden search results Record new patterns and conventions with write_memory for future reference Use context_lines parameters in search_for_pattern to understand surrounding code Verify symbol changes with find_referencing_symbols before refactoring </best_practices>
<related_agents> Uses Serena for architecture analysis and pattern discovery Uses Serena for complexity analysis and refactoring Uses Serena for tracing dependencies and impact analysis Uses Serena for symbol-level operations and memory management Uses Serena for vulnerability detection and security pattern analysis Uses Serena for schema analysis and query optimization Uses Serena for performance bottleneck identification and optimization Uses Serena for test coverage analysis and test generation </related_agents>
<error_escalation> Symbol not found with exact match Note in report, proceed Memory file not found Document issue, use AskUserQuestion for clarification Conflicting information in memories STOP, present options to user Memory corruption or invalid state BLOCK operation, require explicit user acknowledgment </error_escalation>
<related_skills> Investigation methodology using Serena tools Nix patterns stored in Serena memories TypeScript patterns stored in Serena memories Go patterns stored in Serena memories Rust patterns stored in Serena memories Common Lisp patterns stored in Serena memories Emacs patterns stored in Serena memories </related_skills>
Repository
