10 Prompts

Coding Prompts

Battle-tested collection of the best AI prompts for Coding. Copy, paste, and get results instantly.

Code Documentation Generator

Generate comprehensive documentation for your code

documentationcommentsbest practices
Generate documentation for this code.

Language: [LANGUAGE]
Documentation style: [JSDoc/Docstring/TSDoc/etc]

Create:
1. File/module overview
2. Function/method documentation with:
   - Description
   - Parameters with types
   - Return values
   - Exceptions thrown
   - Usage examples
3. Class documentation (if applicable)
4. README section for this component

Code:
```
[PASTE YOUR CODE]
```

Unit Test Generator

Generate comprehensive unit tests for your code

testingunit testsTDD
Write unit tests for this code.

Language: [LANGUAGE]
Testing framework: [Jest/Pytest/JUnit/etc]
Code to test:
```
[PASTE YOUR CODE]
```

Generate tests for:
1. Happy path scenarios
2. Edge cases
3. Error handling
4. Boundary conditions
5. Null/undefined inputs

Include:
- Descriptive test names
- Arrange/Act/Assert structure
- Mocking where needed
- Test coverage summary

Code Refactoring Assistant

Get suggestions to improve code quality and maintainability

refactoringclean codebest practices
Refactor this code for better quality.

Language: [LANGUAGE]
Goals: [performance/readability/maintainability/all]

Code:
```
[PASTE YOUR CODE]
```

Provide:
1. Identified code smells
2. Refactored version
3. Explanation of each change
4. Design patterns that could apply
5. Performance implications
6. Before/after comparison

API Endpoint Designer

Design RESTful API endpoints with documentation

APIRESTbackend
Design a REST API for [FEATURE/RESOURCE].

Requirements: [WHAT IT NEEDS TO DO]
Authentication: [TYPE]
Framework: [EXPRESS/DJANGO/RAILS/etc]

Provide:
1. Endpoint definitions (method, path, description)
2. Request body schemas
3. Response schemas (success and error)
4. Status codes used
5. Authentication/authorization logic
6. Rate limiting recommendations
7. Example requests and responses
8. OpenAPI/Swagger snippet

Database Schema Designer

Design efficient database schemas with relationships

databaseSQLschema
Design a database schema for [APPLICATION/FEATURE].

Database type: [PostgreSQL/MySQL/MongoDB/etc]
Requirements:
[LIST YOUR DATA REQUIREMENTS]

Provide:
1. Table/collection definitions
2. Column types and constraints
3. Primary and foreign keys
4. Indexes for common queries
5. Relationships (1:1, 1:N, N:N)
6. Entity relationship diagram (text-based)
7. Sample queries for common operations
8. Migration script

Regex Pattern Builder

Create and explain regex patterns for any use case

regexpatternsvalidation
Create a regex pattern for me.

What I need to match: [DESCRIBE PATTERN]
Examples that should match:
[LIST EXAMPLES]
Examples that should NOT match:
[LIST NON-EXAMPLES]
Language: [JS/Python/etc]

Provide:
1. The regex pattern
2. Step-by-step explanation
3. Test cases
4. Common edge cases handled
5. Performance considerations
6. Alternative simpler patterns (if any)

Code Converter (Language Translation)

Convert code from one programming language to another

conversiontranslationlanguages
Convert this code from [SOURCE LANGUAGE] to [TARGET LANGUAGE].

Source code:
```
[PASTE YOUR CODE]
```

Requirements:
1. Use idiomatic [TARGET LANGUAGE] patterns
2. Maintain functionality exactly
3. Use equivalent libraries/frameworks
4. Handle language-specific differences
5. Add comments where syntax differs significantly
6. Note any features that don't translate directly

Security Vulnerability Scanner

Identify security issues in your code

securityvulnerabilitiesOWASP
Perform a security review of this code.

Language: [LANGUAGE]
Application type: [web/api/mobile/etc]

Code:
```
[PASTE YOUR CODE]
```

Check for:
1. OWASP Top 10 vulnerabilities
2. Injection risks (SQL, XSS, Command)
3. Authentication/Authorization issues
4. Data exposure risks
5. Insecure configurations
6. Dependency vulnerabilities (if visible)

For each issue provide:
- Severity (Critical/High/Medium/Low)
- Description
- Location in code
- Fix recommendation
- Secure code example

Git Commit Message Generator

Write clear, conventional commit messages

gitcommitsversion control
Write a commit message for these changes.

Convention: [Conventional Commits/Custom/None]
Changes made:
[DESCRIBE YOUR CHANGES]

Diff (if available):
```
[PASTE DIFF]
```

Provide:
1. Commit message following convention
2. Type (feat/fix/docs/style/refactor/test/chore)
3. Scope (optional)
4. Body (for complex changes)
5. Footer (breaking changes, issue references)
6. Alternative phrasings

Algorithm Explainer & Optimizer

Understand algorithms and optimize for performance

algorithmsoptimizationperformance
Explain and optimize this algorithm.

Code:
```
[PASTE YOUR CODE]
```

Provide:
1. What this algorithm does (plain English)
2. Step-by-step walkthrough
3. Time complexity (Big O)
4. Space complexity
5. Optimization opportunities
6. Optimized version of the code
7. Trade-offs of the optimization
8. Test cases to verify correctness
9. When NOT to use this approach