The “Extract Prompt” pattern tackles a notorious quirk of large language models: their tendency to lose focus or “forget” instructions when overwhelmed by massive context windows. Instead of dumping an entire complex workflow into a single, massive prompt, this approach isolates intermediate tasks into separate, tightly scoped prompts. Doing so forces the model to attend strictly to the immediate problem without getting distracted by irrelevant history or unwritten team norms. It is a highly effective way to enforce rigorous software engineering patterns and maintain tight control over an AI agent’s execution sequence.
This paper illustrates this value using a classic Test-Driven Development (TDD) workflow, a process where models famously skip steps or write code out of sequence when left to their own devices. By extracting the TDD cycle into isolated prompts—asking the agent to first list test scenarios, write exactly one failing test, make it pass, and finally refactor—you effectively put the AI on rails. This granular decomposition stops the model from trying to solve the entire problem at once and ultimately yields much more robust, reliable solutions.
| PDF of the paper (ExtractPrompt.pdf) | 484KiB |
Wed 8 AprDisplayed time zone: Brasilia, Distrito Federal, Brazil change
15:40 - 17:40 | Writer's WorkshopWS: Patterns for GenAI at Room 513 Chair(s): Kyle Brown IBM, USA, Douglas C. Schmidt William & Mary, Joseph (Joe) Yoder The Refactory, Inc.
| ||
15:40 20mPaper | Enterprise Tool and Agent Patterns WS: Patterns for GenAI File Attached | ||
16:00 20mPaper | Toward A Pattern Language for Agentic Retrieval Pipelines: From Intent to Adaptive Knowledge Acquisition WS: Patterns for GenAI File Attached | ||
16:20 20mPaper | CD4AI: Regression Testing for AI-Enabled Systems WS: Patterns for GenAI João Paulo Pereira da Silva , Renato Cordeiro Ferreira IME-USP | JADS-TiU/TUe, Alfredo Goldman University of São Paulo File Attached | ||
16:40 20mPaper | A Pattern Hierarchy for Using Generative AI for Task Allocation in Agile Project Management WS: Patterns for GenAI Maan Patel , David Gershony University of California, Irvine, Dustin Lee University of California, Irvine, Joe Hoshina University of California, Irvine, Alberto Krone-Martins UC Irvine, Hadar Ziv File Attached | ||
17:00 20mPaper | Extract Prompt WS: Patterns for GenAI Graham Lee Chiron Codex File Attached | ||
17:20 20mPaper | senpAI: A Pattern for Contextual Onboarding and Knowledge Transfer WS: Patterns for GenAI Sócrates Veridiano Faria Lopes Instituto de Pesquisas Tecnológicas do Estado de São Paulo File Attached | ||