prompt

The input text (instruction, context, examples, question) given to a generative AI model. The quality of the prompt directly determines output quality.

Syntax

generative-ai
System instruction + Context + Examples + Task + Format instructions

Example

generative-ai
// Anatomy of a good prompt:
{
  system: "You are a helpful coding assistant that writes TypeScript.",
  user: `
    Context: I am building a REST API with Express.
    Task: Write a middleware function that validates JWT tokens.
    Requirements:
    - Use the jsonwebtoken package
    - Return 401 if invalid
    - Attach decoded user to req.user
  `
}