P
🤖AutomatisationAdvanced5 steps

Codebase Migration Agent (Python 2 to 3, JavaScript to TypeScript)

This agent orchestrates the complete migration of a codebase between technologies: Python 2 to Python 3 or JavaScript to TypeScript. It analyzes the existing source code, identifies incompatibilities and obsolete patterns, generates a prioritized migration plan, then produces the migrated code file by file with corresponding unit tests.

migration de coderefactoringPythonTypeScriptautomatisation

For who

Developers and tech leads needing to migrate a legacy codebase to a modern language version, seeking to automate and make the process more reliable.

Input

Type: text
Format: code

Code source à migrer (fichiers Python 2 ou JavaScript), avec indication du type de migration souhaité (Python 2→3 ou JS→TS)

steps (5)

1

Source Code Audit and Mapping

prompt

Analyzes existing code to identify all incompatibilities and dependencies to migrate.

2

Prioritized Migration Plan

prompt

Generates an ordered migration plan with file dependencies and optimal processing order.

3

File-by-File Code Migration

prompt

Applies migration transformations on each file following the established plan.

4

Non-Regression Test Generation

prompt

Creates a test suite verifying that migrated code behavior is identical to the original.

5

Final Report and Deployment Guide

prompt

Synthesizes the migration with a complete report and deployment instructions.

Output

Type: text
Format: structuré

Code migré complet, suite de tests de non-régression, changelog détaillé des transformations, et rapport de migration avec guide de déploiement

Example

Input

Python 2 to 3 migration of a data processing module:

```python
# utils.py
import urllib2
import ConfigParser
from StringIO import StringIO

def fetch_data(url):
    response = urllib2.urlopen(url)
    return response.read()

def parse_config(path):
    config = ConfigParser.SafeConfigParser()
    config.read(path)
    return dict(config.items('main'))

def process_items(items):
    results = filter(lambda x: x > 0, items)
    for key, value in {}.iteritems():
        print key, value
    return map(str, results)
```

Output

**Migrated code (utils.py)**:
```python
import urllib.request
import configparser
from io import StringIO

def fetch_data(url: str) -> bytes:
    response = urllib.request.urlopen(url)
    return response.read()

def parse_config(path: str) -> dict[str, str]:
    config = configparser.ConfigParser()
    config.read(path)
    return dict(config.items('main'))

def process_items(items: list[int]) -> list[str]:
    results = [x for x in items if x > 0]
    for key, value in {}.items():
        print(key, value)
    return [str(x) for x in results]
```

**Changelog**: 6 transformations applied (3 renamed imports, 1 print to print(), 1 iteritems to items, 1 filter/map to list comprehension). **Tests**: 4 functional parity tests generated. **Confidence**: 95%.

Customization

ParameterDescriptionDefault
migration_typeType de migration Ă  effectuer : Python 2 vers Python 3, ou JavaScript vers TypeScriptpython2-to-python3
strategieStratégie de migration : 'conservative' (comportement identique garanti) ou 'modern' (adoption des patterns modernes idiomatiques)modern
strictness_levelNiveau de strictness pour le typage en cible : 'loose' (any autorisé), 'moderate' (any limité), 'strict' (zéro any, types exhaustifs)moderate

Technical Notes

This agent works optimally on moderately sized modules (< 500 lines per file). For large codebases, proceed in batches by submitting files module by module following the dependency order.

For Python 2 to 3 migrations, the agent handles major incompatibilities: print, unicode/bytes, renamed imports, iterators, integer division, and syntax changes. Advanced metaprogramming cases (metaclasses, custom descriptors) require human review.

For JS to TS migrations, the agent infers types from context and usage. Provide existing type files (@types/) and API interfaces for more precise typing. Enable strict mode for critical projects.

Related Prompts

⚡ProductiviteIntermediateAll AIs

Perplexity Prompt for Optimizing a Workflow

Perplexity AI stands out for its ability to combine real-time web search and intelligent synthesis, making it a formidable tool for optimizing your professional workflows. Whether you're looking to eliminate bottlenecks in your production chain, automate repetitive tasks, or identify best practices in your industry, Perplexity can analyze dozens of sources simultaneously to provide actionable recommendations. Unlike a traditional search engine, Perplexity understands the context of your request and structures its responses to save you considerable time. Optimizing a workflow is not just about speeding up individual steps: it's about rethinking the entire process using concrete data, documented feedback, and proven tools. The prompt we propose here is designed to extract from Perplexity a comprehensive and personalized analysis of your workflow, with prioritized recommendations and tracking metrics. You will get a structured action plan directly applicable to your professional context.

0283
⚡ProductiviteAdvancedAll AIs

Preprocessing Pipeline

Automate preprocessing

0293
⚡ProductiviteBeginnerAll AIs

Define Your Value Proposition

To clarify your messaging and market differentiation

0216
⚡ProductiviteIntermediateChatGPT

ChatGPT Prompt to Create a FAQ

Creating a relevant and comprehensive FAQ requires a deep understanding of your audience and their concerns. ChatGPT radically transforms this process by allowing you to generate structured questions and answers, anticipating your users' real queries. Rather than guessing what your visitors are looking for, you can leverage the model's ability to analyze a business context and produce natural questions, phrased as a real customer would ask. Whether you are building a FAQ for an e-commerce site, a SaaS, a customer service page, or technical documentation, ChatGPT helps you cover all angles: basic questions, frequent objections, edge cases, and technical concerns. The result is a FAQ that actually reduces your support load, improves your SEO through schema FAQ markup, and guides your visitors toward conversion. In this guide, you will find one main optimized prompt along with three variants tailored to your level of requirement, allowing you to produce professional FAQs in minutes instead of hours.

0313