Expert integration for the Serena MCP Server - a powerful coding agent toolkit providing IDE-like semantic code understanding to LLMs. This skill should be used when working with codebases through Serena tools, setting up Serena projects, performing semantic code navigation and editing, managing project memories, debugging complex automation workflows, or integrating Serena with Claude Desktop, Claude Code, Codex, ChatGPT, or custom agents. Triggers on Serena tool usage, project activation/onboarding, symbolic code operations (find_symbol, replace_symbol_body, etc.), memory management (write_memory, read_memory), and MCP server configuration. Use for large/complex codebases requiring structural understanding, refactoring tasks, and token-efficient code operations.
Serena transforms LLMs into fully-featured coding agents with IDE-like intelligence by leveraging the Language Server Protocol (LSP) for structural code understanding.
| Capability | Benefit |
|---|---|
| Semantic code retrieval | Navigate by symbols, not text - 30x+ token reduction |
| Surgical editing | Modify function bodies while preserving structure |
| Project memory | Persist knowledge across sessions in .serena/memories/ |
| Multi-client support | Claude Desktop, Claude Code, Codex, ChatGPT, custom agents |
Activate project before any operations:
"Activate the project /path/to/my_project"
First-time activation creates .serena/project.yml with default settings.
Run automatically on first session. Creates memories in .serena/memories/:
tech_stack_and_dependencies.mdcode_style_and_conventions.mdtask_completion_guidelines.mdIf not auto-triggered:
"Start the Serena onboarding process for this project."
Critical: Start NEW conversation after onboarding (context fills up during analysis).
Pre-index to prevent tool timeouts:
serena project index
Run once; auto-updates during use.
Priority Order (Prefer Higher):
Symbolic tools - Most efficient, LSP-powered
get_symbols_overview → File structure without reading contentfind_symbol → Locate definitions preciselyfind_referencing_symbols → Impact analysis before changesreplace_symbol_body → Rewrite functions safelyLine-based tools - When symbols don't apply
replace_lines, insert_at_line, delete_linesFull file operations - Last resort
read_file, create_text_fileSee: references/tools-reference.md for complete tool taxonomy.
Persist knowledge in .serena/memories/:
| Tool | Purpose |
|---|---|
write_memory | Save contracts, schemas, progress |
read_memory | Load prior session context |
list_memories | Discover available memories |
prepare_for_new_conversation | Generate continuation summary |
summarize_changes | Document session work |
Pattern: End sessions with summarize_changes → write_memory.
Force self-reflection during complex operations:
| Tool | When to Use |
|---|---|
think_about_collected_information | Before implementing |
think_about_task_adherence | During long operations |
think_about_whether_you_are_done | Before declaring complete |
Claude Desktop: Edit claude_desktop_config.json
{
"mcpServers": {
"serena": {
"command": "uvx",
"args": ["--from", "git+https://github.com/oraios/serena",
"serena", "start-mcp-server", "--context", "desktop-app"]
}
}
}
Claude Code: From project directory:
claude mcp add serena -- uvx --from git+https://github.com/oraios/serena \
serena start-mcp-server --context ide-assistant --project "$(pwd)"
See: references/client-setup.md for Codex, ChatGPT, Docker, etc.
Contexts (set at startup, immutable):
desktop-app - Claude Desktop (full toolset)claude-code - Claude Code (no duplicates)ide-assistant - IDE extensions (minimal tools)codex - OpenAI Codexchatgpt - ChatGPT via MCPOModes (combinable, switchable):
editing + interactive - Standard development (default)planning - Analysis before implementationone-shot - Single-response tasksno-onboarding - Skip if memories existSwitch dynamically: "Switch to planning mode"
See: references/contexts-and-modes.md for full reference.
In .serena/project.yml:
read_only: true # Disable all editing (analysis only)
excluded_tools:
- execute_shell_command # Always disable for untrusted contexts
Non-negotiables:
execute_shell_command unless explicitly neededread_only: true for code review/analysis tasksFor complex automation workflows (n8n, Zapier, etc.):
See: references/debugging-framework.md for canonical prompts and workflow.
Start:
get_current_configcheck_onboarding_performedlist_memories → read_memoryDuring:
End:
summarize_changes → write_memoryprepare_for_new_conversationOptimal:
Not Needed:
Monitor operations at: http://localhost:24282/dashboard/index.html
View: tool calls, logs, configuration, active languages.