home/roleplay/prompt-examples-13

Prompt Examples

GPTClaudeGemini··1,301 copies·updated 2026-07-14
prompt-examples-13.prompt
# Section 8: Prompt Examples — Java / Spring Boot

Copy-paste prompts and before/after pairs for [Section 3](03-prompting.md), [Section 4](04-prompt-techniques.md), and [Section 7](07-prompt-optimization.md).

| Part | Theory |
|------|--------|
| [Fundamentals](#from-section-3-prompting-fundamentals) | [03-prompting.md](03-prompting.md) |
| [Techniques](#from-section-4-prompt-techniques) | [04-prompt-techniques.md](04-prompt-techniques.md) |
| [Optimization](#from-section-7-prompt-optimization) | [07-prompt-optimization.md](07-prompt-optimization.md) |

---

## How to use this document

Read the theory in Sections 3, 4, and 7 first. Return here when you need a copy-paste prompt or a full before/after pair.

---

## Canonical domain: Person / Order service

Most examples use the same fictional stack:

| Layer | Technology |
|-------|------------|
| Language | Java 21+ (records, sealed classes) |
| Framework | Spring Boot 3.5+, Spring Data JDBC |
| Database | PostgreSQL |
| Package | `com.example.myservice` |

**Bad pattern (reused across technique examples):** controller injects repository, field injection, returns entities, `RuntimeException` for not-found.

**Good pattern:** Controller → Service → Repository; constructor injection; DTO records; `orElseThrow(EntityNotFoundException::new)`.

---

## From Section 3: Prompting fundamentals {#from-section-3-prompting-fundamentals}

> Theory: [CO-STAR](03-prompting.md#the-co-star-framework) · [26 Principles](03-prompting.md#the-26-principles-of-effective-prompting) · [Anti-Patterns](03-prompting.md#prompting-anti-patterns-for-java-developers)

### CO-STAR in practice {#co-star-java}

**Bad prompt (no structure):**

fill the variables

This prompt has 2 variables. Pro fills them into a ready-to-paste prompt for you — no manual find-and-replace.

{#from-section-3-prompting-fundamentals}{#co-star-java}
Unlock with Pro →

when to use it

Community prompt sourced from the open-source GitHub repo gzheyts/ai-tools (no explicit license). A "Prompt Examples" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

roleplaycommunitygeneral

source

gzheyts/ai-tools · no explicit license