IT & Software
Development Stage
Accelerate Development Tasks with This ChatGPT Prompt for Scripting, Code Translation, and Query Optimization
What This Prompt Does
- Generates custom scripts in Python for tasks like web scraping, data handling, and file operations using best practices and modern libraries.
- Translates code between programming languages while preserving functionality and logic, making it easier for developers to port legacy systems or collaborate across teams.
- Refactors or rewrites SQL queries to improve performance on large datasets by recommending better indexing, query structure, or use of caching/CTEs.
Tips
- For scraping tasks, include specifics such as the target website, structure of data to extract, and whether dynamic content is involved (e.g., JS-rendered pages).
- In code translation prompts, provide the full original code snippet along with details like preferred Python version or style (e.g., object-oriented vs. functional).
- When optimizing SQL, share information about the database type (e.g., PostgreSQL, MySQL, BigQuery), table size, indexes, and query execution plan if possible.
- Ask for comments in the generated code to improve readability and assist with debugging or learning.
- For large projects, break complex prompts into smaller tasks—like asking for just the scraping logic first, then the data transformation pipeline, then error handling, etc.
Prompt
"Write a Python script to scrape data from a website and save it to a JSON file."
"Translate this Java code for a binary search tree into Python."
"Optimize this SQL query for better performance in a large dataset."
How To Use The Prompt
Use these prompts during the development phase, when you’re building out functionality, rewriting cross-language features, or improving system performance. Fill in:
- [SCRIPT PURPOSE]: e.g., scrape blog titles, fetch stock prices, save API data
- [SOURCE LANGUAGE / TARGET LANGUAGE]: e.g., Java to Python, C++ to JavaScript
- [QUERY TYPE]: e.g., SELECT with JOIN, aggregation, subquery with filters
- [ENVIRONMENT]: local dev, production DB, data warehouse
- [OUTPUT FORMAT]: JSON, CSV, console output, database table
- [PERFORMANCE GOAL]: <1s query time, reduce memory usage, improve sort efficiency
Example:
"Script purpose: Scrape book titles and prices from an online bookstore and save them to a JSON file using Python; Environment: Website uses basic HTML (no JavaScript); Output format: JSON array with title, author, price."
Example Input
#INFORMATION ABOUT MY TASKS:
- Web scraping: I want a Python script that uses requests and BeautifulSoup to scrape article headlines from a news homepage and export them to headlines.json.
- Code translation: I have a Java implementation of a binary search tree (BST) and I want it translated into idiomatic Python using classes.
- SQL optimization: I’m using PostgreSQL, and I have a query that performs slow joins on three large tables (~5M rows each). I want to optimize it for read-heavy operations.
Prompt strategy goal: Accelerate development using AI to automate routine or repetitive tasks while learning best practices in Python and SQL.
Additional Information
This set of development-stage mega-prompts is ideal for backend developers, data engineers, and full-stack programmers who want to:
- Speed up script generation, code refactoring, or porting between languages
- Save time on performance optimization for queries and data access logic
- Get AI-assisted support on real-world coding tasks, reducing time-to-solution and boosting productivity
By leveraging these prompts, developers can offload repetitive or time-consuming tasks to ChatGPT, freeing up time for architecture, debugging, or collaboration. It’s an excellent addition to your development toolkit—smart, fast, and practical.
Related Prompts
Ready to Dominate Your Business in 2025?
Get immediate access to...
30,000+ AI prompts
Marketing, business, copywriting, visuals & more.
How-to Guides & resources
Biggest collection of AI resources for your business success.
Unlimited updates
Your resources & knowledge grows, free of charge, forever.
Lifetime access
Highest priority support. Instant delivery.