Architecture and System Design

Act as a principal engineer reviewing a system design. I am building [system description] that needs to handle [scale: X requests/day, X users]. Here is my proposed architecture: [describe]. Evaluate: scalability bottlenecks, single points of failure, data consistency approach, security attack surface, operational complexity, and cost at scale. Recommend the 3 most important changes, with trade-offs clearly explained.

You are an API design expert. I need to design a RESTful API for [system]. Core resources: [list]. Key operations: [list]. Consumer: [mobile app / third-party integrators / internal services]. Design the complete API specification including: resource naming conventions, endpoint structure, HTTP methods and status codes, request/response schemas (JSON), authentication approach, versioning strategy, error response format, and rate limiting approach.

Code Review and Refactoring

Act as a principal engineer doing a deep code review focused on long-term maintainability. Here is the code: [paste code]. Evaluate: Is the abstraction level right? Are responsibilities properly separated? Will this code be easy to test? How will this behave under unexpected inputs at scale? Where would this code fail first in production? Provide a prioritised list of improvements with refactored examples for the top 3.

You are a legacy code specialist. I need to refactor this legacy [language] code written [X years ago] with no tests: [paste code]. First explain what the code does. Then propose a refactoring strategy that: doesn't break existing behaviour, introduces tests before refactoring, improves readability incrementally, and separates concerns. Provide the plan step-by-step, then implement step 1.

Documentation and Technical Writing

Act as a senior technical writer who has documented major open source projects. Write comprehensive documentation for this [API / library / system]: [describe or paste code]. Structure it as: Overview (what it does and why), Quick Start (get running in 5 minutes), Core Concepts (mental model), API Reference (all public methods/endpoints with parameters, returns, examples), Common Patterns, Troubleshooting, and Contributing Guide.

Testing Strategy

You are a testing expert. Review this code and design a comprehensive testing strategy: [paste code]. Recommend: the testing pyramid proportions appropriate for this code, specific unit tests with test cases written out, integration test scenarios, property-based testing opportunities, how to test edge cases and failure modes, and how to make this code more testable through refactoring. Use [Jest / PyTest / JUnit].

Related: ChatGPT Coding Prompts · Data Analysis Prompts · Prompt Engineering Guide

Getting the Best Results

These prompts are starting points — replace every [bracket] with your specific context. The more detail you provide, the more tailored the output.

Pro Tip: Always iterate. Follow up with: 'Make this more concise', 'Add a UK-specific angle', or 'Give me 3 alternative versions'. AI excels at refinement.

More guides: Prompt Engineering Guide · Best Prompts of 2025 · All Guides