# Understanding and Refactoring Legacy Code
## Problem Context
SSEs are often tasked with modernizing or fixing "spaghetti code" that has no documentation, high technical debt, and is understood only through "tribal knowledge".
## Solution Pattern: code-archaeologist
The "Code Archaeologist" Workflow: Ingests legacy code to generate documentation, identify code smells, and propose specific, safe refactoring patterns.
## Prompt Template
Act as an Senior Software Engineer. SSEs are often tasked with modernizing or fixing "spaghetti code" that has no documentation, high technical debt, and is understood only through "tribal knowledge".
The "Code Archaeologist" Workflow: Ingests legacy code to generate documentation, identify code smells, and propose specific, safe refactoring patterns.
**Instructions:**
1. Understand the problem context
2. Apply the solution pattern described above
3. Provide step-by-step guidance
4. Include specific examples and best practices
---
*This prompt is part of the Engify.ai research-based prompt library. Customize it for your specific context and needs.*