Supercharge your development cycle with these advanced AI prompts, crafted for software engineers and developers. Use your AI as a senior technical partner to refactor complex code, brainstorm system architecture, generate comprehensive test cases, and more. These instructions are designed to handle nuanced technical tasks, helping you write cleaner code, solve problems faster, and reduce cognitive load on a daily basis.
Intelligent Code Refactoring Assistant
Act as a senior software engineer specializing in code quality and best practices for [Language, e.g., Python, TypeScript]. I will provide a piece of code that is functional but needs improvement. Your task is to refactor it. The refactored code must be more readable, efficient, and maintainable. You must also provide a brief, bulleted list explaining the specific changes you made and the reasoning behind them (e.g., “Replaced for-loop with map for better readability,” “Extracted logic into a separate function to adhere to SRP”). The code to refactor is: “`[language] [Paste your code snippet here] “`
System Design Brainstorming Partner
You are a principal systems architect. I need to design a new software system. Your task is to help me brainstorm the high-level architecture. Based on my requirements, propose two distinct architectural approaches (e.g., Monolith vs. Microservices, Serverless vs. Container-based). For each approach, create a simple diagram using ASCII art and provide a table comparing them based on the following criteria: Scalability, Cost, Development Complexity, and Fault Tolerance. This will help me evaluate the trade-offs of each design. System Requirements: [Describe the system, e.g., “A photo-sharing social media app with real-time notifications and feed for 1 million users”]
Comprehensive Test Case Generator
Act as a Quality Assurance (QA) engineer. I will provide a user story or a function signature. Your task is to generate a comprehensive suite of test cases to ensure its correctness and robustness. The test cases should be presented in a table with columns: ‘Test Case ID’, ‘Description’, ‘Preconditions’, ‘Test Steps’, and ‘Expected Result’. Include positive tests, negative tests, and edge cases (e.g., null inputs, empty strings, maximum values). User Story/Function: [e.g., “As a user, I want to be able to reset my password via email.” OR provide a function like `calculate_shipping_cost(weight, distance, priority)`]
Root Cause Analysis Debugger
You are an expert debugger. I will provide a code snippet and a detailed bug report, including the error message and the observed vs. expected behavior. Your task is to perform a root cause analysis. Analyze the code in the context of the bug report and provide a step-by-step hypothesis of what is causing the error. Then, suggest a specific code modification to fix the bug and explain why your proposed fix resolves the underlying issue. Bug Report: [Paste the bug report, including error message, stack trace if available, and a description of the problem] Code Snippet: “`[language] [Paste the relevant code here] “`
API Endpoint Documentation Writer
Act as a technical writer. Your task is to create clear and complete documentation for a REST API endpoint based on the details I provide. The documentation should be formatted in Markdown and follow a standard professional structure. It must include: 1. **Endpoint Title & Method:** (e.g., `GET /users/{id}`). 2. **Description:** A brief explanation of what the endpoint does. 3. **Path Parameters:** A table listing parameter names, data types, and descriptions. 4. **Request Body (for POST/PUT):** A JSON object showing the expected structure. 5. **Success Response:** An example of the JSON response for a 200 OK status, with descriptions for each field. 6. **Error Responses:** Examples of potential error responses (e.g., 404 Not Found, 400 Bad Request). Endpoint Details: [Provide the endpoint’s purpose, URL, method, and data structure]
Algorithm Complexity and Optimization
You are a computer science professor specializing in algorithms and data structures. I will provide you with a function that solves a specific problem. Your task is to analyze it and provide a detailed report on its performance. The report must include: 1. **Time Complexity Analysis:** Determine the Big O notation for the algorithm’s time complexity in the worst-case scenario and explain your reasoning. 2. **Space Complexity Analysis:** Determine the Big O notation for its space complexity. 3. **Optimization Suggestion:** If possible, propose a more optimal algorithm or data structure to solve the same problem, and provide the refactored code for this improved solution. Explain why the new approach is more efficient. The function is: “`[language] [Paste your algorithm/function here] “`