With Examples, Variants & How to Validate Them
Imagine having a mini-mentor available 24/7 that helps you refactor code, generate tests, explain edge-cases, or modernize your APIs.
That’s ChatGPT … if you know how to ask clearly.
Below are prompts I’ve used (or refined) in real Java / Spring-Boot development, with examples, caveats, and steps to verify the results.
Why This Matters
Before we dive into prompts, let me share what I felt was missing in many articles:
- They share one prompt (e.g. “refactor for performance”), but often don’t show input / output example code, or explain why the change is better.
- They rarely provide variants — e.g. for Spring Boot vs plain Java, or legacy vs reactive code.
- There is little guidance on validating what ChatGPT suggests (performance measurement, tests, side-effects).
- There is no chaining of prompts — refining, reviewing, testing, iterating.
So in this version, you’ll see prompts + example code + how to test / validate them + variant ideas for different contexts.
The Prompt List with Examples
Below are 12 prompts. I’ll show you:
- The prompt text you feed to ChatGPT
- A short example of input code
