liveBook · Manning

Refinement pattern

As explained in AI-Powered Developer: Build software with ChatGPT and Copilot

The refinement pattern is an iterative prompting approach in which a prompt is progressively improved to obtain more accurate, relevant, or sophisticated responses.

The refinement pattern improves AI results by iteratively changing a prompt from general to specific, seeking responses that are more accurate, relevant, or sophisticated. Specific questions generally produce more specific results, while each prompt builds on the interaction before it. section 2.1.1 section 2.5

A practical refinement loop typically:

  • Asks the AI to improve an initial question or prompt. section 2.1.1
  • Adds constraints such as a role, language, audience, requirements, or desired output format. section 2.1.1 section 3.2
  • Drills from broad goals into functionality, components, files, and implementation details. section 3.2
  • Reviews each response and continues refining rather than treating generated output as final. section 2.1.1 section 3.2

From linked-list definition to implementation

A general request for a singly linked list becomes a prompt asking for nodes, links, and basic operations in pseudocode. A later refinement requests Python, then another asks for a method that reverses traversal. The resulting interaction moves from conceptual structure to executable code and a concrete reverse operation. section 2.1.1

From system goal to package structure

A broad information technology asset-management goal can be refined with Python, hexagonal architecture, inventory, lifecycle, allocation, and compliance requirements. Further prompts request an enhanced design, a package structure, and a specific asset schema. section 3.2

Going forward, when I ask a question, try to formulate a better question. As an intern who studied computer science in college, how would you define a singly linked list in pseudocode?

Browse a representative reformulation that turns a linked-list question into a more specific request covering structure and fundamental operations. section 2.1.1

How AI-Powered Developer: Build software with ChatGPT and Copilot covers it

How deep it goes
Defines iterative improvement and demonstrates progression from broad requests to pseudocode, Python code, architecture, and schemas.
Examples
Uses singly linked lists, reversal methods, an asset-management system, package structures, and Python asset models.
What it assumes
Assumes a concrete question or development task, while demonstrating refinement from basic linked-list concepts and broad system requirements.
What you can do after
Apply it via iterative prompts to turn vague software questions into more detailed designs, code, and implementation artifacts.
How it connects
Connects prompt specificity with the Persona Pattern, Audience Persona Pattern, software architecture, and step-by-step reasoning.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI-Powered Developer: Build software with ChatGPT and Copilot. The section links point to the parts of the book it draws on.