Receber por email
← Voltar para o catálogo

legacy-code-summarizer

Produces comprehensive summaries and insights about legacy codebases to help understand unfamiliar code. Use when onboarding to a new project, planning refactoring efforts, assessing code for acquisition/migration, or generating documentation for undocumented systems. Analyzes architecture, dependencies, code quality issues, and test coverage. Creates high-level overviews with architecture diagram

105estrelas
Atualizado há 8 meses

Ver no GitHub ↗ Licença: Apache-2.0

Como adicionar

/plugin marketplace add ArabelaTso/Skills-4-SE

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Para o autor da skill

Cole no README do seu repo

Mostra que sua skill está catalogada na Skillteca, gera backlink e tráfego rastreável.

[![Skillteca](https://www.skillteca.com.br/api/badge/legacy-code-summarizer/svg)](https://www.skillteca.com.br/skills/legacy-code-summarizer)

Skills relacionadas

Ver todas de Desenvolvimento →

Alerta por categoria

Receba novas skills de Desenvolvimento toda segunda

1 email curto, só com as skills novas de Desenvolvimento. 4 minutos de leitura, sem spam, cancela com 1 clique.

Você confirma o email no primeiro envio. Sem spam. Cancela com 1 clique.

Ler descrição completa

Legacy Code Summarizer

Analyze and summarize legacy codebases to quickly understand their structure, quality, and improvement opportunities.

Core Capabilities

This skill helps understand legacy code by:

  1. Mapping architecture - Identify key components, layers, and relationships
  2. Analyzing dependencies - Understand module coupling and import patterns
  3. Detecting quality issues - Find code smells, technical debt, and outdated patterns
  4. Assessing test coverage - Identify testing gaps and untested code
  5. Generating documentation - Create actionable summaries for teams

Code Analysis Workflow

Step 1: Survey the Codebase

Get an overview of the project structure and size.

Initial Questions:

  • What programming language(s)?
  • What is the project structure?
  • How large is the codebase?
  • What frameworks/libraries are used?
  • Is there existing documentation?

Commands to Run:

# Count lines of code
find . -name "*.py" | xargs wc -l | tail -1  # Python
find . -name "*.java" | xargs wc -l | tail -1  # Java

# Count files
find . -name "*.py" | wc -l
find . -name "*.java" | wc -l

# Directory structure
tree -L 3 -I '__pycache__|node_modules|target|build'

# Or without tree command
find . -type d -not -path '*/\.*' | head -20

Identify Project Type:

  • Web application (frontend/backend)
  • CLI tool
  • Library/framework
  • Microservice
  • Monolith
  • Desktop application

Step 2: Identify Entry Points

Find where execution starts and main workflows.

Common Entry Points:

Python:

# Find main entry points
grep -r "if __name__ == '__main__':" --include="*.py"

# Find Flask/Django apps
grep -r "app = Flask\|application = " --include="*.py"
grep -r "INSTALLED_APPS\|MIDDLEWARE" --include="*.py"

# Find CLI entry points (setup.py, pyproject.toml)
grep -A 10 "entry_points\|console_scripts" setup.py pyproject.toml

Java:

# Find main methods
grep -r "public static void main" --include="*.java"

# Find Spring Boot applications
grep -r "@SpringBootApplication" --include="*.java"

# Find servlets
grep -r "extends HttpServlet\|@WebServlet" --include="*.java"

JavaScript/TypeScript:

# Check package.json for entry points
cat package.json | grep -A 5 "main\|scripts"

# Find Express apps
grep -r "app = express()\|express()" --include="*.js" --include="*.ts"

# Find React entry points
find . -name "index.js" -o -name "index.tsx" -o -name "App.js"

Step 3: Map Architecture and Components

Understand the high-level structure and key modules.

Analyze Directory Structure:

# List top-level directories
ls -d */ | head -20

# Common patterns to look for:
# - src/ or lib/ (source code)
# - tests/ or test/ (test files)
# - config/ (configuration)
# - docs/ (documentation)
# - scripts/ (utility scripts)
# - models/ or entities/ (data models)
# - views/ or templates/ (UI)
# - controllers/ or handlers/ (business logic)
# - services/ or api/ (external services)
# - utils/ or helpers/ (utilities)

Identify Architecture Pattern:

Common patterns in legacy code:

  • MVC (Model-View-Controller): Django, Rails, Spring MVC
  • Layered: Presentation → Business → Data layers
  • Microservices: Multiple small services
  • Monolith: Single large application
  • Plugin-based: Core + extensions

See references/architecture_patterns.md for detailed pattern identification.

Create Architecture Diagram:

Example Web Application Architecture:

┌─────────────────────────────────────────┐
│          Frontend (React)               │
│  - components/                          │
│  - pages/                               │
│  - hooks/                               │
└───────────────┬─────────────────────────┘
                │ API Calls
                ↓
┌─────────────────────────────────────────┐
│       API Layer (Flask/Express)         │
│  - routes/                              │
│  - middleware/                          │
└───────────────┬─────────────────────────┘
                │
                ↓
┌─────────────────────────────────────────┐
│       Business Logic                    │
│  - services/                            │
│  - controllers/                         │
└───────────────┬─────────────────────────┘
                │
                ↓
┌─────────────────────────────────────────┐
│       Data Layer                        │
│  - models/                              │
│  - repositories/                        │
└───────────────┬─────────────────────────┘
                │
                ↓
┌─────────────────────────────────────────┐
│       Database (PostgreSQL/MongoDB)      │
└─────────────────────────────────────────┘

Step 4: Analyze Dependencies

Map module relationships and identify coupling issues.

Find Direct Dependencies:

Python:

# Find imports in all Python files
grep -rh "^import \|^from " --include="*.py" | sort | uniq

# Analyze requirements
cat requirements.txt

# Or from setup.py
grep -A 20 "install_requires" setup.py

Java:

# Analyze Maven dependencies
cat pom.xml | grep -A 3 "<dependency>"

# Or Gradle
cat build.gradle | grep -A 3 "implementation\|compile"

# Find imports in code
grep -rh "^import " --include="*.java" | sort | uniq | head -50

JavaScript:

# Analyze package.json
cat package.json | grep -A 50 "dependencies"

# Find imports
grep -rh "^import \|require(" --include="*.js" --include="*.ts" | head -50

Create Dependency Map:

Key Internal Dependencies:

auth module
  ├─ depends on: user_model, database, config
  └─ used by: api_routes, admin_panel

user_model
  ├─ depends on: database, validators
  └─ used by: auth, profile, admin

payment module
  ├─ depends on: user_model, external_api, logger
  └─ used by: checkout, subscription

Circular dependencies detected:
  ⚠️  module_a → module_b → module_c → module_a

See references/dependency_analysis.md for tools and techniques.

Step 5: Identify Code Quality Issues

Detect technical debt, code smells, and improvement opportunities.

Common Quality Issues to Look For:

1. Large Files (God Objects)

# Find files over 500 lines
find . -name "*.py" -exec wc -l {} \; | awk '$1 > 500' | sort -rn

# Find files over 1000 lines (serious issue)
find . -name "*.java" -exec wc -l {} \; | awk '$1 > 1000' | sort -rn

2. Dead Code

# Find unused imports (Python - requires tools)
# Install: pip install autoflake
find . -name "*.py" -exec autoflake --check {} \;

# Find TODO/FIXME comments
grep -rn "TODO\|FIXME\|HACK\|XXX" --include="*.py" --include="*.java"

3. Code Duplication

# Find duplicate code (requires tool)
# Install: pip install pylint
pylint --disable=all --enable=duplicate-code src/

# Or use PMD for Java
# pmd cpd --minimum-tokens 100 --files src/

4. Complex Functions

# Find long functions (crude check - look for large blocks)
# Python: Look for functions with many lines between def and next def
# Java: Look for methods with many lines between { and }

# Use complexity tools for accurate analysis:
# Python: radon cc src/ -a
# Java: Use PMD or Checkstyle

5. Missing Documentation

# Find functions without docstrings (Python)
grep -A 1 "^def " --include="*.py" -r . | grep -v '"""' | grep -v "'''"

# Find classes without documentation (Java)
grep -B 1 "^public class\|^class " --include="*.java" -r . | grep -v "/\*\*" | grep -v "//"

6. Outdated Patterns

Look for:

  • Python 2 syntax (e.g., print "hello", raw_input())
  • Java pre-8 patterns (no lambdas, no Optional)
  • Deprecated libraries
  • Security vulnerabilities (SQL injection, XSS)

See references/code_quality_checklist.md for comprehensive quality checks.

Step 6: Assess Test Coverage

Identify testing gaps and quality of existing tests.

Find Tests:

# Python tests
find . -name "test_*.py" -o -name "*_test.py"
ls tests/ test/

# Java t
Compartilhar X LinkedIn