| 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. |
| version | 0.1.0 |
Provide patterns for effective use of Serena MCP tools for semantic code operations.
Get high-level view of symbols in a file
Path to file (required)
Descendant depth, 0 for top-level only
First step when exploring a new file
Find symbols by name path pattern
Symbol name or path (e.g., "MyClass/myMethod")
Restrict to file or directory
Include source code
Include descendants
Match partial names
Locate specific functions, classes, or methods
Find all references to a symbol
Symbol to find references for
File containing the symbol
Dependency analysis, impact assessment
Regex search across codebase
Regex pattern
Restrict search scope
Lines before match
Lines after match
Search only code files or all files
Glob pattern for files to include
Glob pattern for files to exclude
Find patterns, non-code files, complex searches
Replace entire symbol definition
Symbol to replace
File containing symbol
New symbol body
Refactoring entire functions or classes
Insert content before a symbol
Symbol to insert before
File containing symbol
Content to insert
Add imports, decorators, comments
Insert content after a symbol
Symbol to insert after
File containing symbol
Content to insert
Add new functions, classes
Rename symbol across codebase
Symbol to rename
File containing symbol
New symbol name
Consistent renaming with reference updates
List all available memory files
Check existing patterns before implementation
Read content of a memory file
Name of memory file to read
Load project patterns and conventions
Write information to a memory file
Name of memory file to write
Content to write
Record new patterns and conventions
Delete a memory file
Name of memory file to delete
Remove obsolete or incorrect patterns
Replace content in a memory file using regex or literal matching
Name of memory file to edit
Pattern to search for
Replacement string
Either "literal" or "regex"
Update specific parts of memory files
Persistent storage for project patterns, conventions, and architectural decisions
list_memories # Check existing patterns
read_memory "nix-conventions" # Load Nix patterns
write_memory "api-patterns" "REST API conventions..." # Record new pattern
delete_memory "outdated-pattern" # Remove obsolete info
Consistent naming conventions for memory files
{project}-conventions # Project-wide conventions
{feature}-patterns # Feature-specific patterns
{domain}-patterns # Domain-specific patterns
architecture-{decision} # Architecture decisions
Path to symbol within a file (e.g., MyClass/myMethod)
find_symbol "MyClass/myMethod" # Find specific method
find_symbol "get*" substring_matching=true # Find all getter methods
Meta-cognitive tools for ensuring search quality and task alignment
After searching multiple files
think_about_collected_information
Before making changes
think_about_task_adherence
When task seems complete
think_about_whether_you_are_done
Systematically explore file structure from high-level to detailed
Step 1: Get top-level overview
get_symbols_overview relative_path="src/main.ts" depth=0
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
Trace symbol dependencies and callers
Step 1: Locate the symbol
find_symbol name_path_pattern="processData" relative_path="src/processor.ts"
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
Refactor with full impact analysis
Step 1: Understand current implementation
find_symbol name_path_pattern="MyClass/oldMethod" include_body=true
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 for patterns with appropriate scope
Search only in code files
search_for_pattern substring_pattern="TODO:" restrict_search_to_code_files=true
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
Use memories to maintain consistency across tasks
Before implementation
list_memories # Check what patterns exist
read_memory "typescript-patterns" # Load relevant patterns
During implementation
Follow the patterns loaded from memory
After implementation
write_memory "api-client-pattern" "HTTP client pattern using fetch with retry logic..."
<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
Searching entire codebase when scope is known
Use relative_path parameter to restrict search to known files or directories
Implementing features without checking existing patterns
Always check list_memories and read_memory before implementation
Manually updating symbol references across files
Use rename_symbol for consistent renaming with automatic reference updates
Using high depth values unnecessarily in get_symbols_overview
Start with depth=0, then incrementally increase if needed
<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>
Always check memories before implementing new features
Use symbol operations over reading entire files
Call think_about_collected_information after non-trivial search sequences
Call think_about_task_adherence before making code changes
Restrict searches by relative_path when scope is known
Use substring_matching for uncertain symbol names
Record new patterns with write_memory
Call think_about_whether_you_are_done when task appears complete