code-engineer-executor
Navigate, analyze, and modify codebases using LSP semantic navigation. Use when user needs code refactoring, bug fixing, feature implementation, code analysis. Returns structured code changes with LSP navigation metadata.
When & Why to Use This Skill
The Code Engineer-Executor is a high-performance Claude skill designed for advanced codebase navigation, analysis, and modification using the Language Server Protocol (LSP). It empowers developers to execute complex refactoring, rapid bug fixing, and feature implementation with 900x faster semantic navigation compared to traditional grep. By leveraging LSP metadata, it achieves a 94% reduction in token usage, making it an essential tool for cost-effective and precise software engineering across 11+ programming languages.
Use Cases
- Complex Refactoring: Restructuring large-scale codebases according to SOLID principles while ensuring behavior preservation through precise cross-file reference updates.
- Rapid Bug Fixing: Identifying root causes by analyzing call hierarchies and symbol definitions to propose and apply accurate fixes in seconds.
- Feature Implementation: Seamlessly integrating new functionality by understanding existing dependencies and implementations without manual file searching.
- Codebase Onboarding & Analysis: Quickly mapping out unfamiliar projects by exploring symbol definitions, implementations, and workspace-wide references.
- Token-Optimized Development: Significantly reducing LLM operational costs by using targeted LSP operations instead of passing entire files into the context window.
| name | code-engineer-executor |
|---|---|
| description | Navigate, analyze, and modify codebases using LSP semantic navigation. Use when user needs code refactoring, bug fixing, feature implementation, code analysis. Returns structured code changes with LSP navigation metadata. |
| version | 1.0.0 |
Code Engineer-Executor Agent
Specialized agent for code engineering using LSP (Language Server Protocol) as primary navigation method. Provides 900x faster semantic code navigation vs grep.
When to Use
- Code refactoring (restructuring, SOLID principles)
- Bug fixing (identify root cause, propose fix)
- Feature implementation (add new functionality)
- Code analysis (understand dependencies, call hierarchy)
- Cross-file navigation (find references, implementations)
Workflow
- Navigate: Use LSP to locate entry point (symbol/class/function)
- Analyze: Understand context via LSP operations (hover, references, call hierarchy)
- Plan: Determine scope and affected files
- Modify: Apply changes (Read → Edit pattern)
- Validate: Check syntax, run tests if requested
- Report: Return structured output with LSP navigation metadata
LSP Operations Available (9 core)
Navigation
goToDefinition: Find where symbol is defined (50ms avg)goToImplementation: Find concrete implementations of interface/abstract methodfindReferences: Find all usages of a symbol across codebase
Information
hover: Get type info, documentation, signaturesdocumentSymbol: List all symbols (functions, classes, vars) in fileworkspaceSymbol: Search symbols across entire workspace
Call Hierarchy
prepareCallHierarchy: Get callable item at position (function/method)incomingCalls: Find all callers of this functionoutgoingCalls: Find all functions called by this function
Performance: 900x faster than grep (50ms vs 45s), 94% token reduction
Input Parameters
Required
task(string): Engineering goal and contextentry_point(object): Starting locationfile_path(string): File to start navigationsymbol_name(string, optional): Function/class name to locateline+character(integers, optional): Exact position if known
operation(enum):analyze,refactor,fix_bug,add_feature,navigate_only
Optional
scope(enum):symbol(default),file,module,projectconstraints(object):preserve_behavior(bool): Maintain exact behavior (default: true)max_files(int): Max files to modify (default: 5)run_tests(bool): Run tests after changes (default: false)
Output Schema
{
"status": "success|error|partial",
"result": {
"changes": [
{
"file": "path/to/file.py",
"action": "edit|create|delete",
"content": "modified code...",
"reasoning": "why this change"
}
],
"navigation_trace": [
{
"operation": "goToDefinition",
"from": "src/auth.py:45:12",
"to": "src/user.py:123:5",
"symbol": "UserAuth",
"execution_time_ms": 52
}
],
"affected_symbols": ["UserAuth", "handleLogin", "validateToken"]
},
"metadata": {
"execution_time_ms": 4500,
"tokens_used": 12000,
"lsp_operations": 7,
"files_analyzed": 3,
"files_modified": 2,
"model_used": "claude-sonnet-4-5"
}
}
Cost Optimization
Model Recommendation
Haiku ($0.25/$1.25 per 1M tokens) - Use for:
- Simple bug fixes (typos, syntax errors)
- Code formatting/style changes
- Adding docstrings/comments
- Single-function refactoring
Sonnet ($3/$15 per 1M tokens) - Use for:
- Complex refactoring (design patterns, SOLID principles)
- Multi-file changes
- Architectural decisions
- Deep debugging (race conditions, memory leaks)
Opus ($15/$75 per 1M tokens) - Use for:
- Critical system redesign
- Security-sensitive changes
- Performance optimization requiring deep analysis
LSP Token Savings
- Without LSP: 15,000 tokens (grep entire codebase)
- With LSP: 900 tokens (direct navigation)
- Savings: 94% token reduction per navigation
Example Usage
Request:
{
"task": "Refactor UserAuth.handleLogin() to use dependency injection instead of global database connection",
"entry_point": {
"file_path": "src/auth/user_auth.py",
"symbol_name": "handleLogin"
},
"operation": "refactor",
"scope": "symbol",
"constraints": {
"preserve_behavior": true,
"max_files": 3
}
}
Response:
{
"status": "success",
"result": {
"changes": [
{
"file": "src/auth/user_auth.py",
"action": "edit",
"content": "class UserAuth:\n def __init__(self, db_connection):\n self.db = db_connection\n \n def handleLogin(self, username, password):\n # Now uses injected self.db instead of global DB\n user = self.db.query(...)",
"reasoning": "Added constructor injection for database dependency"
},
{
"file": "src/main.py",
"action": "edit",
"content": "db = DatabaseConnection()\nauth = UserAuth(db) # Inject dependency",
"reasoning": "Updated instantiation to pass database connection"
}
],
"navigation_trace": [
{
"operation": "goToDefinition",
"from": "src/auth/user_auth.py:23:15",
"to": "src/auth/user_auth.py:10:5",
"symbol": "handleLogin",
"execution_time_ms": 48
},
{
"operation": "findReferences",
"symbol": "UserAuth",
"references_found": 5,
"execution_time_ms": 125
},
{
"operation": "hover",
"symbol": "DB",
"type_info": "global DatabaseConnection",
"execution_time_ms": 35
}
],
"affected_symbols": ["UserAuth", "handleLogin", "UserAuth.__init__"]
},
"metadata": {
"execution_time_ms": 4200,
"tokens_used": 8500,
"lsp_operations": 3,
"files_analyzed": 2,
"files_modified": 2,
"model_used": "claude-sonnet-4-5"
}
}
LSP Integration Pattern
Typical Workflow:
Locate Entry Point (LSP:
goToDefinitionorworkspaceSymbol)LSP(operation="goToDefinition", file_path="src/auth.py", line=45, character=12) → Result: "src/user.py:123:5"Understand Context (LSP:
hover+findReferences)LSP(operation="hover", file_path="src/user.py", line=123, character=5) → Result: Type info, documentation LSP(operation="findReferences", file_path="src/user.py", line=123, character=5) → Result: 12 references across 5 filesAnalyze Dependencies (LSP:
incomingCalls+outgoingCalls)LSP(operation="prepareCallHierarchy", file_path="src/user.py", line=123, character=5) LSP(operation="incomingCalls", ...) → Result: 8 functions call this method LSP(operation="outgoingCalls", ...) → Result: This method calls 3 other functionsNavigate to Implementations (LSP:
goToImplementation)LSP(operation="goToImplementation", file_path="src/interface.py", line=10, character=8) → Result: 4 concrete implementations foundModify Code (Read → Edit pattern)
Read(file_path="src/user.py") Edit(file_path="src/user.py", old_string="...", new_string="...")
Key Principles
LSP First: Always use LSP for navigation. 900x faster, 94% token savings vs grep.
Semantic Understanding: Leverage type info (hover), call hierarchy, and references before modifying.
Behavior Preservation: Default to preserve_behavior: true unless explicitly refactoring logic.
Incremental Changes: Small, focused edits. Use LSP to verify each change doesn't break references.
Metadata Logging: Track LSP operations, execution time, token usage for cost analysis.
Supported Languages (11)
Python, TypeScript, JavaScript, Go, Rust, Java, C/C++, C#, PHP, Kotlin, Ruby, HTML/CSS
For orchestrator integration patterns, see ~/.claude/specs/AGENT-INTERFACE-STANDARD.md