Coding & Development Prompts
Software prompts for Google Gemini — turn it into a pair programmer for debugging, code review, refactoring, test generation and architecture decisions.
16 prompts
Diagnose And Fix Runtime Errors
You are an expert debugger. Given the following [LANGUAGE] code snippet that throws a runtime error, analyze the code, identify the root cause of the error, explain why it occurs, and provide a corrected version with explanation. Code snippet: [CODE SNIPPET] Error message: [ERROR MESSAGE] (if available).
View promptComprehensive Code Review Checklist
Act as a senior software engineer conducting a code review. Review the following [LANGUAGE] code focusing on: readability, maintainability, performance, security, and adherence to best practices. Provide a line-by-line review with specific, actionable feedback. Code: [CODE SNIPPET]
View promptModern Refactoring Of Legacy Code
You are a refactoring expert. Given the following legacy [LANGUAGE] code, refactor it to modern best practices and patterns. Use clear naming, reduce complexity, eliminate duplication, and apply appropriate design patterns if necessary. Explain your changes step-by-step. Code: [LEGACY CODE]
View promptDesign Scalable System Architecture
As a solution architect, design a high-level system architecture for the following requirements: [REQUIREMENTS]. Include key components, data flow, technology choices, and trade-offs. Explain how it meets scalability, reliability, and performance needs. Provide a diagram in text format (using ASCII art or simple blocks).
View promptGenerate Comprehensive Unit Tests
Generate a full suite of unit tests for the following [LANGUAGE] function using [TESTING FRAMEWORK]. Cover edge cases, error conditions, and typical scenarios. Include setup, teardown, and any mocks needed. Provide the test code with comments explaining each test. Function: [FUNCTION CODE]
View promptCreate API Documentation From Code
Given the following [LANGUAGE] code with function signatures and comments, produce comprehensive API documentation in [FORMAT, e.g., Markdown, OpenAPI]. Include descriptions, parameter details, return values, exceptions, and usage examples. Code: [CODE WITH COMMENTS]
View promptIdentify And Fix Performance Bottlenecks
Analyze the following [LANGUAGE] code for performance issues. Profile hotspots, identify inefficient algorithms, memory leaks, or expensive operations. Suggest optimizations with code examples and explain the expected improvement. Code: [CODE SNIPPET]
View promptSpot Security Vulnerabilities In Code
Conduct a security audit of the following [LANGUAGE] code. Look for common vulnerabilities (e.g., injection, XSS, insecure deserialization, broken authentication). For each issue found, explain the risk and provide a secure fix. Code: [CODE SNIPPET]
View promptCross-Language Code Migration
Translate the following [SOURCE LANGUAGE] code to [TARGET LANGUAGE], preserving functionality and logic. Use idiomatic patterns and best practices of the target language. Explain any non-trivial changes. Source code: [CODE SNIPPET]
View promptSelect Appropriate Design Patterns
Given a software problem description, suggest suitable design patterns (Gang of Four or otherwise) with explanation. Describe the problem context, forces, and solution structure in [LANGUAGE]. Provide code sketches. Problem: [DESCRIPTION]
View promptOptimize SQL Query For Performance
Optimize the following SQL query for better performance. Explain the changes, like index usage, join restructuring, or subquery optimization. Provide the optimized query and expected impact. SQL query: [SQL QUERY] Database: [DATABASE, e.g., PostgreSQL, MySQL]
View promptGenerate CI/CD Pipeline Configuration
Create a CI/CD pipeline configuration for a [TECH STACK] project. The pipeline should include stages: linting, testing, building, and deploying to [TARGET ENVIRONMENT]. Use [CI/CD TOOL, e.g., GitHub Actions, GitLab CI] YAML syntax. Provide the file content with comments.
View promptRobust Error Handling Strategy
Design an error handling strategy for the following [LANGUAGE] function/class. Consider exception types, logging, user-friendly messages, retry policies, and graceful degradation. Provide a code example implementing the strategy. Code: [CODE SNIPPET]
View promptSimplify Dependency Management And Decoupling
Analyze the following [LANGUAGE] code and suggest ways to reduce coupling and improve dependency management. Recommend patterns like dependency injection, interfaces, or anti-corruption layers. Provide refactored code examples. Code: [CODE SNIPPET]
View promptDetect And Eliminate Code Smells
As a code quality expert, review the following [LANGUAGE] code and identify all code smells (e.g., long method, large class, primitive obsession). For each smell, explain why it's problematic and provide a concrete refactoring solution. Code: [CODE SNIPPET]
View promptImplement Algorithms With Step-By-Step Explanation
Implement the [ALGORITHM NAME] in [LANGUAGE]. Provide a clean, efficient implementation with comments. Then explain how the algorithm works line-by-line, including time and space complexity. Consider edge cases. Algorithm: [ALGORITHM NAME]
View prompt