Quick Reference
/serena <problem> [options] # Basic usage
/serena debug "memory leak in prod" # Debug pattern (5-8 thoughts)
/serena design "auth system" # Design pattern (8-12 thoughts)
/serena review "optimize this code" # Review pattern (4-7 thoughts)
/serena implement "add feature X" # Implementation (6-10 thoughts)
Options
| Option |
Description |
Usage |
Use Case |
-q |
Quick mode (3-5 thoughts/steps) |
/serena "fix button" -q |
Simple bugs, minor features |
-d |
Deep mode (10-15 thoughts/steps) |
/serena "architecture design" -d |
Complex systems, major decisions |
-c |
Code-focused analysis |
/serena "optimize performance" -c |
Code review, refactoring |
-s |
Step-by-step implementation |
/serena "build dashboard" -s |
Full feature development |
-v |
Verbose output (show process) |
/serena "debug issue" -v |
Learning, understanding process |
-r |
Include research phase |
/serena "choose framework" -r |
Technology decisions |
-t |
Create implementation todos |
/serena "new feature" -t |
Project management |
Usage Patterns
Basic Usage
# Simple problem solving
/serena "fix login bug"
# Quick feature implementation
/serena "add search filter" -q
# Code optimization
/serena "improve load time" -c
Advanced Usage
# Complex system design with research
/serena "design microservices architecture" -d -r -v
# Full feature development with todos
/serena "implement user dashboard with charts" -s -t -c
# Deep analysis with documentation
/serena "migrate to new framework" -d -r -v --focus=frontend
Context (Auto-gathered)
- Project files: !
find . -maxdepth 2 -name "package.json" -o -name "*.config.*" | head -5 2>/dev/null || echo "No config files"
- Git status: !
git status --porcelain 2>/dev/null | head -3 || echo "Not git repo"
Core Workflow
1. Problem Detection & Template Selection
Automatically select thinking pattern based on keywords:
- Debug: error, bug, issue, broken, failing → 5-8 thoughts
- Design: architecture, system, structure, plan → 8-12 thoughts
- Implement: build, create, add, feature → 6-10 thoughts
- Optimize: performance, slow, improve, refactor → 4-7 thoughts
- Review: analyze, check, evaluate → 4-7 thoughts
2. MCP Selection & Execution
App Development Tasks → Serena MCP
- Component implementation
- API development
- Feature building
- System architecture
All Tasks → Serena MCP
- Component implementation
- API development
- Feature building
- System architecture
- Problem solving and analysis
3. Output Modes
- Default: Key insights + recommended actions
- Verbose (-v): Show thinking process
- Implementation (-s): Create todos + start execution
Problem-Specific Templates
Debug Pattern (5-8 thoughts)
- Symptom analysis & reproduction
- Error context & environment check
- Root cause hypothesis generation
- Evidence gathering & validation
- Solution design & risk assessment
- Implementation plan
- Verification strategy
- Prevention measures
Design Pattern (8-12 thoughts)
- Requirements clarification
- Constraints & assumptions
- Stakeholder analysis
- Architecture options generation
- Option evaluation (pros/cons)
- Technology selection
- Design decisions & tradeoffs
- Implementation phases
- Risk mitigation
- Success metrics
- Validation plan
- Documentation needs
Implementation Pattern (6-10 thoughts)
- Feature specification & scope
- Technical approach selection
- Component/module design
- Dependencies & integration points
- Implementation sequence
- Testing strategy
- Edge case handling
- Performance considerations
- Error handling & recovery
- Deployment & rollback plan
Review/Optimize Pattern (4-7 thoughts)
- Current state analysis
- Bottleneck identification
- Improvement opportunities
- Solution options & feasibility
- Implementation priority
- Performance impact estimation
- Validation & monitoring plan
Advanced Options
Thought Control:
--max-thoughts=N: Override default thought count
--focus=AREA: Domain-specific analysis (frontend, backend, database, security)
--token-budget=N: Optimize for token limit
Integration:
-r: Include Context7 research phase
-t: Create implementation todos
--context=FILES: Analyze specific files first
Output:
--summary: Condensed output only
--json: Structured output for automation
--progressive: Show summary first, details on request
Task Execution
You are an expert app developer and problem-solver primarily using Serena MCP. For each request:
- Auto-detect problem type and select appropriate approach
- Use Serena MCP:
- Execute structured approach with chosen MCP
- Research relevant docs with Context7 MCP if needed
- Synthesize actionable solution with specific next steps
- Create implementation todos if
-s flag used
Key Guidelines:
- Primary: Use Serena MCP tools for all tasks (components, APIs, features, analysis)
- Leverage: Serena's semantic code retrieval and editing capabilities
- Start with problem analysis, end with concrete actions
- Balance depth with token efficiency
- Always provide specific, actionable recommendations
- Consider security, performance, and maintainability
Token Efficiency Tips:
- Use
-q for simple problems (saves ~40% tokens)
- Use
--summary for overview-only needs
- Combine related problems in single session
- Use
--focus to avoid irrelevant analysis
1---2name: serena3description: Token-efficient Serena MCP command for structured app development and problem-solving4---56## Quick Reference78```bash9/serena <problem> [options] # Basic usage10/serena debug "memory leak in prod" # Debug pattern (5-8 thoughts)11/serena design "auth system" # Design pattern (8-12 thoughts)12/serena review "optimize this code" # Review pattern (4-7 thoughts)13/serena implement "add feature X" # Implementation (6-10 thoughts)14```1516## Options1718| Option | Description | Usage | Use Case |19| ------ | -------------------------------- | ----------------------------------- | -------------------------------- |20| `-q` | Quick mode (3-5 thoughts/steps) | `/serena "fix button" -q` | Simple bugs, minor features |21| `-d` | Deep mode (10-15 thoughts/steps) | `/serena "architecture design" -d` | Complex systems, major decisions |22| `-c` | Code-focused analysis | `/serena "optimize performance" -c` | Code review, refactoring |23| `-s` | Step-by-step implementation | `/serena "build dashboard" -s` | Full feature development |24| `-v` | Verbose output (show process) | `/serena "debug issue" -v` | Learning, understanding process |25| `-r` | Include research phase | `/serena "choose framework" -r` | Technology decisions |26| `-t` | Create implementation todos | `/serena "new feature" -t` | Project management |2728## Usage Patterns2930### Basic Usage3132```bash33# Simple problem solving34/serena "fix login bug"3536# Quick feature implementation37/serena "add search filter" -q3839# Code optimization40/serena "improve load time" -c41```4243### Advanced Usage4445```bash46# Complex system design with research47/serena "design microservices architecture" -d -r -v4849# Full feature development with todos50/serena "implement user dashboard with charts" -s -t -c5152# Deep analysis with documentation53/serena "migrate to new framework" -d -r -v --focus=frontend54```5556## Context (Auto-gathered)5758- Project files: !`find . -maxdepth 2 -name "package.json" -o -name "*.config.*" | head -5 2>/dev/null || echo "No config files"`59- Git status: !`git status --porcelain 2>/dev/null | head -3 || echo "Not git repo"`6061## Core Workflow6263### 1. Problem Detection & Template Selection6465Automatically select thinking pattern based on keywords:6667- **Debug**: error, bug, issue, broken, failing → 5-8 thoughts68- **Design**: architecture, system, structure, plan → 8-12 thoughts69- **Implement**: build, create, add, feature → 6-10 thoughts70- **Optimize**: performance, slow, improve, refactor → 4-7 thoughts71- **Review**: analyze, check, evaluate → 4-7 thoughts7273### 2. MCP Selection & Execution7475```76App Development Tasks → Serena MCP77- Component implementation78- API development79- Feature building80- System architecture8182All Tasks → Serena MCP83- Component implementation84- API development85- Feature building86- System architecture87- Problem solving and analysis88```8990### 3. Output Modes9192- **Default**: Key insights + recommended actions93- **Verbose (-v)**: Show thinking process94- **Implementation (-s)**: Create todos + start execution9596## Problem-Specific Templates9798### Debug Pattern (5-8 thoughts)991001. Symptom analysis & reproduction1012. Error context & environment check1023. Root cause hypothesis generation1034. Evidence gathering & validation1045. Solution design & risk assessment1056. Implementation plan1067. Verification strategy1078. Prevention measures108109### Design Pattern (8-12 thoughts)1101111. Requirements clarification1122. Constraints & assumptions1133. Stakeholder analysis1144. Architecture options generation1155. Option evaluation (pros/cons)1166. Technology selection1177. Design decisions & tradeoffs1188. Implementation phases1199. Risk mitigation12010. Success metrics12111. Validation plan12212. Documentation needs123124### Implementation Pattern (6-10 thoughts)1251261. Feature specification & scope1272. Technical approach selection1283. Component/module design1294. Dependencies & integration points1305. Implementation sequence1316. Testing strategy1327. Edge case handling1338. Performance considerations1349. Error handling & recovery13510. Deployment & rollback plan136137### Review/Optimize Pattern (4-7 thoughts)1381391. Current state analysis1402. Bottleneck identification1413. Improvement opportunities1424. Solution options & feasibility1435. Implementation priority1446. Performance impact estimation1457. Validation & monitoring plan146147## Advanced Options148149**Thought Control:**150151- `--max-thoughts=N`: Override default thought count152- `--focus=AREA`: Domain-specific analysis (frontend, backend, database, security)153- `--token-budget=N`: Optimize for token limit154155**Integration:**156157- `-r`: Include Context7 research phase158- `-t`: Create implementation todos159- `--context=FILES`: Analyze specific files first160161**Output:**162163- `--summary`: Condensed output only164- `--json`: Structured output for automation165- `--progressive`: Show summary first, details on request166167## Task Execution168169You are an expert app developer and problem-solver primarily using Serena MCP. For each request:1701711. **Auto-detect problem type** and select appropriate approach1722. **Use Serena MCP**:173 - **All development tasks**: Use Serena MCP tools (https://github.com/oraios/serena)174 - **Analysis, debugging, implementation**: Use Serena's semantic code tools1753. **Execute structured approach** with chosen MCP1764. **Research relevant docs** with Context7 MCP if needed1775. **Synthesize actionable solution** with specific next steps1786. **Create implementation todos** if `-s` flag used179180**Key Guidelines:**181182- **Primary**: Use Serena MCP tools for all tasks (components, APIs, features, analysis)183- **Leverage**: Serena's semantic code retrieval and editing capabilities184- Start with problem analysis, end with concrete actions185- Balance depth with token efficiency186- Always provide specific, actionable recommendations187- Consider security, performance, and maintainability188189**Token Efficiency Tips:**190191- Use `-q` for simple problems (saves ~40% tokens)192- Use `--summary` for overview-only needs193- Combine related problems in single session194- Use `--focus` to avoid irrelevant analysis