Posted 11/12/2025

General “Prompt Structure” for Clear Results

A good prompt follows a simple structure — it’s basically context + task + constraints + output format and optionaly tone/style.

Prompt Template

Example

Copy

Role/Context:
Goal: 
Details:
Constraints:
Output format:
Tone/Style:

Context

Give the AI background so it knows who it’s helping and what the goal is.

“You are a QA engineer testing a web application with an authentication API.” or “I am a QA engineer working on a Playwright test suite for a shopping cart.”

✅ Why it matters: context sets tone and domain expectations (test cases vs essays).

Task

Say exactly what you want the AI to do, using an action verb. Use clear verbs like:

“Generate test cases for the login feature.”
“Explain why this test might fail intermittently.”
“List possible negative test scenarios for registration.”

Details (Input Data or Constraints)

“Use the OpenAPI spec below.”
“Use Playwright with TypeScript.”
“Include 3 positive and 2 negative scenarios.”

Output Format

Specify exactly what the response should look like. If you don’t, AI might produce verbose explanations.

“Output only Gherkin scenarios.”
“Output as a JSON array of test cases.”
“Output code ready to copy into a Jest test file.”

Optional: Role + Tone

This is underrated — telling the AI how to think.

“Act as a senior QA automation engineer.”
“Think step by step.”
“Be concise and structured.”

Example: Bad vs Good Prompt (QA Use Case)

❌ Bad Prompt

“Write some tests for login.”

✅ Good Prompt

“You are a QA automation engineer.
Generate 5 test cases for the POST /api/login endpoint.
Include both positive and negative cases (e.g., valid credentials, invalid password, missing fields).
Output in Gherkin format, no explanations.”