A curated collection of battle-tested prompts for software development. Copy, paste, adapt.
🐛 Debugging
Review this error and explain the root cause. Then provide a fix with explanation:
[paste error + relevant code]
This function works for most inputs but fails for [specific case].
Analyze why and fix it without changing the function signature:
[paste function]
I'm getting unexpected behavior: [describe what happens vs what should happen].
Here's my code. Find the bug:
[paste code]
This code has a memory leak. Find it and explain how to fix it:
[paste code]
Why does this SQL query return wrong results? Show the correct query and explain the difference:
[paste query + expected vs actual results]
💻 Code Writing
Write a [language] function that [specific behavior].
Requirements:
- Input: [describe input]
- Output: [describe output]
- Handle edge cases: [list them]
- Include type hints and docstring
Convert this [language A] code to [language B]. Maintain the same logic and error handling:
[paste code]
Write a REST API endpoint in [framework] that:
- Accepts [HTTP method] requests at /[path]
- Validates input: [describe schema]
- Returns: [describe response]
- Handles errors: [list error cases]
Create a database migration that:
- Adds [columns/tables]
- Handles existing data: [describe migration strategy]
- Is reversible
- Works with [PostgreSQL/MySQL/SQLite]
Write unit tests for this function. Cover:
- Happy path
- Edge cases: [list them]
- Error conditions
- Use [testing framework]
[paste function]
🔍 Code Review
Review this code for:
1. Bugs and logical errors
2. Security vulnerabilities (OWASP top 10)
3. Performance issues
4. Code style and readability
Rate each issue as Critical/Warning/Suggestion.
[paste code]
Review this pull request diff. Focus on:
- Breaking changes
- Missing error handling
- Race conditions
- Test coverage gaps
[paste diff]
Is this code production-ready? What would you change before deploying?
[paste code]
🏗 Architecture & Design
I'm building [describe system]. Current tech stack: [list].
Design the system architecture. Include:
- Component diagram
- Data flow
- API contracts
- Database schema
- Scaling considerations
Compare these approaches for [problem]:
Approach A: [describe]
Approach B: [describe]
Evaluate: performance, maintainability, complexity, scaling. Recommend one with reasoning.
Design a database schema for [describe application].
Requirements: [list requirements]
Consider: indexes, relationships, normalization, query patterns.
Output as SQL CREATE statements.
I need to add [feature] to an existing [type] application.
Current architecture: [describe]
Constraints: [list]
Propose the implementation plan with file changes and estimated effort.
📝 Documentation
Write API documentation for this endpoint. Include:
- Description
- Request format (headers, body, params)
- Response format (success + error cases)
- Example curl command
- Rate limits if applicable
[paste endpoint code]
Write a README.md for this project:
- What it does: [describe]
- Tech stack: [list]
- Include: installation, usage, configuration, contributing sections
- Tone: professional but approachable
Generate JSDoc/docstring comments for all public functions in this file.
Focus on: purpose, params, return value, exceptions, usage example.
[paste file]
⚡ Performance
Profile this code for performance bottlenecks. Suggest optimizations with expected improvement:
[paste code]
This SQL query is slow on a table with [X] million rows. Optimize it.
Current indexes: [list]
Explain your changes and suggest additional indexes.
[paste query]
Rewrite this code to handle [X] concurrent requests. Current version handles [Y].
Constraints: [memory/CPU limits]
[paste code]
🔒 Security
Audit this code for security vulnerabilities. Check for:
- SQL injection
- XSS
- CSRF
- Authentication/authorization flaws
- Sensitive data exposure
- Insecure dependencies
For each issue, show the vulnerable line and the fix.
[paste code]
Generate a Content Security Policy for a web app that:
- Uses [CDNs]
- Loads fonts from [source]
- Makes API calls to [domains]
- Uses inline styles: [yes/no]
🚀 DevOps & Infrastructure
Write a Dockerfile for a [language/framework] application.
Requirements:
- Multi-stage build
- Non-root user
- Minimal image size
- Health check
- Environment variable configuration
Write a GitHub Actions workflow that:
- Triggers on: [events]
- Steps: [list build/test/deploy steps]
- Uses caching for [dependencies]
- Deploys to [target]
Write a docker-compose.yml for a development environment with:
- [App framework] on port [X]
- [Database] with persistent volume
- [Cache/queue service]
- Hot reload enabled
🧠 Learning & Explanation
Explain [concept] like I'm a [junior/mid/senior] developer.
Use a real-world analogy, then show a code example in [language].
What's the difference between [A] and [B] in [language/framework]?
Show examples of when to use each.
I don't understand this code. Walk me through it line by line, explaining what each part does and why:
[paste code]
📊 Data & Analysis
Write a Python script to:
1. Read data from [source/format]
2. Clean: [describe transformations]
3. Analyze: [describe metrics]
4. Visualize: [describe charts]
5. Export results to [format]
Use pandas and matplotlib.
Write a SQL query to analyze [describe what you want to know].
Tables: [describe schema]
Group by: [dimension]
Filter: [conditions]
Include percentage calculations and running totals.
🔄 Refactoring
Refactor this code following [SOLID/DRY/clean code] principles.
Keep the same external behavior. Explain each change.
[paste code]
This function is too long ([X] lines). Split it into smaller, testable functions.
Maintain the same public interface.
[paste function]
Migrate this code from [old pattern/library] to [new pattern/library].
Preserve all functionality and error handling.
[paste code]
💬 Git & Collaboration
Write a commit message for these changes. Follow conventional commits format:
[paste diff]
Write a pull request description for these changes:
- What: [summarize]
- Why: [motivation]
- Include: testing notes, migration steps, screenshots needed
[paste diff or description]
Tips for Better Results
- Be specific. "Write a function" → "Write a Python 3.12 async function that..."
- Provide context. Share your tech stack, constraints, and existing code patterns.
- Iterate. First response not perfect? Say "Make it more [specific quality]."
- Set the role. Start with "You are a senior [X] developer with expertise in [Y]."
- Ask for tradeoffs. "What are the downsides of this approach?"
Get ChatGPT Plus at ios.mom for the best experience with these prompts — GPT-5.6 handles complex developer prompts significantly better than the free tier.
Found this useful? Star the gist and share with your team. I update it monthly with new prompts.
Top comments (0)