Few-shot prompting supplies a small number of explicit examples alongside instructions, helping a generative model interpret the intended output format and the meaning of its placeholders. A prompt without examples is zero-shot prompting. section 2.4.5
Apply the technique by:
- State the task and required output format before showing examples. section 2.4.5
- Provide at least two representative examples when guiding a new prompt. section 2.4.5
- Use examples to clarify natural-language placeholders, templates, quality characteristics, or response structure. section 2.4.5 section 4.2.2
- Add delimiters and relevant context, then inspect the generated result rather than assuming its quality. section 4.2.1 section 8.1.2
Generating exploratory test charters
A prompt asks for three booking-date charters in the form “Explore <Target> using <Resource> to discover <Information>.” Examples such as “Explore user permissions using different users to discover permission risks” guide outputs about date validation, time zones, and booking conflicts. section 2.4.5
Guiding analysis and data generation
A risk-analysis prompt demonstrates the format “Risk - Quality Characteristic - Explanation,” while a SQL prompt supplies CREATE and INSERT statements for related tables. The examples and schema context help preserve relationships such as room identifiers and foreign keys. section 4.2.2 section 6.2.2
###
public BookingResult createBooking(Booking bookingToCreate) throws
➥SQLException {
if(dateCheckValidator.isValid(bookingToCreate.getBookingDates())) {
if (bookingDB.checkForBookingConflict(bookingToCreate)) {
return new BookingResult(HttpStatus.CONFLICT);
} else {
CreatedBooking createdBooking =
➥bookingDB.create(bookingToCreate);
if(bookingToCreate.getEmail() != null &&
➥bookingToCreate.getPhone() != null){
MessageBuilder messageBuilder = new MessageBuilder();
Message message = messageBuilder.build(bookingToCreate);
messageRequests.postMessage(message);
}
return new BookingResult(createdBooking,
➥HttpStatus.CREATED);
}
} else {
return new BookingResult(HttpStatus.CONFLICT);
}
}
###
Use the booking method as a concrete input for a few-shot risk prompt, with the supplied example establishing the expected risk category and explanation format. section 4.2.2

















