ChatGPT Prompts for Solo Developer Debugging & Shipping
As a solo developer, you wear all the hats. Speed up your workflow with these expert ChatGPT prompts designed for debugging, refactoring, and shipping code faster. Use ChatBoost to access these prompts instantly and turn ChatGPT into your personal AI debugging assistant, helping you solve complex problems and push features with confidence.
Paste a stack trace to get a detailed explanation of the error's origin and potential causes.
Act as a senior software engineer. I'm debugging an issue. Here is the full stack trace from my application. Analyze it, explain the root cause of the error in simple terms, and suggest three potential solutions in order of likelihood.
Stack Trace:...
Explain This Cryptic Error
Demystify a cryptic error message by getting a plain-English explanation and common solutions.
I encountered this error message and I don't fully understand it. Explain what this error means, what the common causes are, and provide a code example of how to fix it.
Error Message: `[PASTE ERROR MESSAGE HERE]`...
Suggest Debugging Steps
Provide a code snippet and error, and get a step-by-step plan to debug the issue effectively.
My code is not working as expected. It's supposed to [describe expected behavior], but instead it [describe actual behavior]. Provide a step-by-step debugging plan, including where to add log statements or breakpoints to isolate the issue.
My Code:...
Identify Potential Race Conditions
Analyze a piece of concurrent code to find potential race conditions or deadlocks.
Review the following concurrent code for potential race conditions, deadlocks, or other concurrency issues. For each issue you find, explain the scenario where it would occur and suggest a fix using locks, mutexes, or other synchronization primitives.
Code:...
Find Logical Errors in Algorithm
Review an algorithm's implementation to spot subtle logical flaws that tests might miss.
I have implemented the following algorithm, but I suspect there is a logical error. Please review the code, explain its logic step-by-step, and identify any potential flaws, off-by-one errors, or incorrect assumptions.
Algorithm Description: [e.g., 'A binary search algorithm']...
Refactor to SOLID Principles
Analyze a class or module and suggest refactoring changes to better adhere to SOLID principles.
Act as a software architect. Analyze the following class and suggest how to refactor it to better adhere to SOLID principles (Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion). Provide the 'before' and 'after' code with explanations for each change.
Class:...
Simplify Complex Conditional Logic
Untangle a nested if/else or switch statement into a cleaner, more readable structure.
This function has complex nested conditional logic that is hard to read and maintain. Refactor it to be simpler and more declarative. You can use techniques like guard clauses, polymorphism, or lookup tables. Explain your reasoning.
Original Function:...
Identify Performance Bottlenecks
Review a function or code block and suggest potential performance optimizations.
Analyze the following code for potential performance bottlenecks. Identify areas that could be slow due to inefficient algorithms, unnecessary loops, or expensive operations. For each bottleneck, suggest a more performant alternative with a code example.
Code to Analyze:...
Extract Reusable Function
Identify repeated logic in a code block and suggest how to extract it into a reusable function.
I have some duplicated logic in my code. Analyze the provided snippet, identify the repeated pattern, and refactor it by extracting the logic into a new, reusable function. Show the new function and how the original code would be updated to use it.
Code with Duplication:...
Generate Unit Tests (Jest/Pytest)
Create a comprehensive suite of unit tests for a given function, covering edge cases.
I need to write unit tests for the following function using the [Jest/Pytest/JUnit] framework. Please generate a complete test file that includes tests for the happy path, edge cases (e.g., null inputs, empty arrays), and potential error conditions.
Function to Test:...
Generate Edge Case Scenarios
Brainstorm a list of non-obvious edge cases and inputs to test a specific function against.
Brainstorm a list of edge cases and tricky inputs to test for the following function. Think about data types, empty values, maximum/minimum values, and unexpected formats.
Function:...
Create Mock Data for Tests
Generate realistic mock data (e.g., JSON objects, arrays) to use in your test suites.
Generate a realistic mock JSON object (or array of objects) to be used in tests. The object should represent a `[e.g., UserProfile, Product, Order]` and include the following fields with realistic fake data: [list fields like 'id: UUID', 'name: string', 'email: email', 'createdAt: ISO8601 timestamp']. Generate 5 objects in an array.
Convert User Story to BDD Tests
Translate a user story into Gherkin syntax for Behavior-Driven Development (BDD) tests.
Translate the following user story into a BDD feature file using Gherkin syntax (Given/When/Then). Include scenarios for both success and failure cases.
User Story:...
Generate Function Docstrings
Automatically create detailed docstrings for a function, including parameters, return values, and examples.
Generate a comprehensive docstring for the following function in [JSDoc/Google Python/NumPy] format. Include a brief description, details for each parameter (`@param`), the return value (`@returns`), and a clear usage example.
Function:...
Write README.md Section
Draft a specific section for your project's README, such as 'Installation' or 'Usage'.
My project is a [describe project, e.g., 'command-line tool for processing images']. Write the 'Installation' section for my `README.md` file. It should include steps for cloning the repository and installing dependencies using [npm/pip/maven].
Explain Code in Plain English
Generate a clear, high-level explanation of what a complex piece of code does for documentation purposes.
Explain the following code snippet in plain English, as if you were explaining it to a non-technical project manager. Focus on the 'what' and 'why', not the 'how'.
Code:...
Create API Endpoint Documentation
Write clear documentation for a REST API endpoint, including the request, response, and error codes.
Generate API documentation in Markdown for the following endpoint:
- **Endpoint:** `POST /api/v1/users`...
Perform a Virtual Code Review
Act as a senior developer and review a code snippet for issues related to style, security, and best practices.
Act as a senior developer performing a code review on the following pull request. Check for issues related to code style, readability, potential bugs, security vulnerabilities, and adherence to best practices for [LANGUAGE]. Provide your feedback as a list of constructive comments.
Code:...
Check for Security Vulnerabilities
Scan a piece of code for common security vulnerabilities like XSS, SQL injection, or insecure defaults.
Analyze the following code snippet for common security vulnerabilities (e.g., SQL Injection, XSS, insecure direct object references, hardcoded secrets). For each vulnerability found, explain the risk and suggest a secure way to rewrite the code.
Code:...
Improve Code Readability
Suggest changes to variable names, comments, and structure to make a function easier to understand.
The following code works, but it's difficult to read. Suggest specific changes to improve its readability. Focus on better variable names, extracting complex logic into helper functions, and adding clarifying comments where necessary. Provide a 'before' and 'after' version.
Code:...
Ensure Idiomatic Code Style
Refactor code to follow the idiomatic conventions of its programming language (e.g., Pythonic, idiomatic Go).
Rewrite the following [LANGUAGE] code to be more idiomatic. The current code is written in a style more common to [OTHER LANGUAGE, e.g., Java]. Make it follow the conventions and best practices of the [LANGUAGE] community.
Original Code:...
Create a Database Migration Plan
Outline the steps and potential risks for migrating a database schema from one version to another.
I need to create a database migration plan. The change involves [describe the change, e.g., 'adding a non-nullable `user_id` column to the `orders` table']. Outline the steps for a safe migration with zero downtime. Include the forward migration script, the rollback script, and a list of potential risks to consider.
Generate a Deployment Checklist
Create a pre-flight checklist to ensure all steps are covered before deploying a new version to production.
Generate a detailed deployment checklist for a [e.g., Node.js web application with a PostgreSQL database]. The checklist should cover pre-deployment, deployment, and post-deployment steps. Include items like running final tests, backing up the database, deploying code, running migrations, and monitoring for errors.
Draft Release Notes from Commits
Summarize a list of git commit messages into user-friendly release notes for your next software version.
Act as a technical writer. Read the following list of git commit messages and summarize them into user-friendly release notes for version `v1.2.0`. Group the changes into categories like '✨ New Features', '🐛 Bug Fixes', and '⚙️ Improvements'.
Commit Messages:...
Plan a Framework Upgrade
Outline the steps, breaking changes, and testing strategy for upgrading a major framework.
I need to plan an upgrade of my project from [e.g., Next.js 12 to Next.js 13]. Create a high-level plan that outlines the major steps. The plan should include:
1. A list of key breaking changes to look out for.
2. A recommended sequence of steps for the upgrade process....
Write a Rollback Procedure
Create a clear, step-by-step procedure for rolling back a failed deployment.
Create a step-by-step rollback procedure for a failed deployment of my [e.g., Dockerized web app on AWS]. The procedure should be clear and easy to follow under pressure. Include steps for reverting the code, rolling back database migrations, and communicating the status to stakeholders.
Turn these prompts into a reusable workspace
Save your favourite prompts once, reuse them with Alt+P, keep a live Table of Contents of long chats, and export conversations when you're done.