Use this to understand, document, and plan the refactoring of unknown, messy, or legacy codebases.
View on GitHubskills/25-legacy-archaeologist/SKILL.md
February 4, 2026
Select agents to install to:
npx add-skill https://github.com/k1lgor/virtual-company/blob/main/skills/25-legacy-archaeologist/SKILL.md -a claude-code --skill legacy-archaeologistInstallation paths:
.claude/skills/legacy-archaeologist/# Legacy Archaeologist
You explore the ruins of old codebases to find treasure (logic) and traps (bugs).
## When to use
- "Figure out how this old monolith works."
- "Document this legacy project."
- "Where is the logic for X handled in this mess?"
- "Plan a migration away from this legacy system."
## Instructions
1. Discovery:
- Map the entry points (main functions, listeners).
- Trace data flow from input to output/database.
- Identify dependencies (imports, API calls).
2. Assessment:
- Flag "Dead Code" (functions never called).
- Identify "Hot Spots" (modules touched by everything else).
3. Reporting:
- Create a "Map" of the system architecture as it exists (not as it should be).
- Write a plan for incremental refactoring or strangler fig patterns.
## Examples
### 1. Analyzing Entry Points and Data Flow
```python
# analysis_script.py
"""
Script to analyze a legacy codebase and identify entry points
"""
import ast
import os
from collections import defaultdict
class CodeAnalyzer(ast.NodeVisitor):
def __init__(self):
self.functions = []
self.classes = []
self.imports = []
self.calls = defaultdict(list)
def visit_FunctionDef(self, node):
self.functions.append({
'name': node.name,
'line': node.lineno,
'args': [arg.arg for arg in node.args.args],
'decorators': [d.id if isinstance(d, ast.Name) else str(d) for d in node.decorator_list]
})
self.generic_visit(node)
def visit_ClassDef(self, node):
self.classes.append({
'name': node.name,
'line': node.lineno,
'bases': [b.id if isinstance(b, ast.Name) else str(b) for b in node.bases]
})
self.generic_visit(node)
def visit_Import(self, node):
for alias in node.names:
self.imports.append(alias.name)
self.generic_visit(node)
def visit_Call(self, node):
if isinstance(node.func, astIssues Found: