50 ChatGPT Prompts for Developers (Copy & Paste)
Ready-to-use ChatGPT prompts for coding, debugging, code review, documentation, and more. Copy, paste, and boost your development productivity.
Stop typing the same prompts over and over. We have collected 50 battle-tested prompts that actually work for real development tasks.
Each prompt is ready to copy and paste. Just replace the placeholders with your specifics and get useful results immediately.
Pro tip: Use Vocoding to speak these prompts instead of typing them. Our voice-first platform uses 237+ specialized agents to optimize your spoken instructions for AI tools like ChatGPT, Claude, and Cursor.
Table of Contents
- Code Generation Prompts
- Debugging Prompts
- Code Review Prompts
- Refactoring Prompts
- Documentation Prompts
- Testing Prompts
- Architecture Prompts
- DevOps Prompts
- Learning Prompts
- Performance Prompts
Code Generation Prompts
Prompt 1: Create a Function
Create a [LANGUAGE] function that [DESCRIPTION].
Requirements:
- Input: [INPUT_PARAMS]
- Output: [OUTPUT_TYPE]
- Handle edge cases: [EDGE_CASES]
- Follow [STYLE_GUIDE] conventions
Include type annotations and brief JSDoc/docstring comments.
Example:
Create a TypeScript function that validates email addresses.
Requirements:
- Input: email string
- Output: boolean
- Handle edge cases: empty string, null, unicode characters
- Follow Google TypeScript conventions
Include type annotations and brief JSDoc comments.
Prompt 2: Create a React Component
Create a React component called [COMPONENT_NAME] that [DESCRIPTION].
Props:
- [PROP_NAME]: [TYPE] - [DESCRIPTION]
Features:
- [FEATURE_1]
- [FEATURE_2]
- [FEATURE_3]
Use: TypeScript, functional components, and [CSS_APPROACH].
Include proper accessibility attributes.
Example:
Create a React component called UserCard that displays a user profile.
Props:
- user: User - the user object with name, avatar, and bio
- onClick: () => void - callback when card is clicked
Features:
- Displays avatar with fallback for missing images
- Truncates bio to 100 characters with ellipsis
- Shows online status indicator
Use: TypeScript, functional components, and Tailwind CSS.
Include proper accessibility attributes.
Prompt 3: Create an API Endpoint
Create a [FRAMEWORK] API endpoint for [RESOURCE].
Method: [HTTP_METHOD]
Path: [PATH]
Auth: [AUTH_TYPE]
Request body: [REQUEST_SCHEMA]
Response: [RESPONSE_SCHEMA]
Include:
- Input validation
- Error handling with proper status codes
- [ADDITIONAL_REQUIREMENTS]
Example:
Create a Next.js API endpoint for user registration.
Method: POST
Path: /api/auth/register
Auth: None (public endpoint)
Request body: { email: string, password: string, name: string }
Response: { user: User, token: string }
Include:
- Input validation with Zod
- Error handling with proper status codes
- Password hashing with bcrypt
- Rate limiting considerations
Prompt 4: Create a Database Query
Write a [DATABASE] query that [DESCRIPTION].
Tables involved:
- [TABLE_1]: [COLUMNS]
- [TABLE_2]: [COLUMNS]
Requirements:
- [REQUIREMENT_1]
- [REQUIREMENT_2]
Optimize for: [OPTIMIZATION_GOAL]
Example:
Write a PostgreSQL query that finds the top 10 customers by order value this month.
Tables involved:
- customers: id, name, email, created_at
- orders: id, customer_id, total, status, created_at
Requirements:
- Only include completed orders
- Include customer name and email
- Show total order count and sum
Optimize for: Query performance on large datasets
Prompt 5: Create a CLI Command
Create a [LANGUAGE] CLI tool that [DESCRIPTION].
Commands:
- [COMMAND_1]: [DESCRIPTION]
- [COMMAND_2]: [DESCRIPTION]
Global options:
- [OPTION_1]
- [OPTION_2]
Include: Help text, error handling, and colored output.
Example:
Create a Node.js CLI tool that manages environment variables.
Commands:
- get [key]: Retrieve a specific variable
- set [key] [value]: Set or update a variable
- list: Show all variables
- delete [key]: Remove a variable
Global options:
- --env [name]: Specify environment (dev/staging/prod)
- --file [path]: Use custom .env file
Include: Help text, error handling, and colored output.
Debugging Prompts
Prompt 6: Fix a Bug
I'm getting this error:
[ERROR_MESSAGE]
Code:
```[LANGUAGE]
[CODE]
What I expected: [EXPECTED_BEHAVIOR] What happened: [ACTUAL_BEHAVIOR]
Environment: [ENV_DETAILS]
Help me understand and fix this issue.
---
### Prompt 7: Explain an Error
Explain this error message in simple terms:
[ERROR_MESSAGE]
Context: [WHAT_YOU_WERE_DOING]
What does this mean? What are the common causes? How do I fix it?
---
### Prompt 8: Debug Asynchronous Code
This async code isn't working as expected:
[CODE]
Expected flow: [EXPECTED] Actual behavior: [ACTUAL]
Help me identify race conditions, missing awaits, or other async issues.
---
### Prompt 9: Memory Leak Investigation
I suspect a memory leak in this code:
[CODE]
Symptoms: [SYMPTOMS]
Analyze this code for:
- Potential memory leaks
- Unclosed resources
- Event listener issues
- Circular references
Suggest fixes for each issue found.
---
### Prompt 10: Debug Network Request
This API request is failing:
[CODE]
Request URL: [URL] Expected response: [EXPECTED] Actual response: [ACTUAL]
Headers sent: [HEADERS] Status code: [STATUS]
Help me debug this network issue.
---
<h2 id="code-review">Code Review Prompts</h2>
### Prompt 11: General Code Review
Review this code for:
- Bugs and potential issues
- Security vulnerabilities
- Performance problems
- Code style and best practices
- Edge cases not handled
[CODE]
Provide specific, actionable feedback with code examples where helpful.
---
### Prompt 12: Security Review
Perform a security review of this code:
[CODE]
Check for:
- Injection vulnerabilities (SQL, XSS, command)
- Authentication/authorization issues
- Sensitive data exposure
- Input validation problems
- Secure defaults
Rate each finding by severity (Critical/High/Medium/Low).
---
### Prompt 13: Performance Review
Review this code for performance issues:
[CODE]
Context: [EXPECTED_USAGE]
Analyze:
- Time complexity
- Space complexity
- N+1 query problems
- Unnecessary computations
- Caching opportunities
Suggest optimizations with estimated impact.
---
### Prompt 14: Accessibility Review
Review this React component for accessibility:
[CODE]
Check for:
- ARIA attributes
- Keyboard navigation
- Focus management
- Screen reader compatibility
- Color contrast issues
- Semantic HTML
Provide WCAG 2.1 compliant fixes.
---
### Prompt 15: Pull Request Review
I need to review this pull request. The changes:
[DIFF]
PR Description: [DESCRIPTION]
Provide a thorough review including:
- Does it achieve the stated goal?
- Are there any bugs?
- Is the code maintainable?
- Are there missing tests?
- Any security concerns?
Format as GitHub PR review comments.
---
<h2 id="refactoring">Refactoring Prompts</h2>
### Prompt 16: Extract Function
Extract reusable functions from this code:
[CODE]
Goals:
- Improve readability
- Reduce duplication
- Make functions single-purpose
- Improve testability
Show the refactored code with extracted functions.
---
### Prompt 17: Simplify Complex Logic
Simplify this complex logic while preserving behavior:
[CODE]
Make it:
- More readable
- Easier to understand at a glance
- Better documented
Explain the simplifications made.
---
### Prompt 18: Convert to Modern Syntax
Convert this code to modern [LANGUAGE] syntax:
[CODE]
Use features like: [LIST_MODERN_FEATURES]
Ensure the behavior remains identical.
**Example for JavaScript:**
Convert this code to modern JavaScript syntax:
[OLD_CODE]
Use features like:
- Arrow functions
- Template literals
- Destructuring
- Optional chaining
- Nullish coalescing
- Async/await
Ensure the behavior remains identical.
---
### Prompt 19: Apply Design Pattern
Refactor this code to use the [PATTERN_NAME] pattern:
[CODE]
Context: [WHY_THIS_PATTERN]
Show:
- The refactored code
- How to use it
- Benefits gained
**Example:**
Refactor this code to use the Repository pattern:
[DATABASE_ACCESS_CODE]
Context: We need to abstract database access for easier testing and potential future migration.
Show:
- The refactored code
- How to use it
- Benefits gained
---
### Prompt 20: Remove Code Smells
Identify and fix code smells in this code:
[CODE]
Look for:
- Long methods
- Large classes
- Duplicate code
- Dead code
- Magic numbers
- Deep nesting
- Feature envy
Refactor to address each smell.
---
<h2 id="documentation">Documentation Prompts</h2>
### Prompt 21: Generate README
Generate a README.md for a project with these details:
Name: [PROJECT_NAME] Description: [DESCRIPTION] Tech stack: [TECHNOLOGIES] Key features: [FEATURES]
Include:
- Installation instructions
- Usage examples
- Configuration options
- Contributing guidelines
- License
Format for GitHub with badges.
---
### Prompt 22: Document an API
Generate API documentation for this endpoint:
[CODE]
Include:
- Endpoint URL and method
- Request parameters
- Request body schema
- Response schema
- Error codes
- Example request/response
- Rate limiting info
Format as Markdown suitable for developer docs.
---
### Prompt 23: Write JSDoc/Docstrings
Add comprehensive documentation to this code:
[CODE]
Include:
- Function/class descriptions
- Parameter types and descriptions
- Return types and descriptions
- Example usage
- Thrown exceptions/errors
Use [JSDOC/GOOGLE/NUMPY] style.
---
### Prompt 24: Generate Changelog
Based on these commits, generate a CHANGELOG entry:
Commits: [COMMIT_LIST]
Format: Keep a Changelog (https://keepachangelog.com) Version: [VERSION] Date: [DATE]
Categories: Added, Changed, Deprecated, Removed, Fixed, Security
---
### Prompt 25: Write Technical Spec
Write a technical specification for: [FEATURE_NAME]
Context: [BACKGROUND] Goal: [OBJECTIVE]
Include:
- Overview
- Technical approach
- API changes
- Database changes
- Dependencies
- Testing strategy
- Rollout plan
- Risks and mitigations
Format for engineering team review.
---
<h2 id="testing">Testing Prompts</h2>
### Prompt 26: Generate Unit Tests
Generate unit tests for this code:
[CODE]
Use: [TEST_FRAMEWORK]
Cover:
- Happy path
- Edge cases
- Error handling
- Boundary conditions
Include setup/teardown if needed.
---
### Prompt 27: Generate Integration Tests
Generate integration tests for this API endpoint:
[CODE]
Test scenarios:
- Valid requests
- Invalid input
- Authentication
- Authorization
- Rate limiting
- Error responses
Use: [TEST_FRAMEWORK] Include database setup/teardown.
---
### Prompt 28: Generate Mock Data
Generate realistic mock data for testing:
Schema:
[SCHEMA]
Generate:
- [N] valid records
- [M] edge case records
- [P] invalid records (for error testing)
Format: [FORMAT]
**Example:**
Generate realistic mock data for testing:
Schema:
interface User {
id: string;
email: string;
name: string;
role: 'admin' | 'user' | 'guest';
createdAt: Date;
metadata: Record<string, unknown>;
}
Generate:
- 10 valid records
- 5 edge case records (long names, unicode, etc.)
- 5 invalid records (for error testing)
Format: TypeScript constants
---
### Prompt 29: Create Test Plan
Create a test plan for: [FEATURE_NAME]
Feature description: [DESCRIPTION]
Include:
- Test objectives
- Test scope (in/out)
- Test cases by category
- Test data requirements
- Environment requirements
- Exit criteria
Format as a checklist.
---
### Prompt 30: Fix Flaky Test
This test is flaky (intermittently fails):
[TEST_CODE]
Failure message when it fails: [ERROR]
Help me identify the flakiness cause and fix it. Consider: timing issues, shared state, environment dependencies.
---
<h2 id="architecture">Architecture Prompts</h2>
### Prompt 31: Design System Architecture
Design the architecture for: [SYSTEM_NAME]
Requirements:
- [REQ_1]
- [REQ_2]
- [REQ_3]
Scale: [EXPECTED_SCALE] Constraints: [CONSTRAINTS]
Provide:
- High-level architecture diagram (describe)
- Component breakdown
- Data flow
- Technology recommendations
- Trade-offs considered
---
### Prompt 32: Database Schema Design
Design a database schema for: [DOMAIN]
Entities:
Requirements:
- [REQUIREMENT_1]
- [REQUIREMENT_2]
Include:
- Table definitions
- Relationships
- Indexes
- Constraints
Optimize for: [READ_HEAVY/WRITE_HEAVY/BALANCED]
---
### Prompt 33: API Design
Design a REST API for: [RESOURCE]
Operations needed:
- [OP_1]
- [OP_2]
- [OP_3]
Considerations:
- Authentication method
- Pagination approach
- Versioning strategy
- Error format
Provide endpoint definitions with request/response examples.
---
### Prompt 34: Microservices Breakdown
Help me break down this monolith into microservices:
Current modules:
Concerns:
- [CONCERN_1]
- [CONCERN_2]
Suggest:
- Service boundaries
- Data ownership
- Communication patterns
- Shared components
- Migration strategy
---
### Prompt 35: Choose Technology Stack
Help me choose a technology stack for: [PROJECT_TYPE]
Requirements:
- [REQ_1]
- [REQ_2]
- [REQ_3]
Team expertise: [LANGUAGES/FRAMEWORKS] Timeline: [TIMELINE] Scale expectations: [SCALE]
Compare options and recommend with justification.
---
<h2 id="devops">DevOps Prompts</h2>
### Prompt 36: Write Dockerfile
Create a Dockerfile for a [LANGUAGE] [APP_TYPE] application.
Requirements:
- Multi-stage build
- Non-root user
- Minimal image size
- [ADDITIONAL_REQUIREMENTS]
Base image preference: [IMAGE]
---
### Prompt 37: Create CI/CD Pipeline
Create a [CI_PLATFORM] pipeline for a [PROJECT_TYPE].
Stages needed:
- [STAGE_1]
- [STAGE_2]
- [STAGE_3]
Requirements:
- [REQ_1]
- [REQ_2]
Deployment target: [TARGET]
**Example:**
Create a GitHub Actions pipeline for a Next.js application.
Stages needed:
- Lint and type check
- Run tests
- Build
- Deploy to Vercel
Requirements:
- Cache dependencies
- Only deploy on main branch
- Run tests on all PRs
Deployment target: Vercel (production)
---
### Prompt 38: Write Infrastructure as Code
Write [TERRAFORM/PULUMI/CDK] code to provision:
Resources:
- [RESOURCE_1]
- [RESOURCE_2]
- [RESOURCE_3]
Cloud provider: [PROVIDER] Environment: [ENV]
Include:
- Variables for configuration
- Outputs for important values
- Tags for resource management
---
### Prompt 39: Create Monitoring Dashboard
Design a monitoring dashboard for: [SERVICE_NAME]
Key metrics to track:
- [METRIC_1]
- [METRIC_2]
- [METRIC_3]
Alert thresholds:
- [ALERT_1]
- [ALERT_2]
Platform: [DATADOG/GRAFANA/CLOUDWATCH] Provide: Query/config for each panel.
---
### Prompt 40: Debug Kubernetes Issue
Help me debug this Kubernetes issue:
Problem: [DESCRIPTION]
Pod status:
[KUBECTL_OUTPUT]
Pod logs:
[LOGS]
What's wrong and how do I fix it?
---
<h2 id="learning">Learning Prompts</h2>
### Prompt 41: Explain Concept
Explain [CONCEPT] like I'm a [EXPERIENCE_LEVEL] developer.
Include:
- What it is (simple definition)
- Why it matters
- When to use it
- Simple code example
- Common mistakes to avoid
- Resources for learning more
**Example:**
Explain React Server Components like I'm a junior developer.
Include:
- What it is (simple definition)
- Why it matters
- When to use it
- Simple code example
- Common mistakes to avoid
- Resources for learning more
---
### Prompt 42: Compare Technologies
Compare [TECH_A] vs [TECH_B] for [USE_CASE].
Compare:
- Learning curve
- Performance
- Ecosystem/community
- Best use cases
- Limitations
Include a recommendation based on: [MY_SITUATION]
---
### Prompt 43: Learn by Doing
Create a hands-on tutorial for learning [TOPIC].
Level: [BEGINNER/INTERMEDIATE/ADVANCED] Time: [ESTIMATED_TIME]
Structure:
- Quick concept overview
- Small coding exercises (progressively harder)
- Mini-project to build
- Challenge problems
Include solutions for each exercise.
---
### Prompt 44: Interview Prep
Help me prepare for a [POSITION] interview at a [COMPANY_TYPE].
Topics to cover:
- [TOPIC_1]
- [TOPIC_2]
- [TOPIC_3]
Provide:
- Common questions with ideal answers
- Coding problems (with solutions)
- System design questions (for senior roles)
- Questions to ask the interviewer
---
### Prompt 45: Code Kata
Create a coding kata for practicing [SKILL].
Difficulty: [EASY/MEDIUM/HARD] Time limit: [TIME]
Include:
- Problem statement
- Examples
- Constraints
- Hints (progressive)
- Solution with explanation
- Follow-up variations
---
<h2 id="performance">Performance Prompts</h2>
### Prompt 46: Optimize Query
Optimize this database query:
[QUERY]
Table sizes:
- [TABLE_1]: [ROW_COUNT] rows
- [TABLE_2]: [ROW_COUNT] rows
Current execution time: [TIME] Target: [TARGET_TIME]
Suggest optimizations and explain their impact.
---
### Prompt 47: Reduce Bundle Size
Help me reduce the bundle size of this [FRAMEWORK] app.
Current size: [SIZE] Target: [TARGET]
package.json dependencies:
[DEPENDENCIES]
Suggest:
- Dependencies to remove/replace
- Code splitting strategies
- Tree shaking improvements
- Lazy loading opportunities
---
### Prompt 48: Profile and Optimize
This code is slow. Help me optimize it:
[CODE]
Current performance: [METRIC] Target: [TARGET]
Input characteristics: [INPUT_SIZE]
Provide optimized version with explanation of changes.
---
### Prompt 49: Caching Strategy
Design a caching strategy for: [USE_CASE]
Data characteristics:
- Update frequency: [FREQUENCY]
- Read/write ratio: [RATIO]
- Size: [DATA_SIZE]
Requirements:
- [REQ_1]
- [REQ_2]
Suggest:
- What to cache
- Cache invalidation strategy
- TTL recommendations
- Implementation approach
---
### Prompt 50: Load Testing Plan
Create a load testing plan for: [SERVICE]
Expected load:
- Normal: [REQUESTS_PER_SEC]
- Peak: [PEAK_REQUESTS]
- Users: [CONCURRENT_USERS]
Test scenarios:
- Steady state
- Ramp-up
- Spike test
- Soak test
Tools recommendation and sample scripts.
---
## How to Use These Prompts More Effectively
### The Voice-First Advantage
Typing these prompts takes time. With [Vocoding](https://vocoding.com), you can speak them instead:
1. Press your hotkey
2. Say: "Create a React component that displays a user profile with avatar and name"
3. Vocoding transcribes and optimizes
4. Paste into ChatGPT, Claude, or Cursor
Your spoken prompt becomes a structured, optimized request in seconds.
### Tips for Better Results
1. **Be specific**: "Create a function" is vague. "Create a TypeScript function that validates email addresses and returns boolean" is actionable. For a deeper dive, read our [AI prompt engineering guide](/blog/ai-prompt-engineering-guide).
2. **Provide context**: Include relevant code, error messages, or constraints.
3. **Specify output format**: "Format as Markdown" or "Include code comments" helps get usable output.
4. **Iterate**: The first response is rarely perfect. Follow up with refinements.
5. **Use system prompts**: In ChatGPT, set a custom instruction like "You are a senior TypeScript developer. Always include type annotations."
---
## Get These Prompts as a Voice-First Experience
Stop copying and pasting. With Vocoding, you describe what you need and get optimized prompts automatically.
**Features:**
- [Local-first privacy](/privacy-first) (Whisper transcription)
- AI-powered [prompt optimization](/blog/what-is-prompt-optimization)
- Works with ChatGPT, Claude, Cursor, and more
- One global hotkey for instant access
Whether you are a [developer](/for-developers), [founder](/for-founders), or [content creator](/for-creators), Vocoding adapts to your workflow.
[Join the Vocoding waitlist](https://vocoding.com)
---
*Have a great prompt we missed? [Share it with us](https://vocoding.com/support) and we will add it to the list.*
Ready to code at the speed of thought?
Join developers using voice-first AI productivity.
Get Early Access