[Paper Review] ChatGPT Prompt Patterns for Improving Code Quality, Refactoring, Requirements Elicitation, and Software Design
The paper proposes a catalog of prompt patterns for software engineering tasks using ChatGPT, detailing patterns to improve requirements elicitation, system design, code quality, and refactoring, plus how patterns combine for effective LLM-assisted development.
This paper presents prompt design techniques for software engineering, in the form of patterns, to solve common problems when using large language models (LLMs), such as ChatGPT to automate common software engineering activities, such as ensuring code is decoupled from third-party libraries and simulating a web application API before it is implemented. This paper provides two contributions to research on using LLMs for software engineering. First, it provides a catalog of patterns for software engineering that classifies patterns according to the types of problems they solve. Second, it explores several prompt patterns that have been applied to improve requirements elicitation, rapid prototyping, code quality, refactoring, and system design.
Motivation & Objective
- Introduce a catalog of reusable prompt patterns for software engineering tasks solved with LLMs like ChatGPT.
- Classify patterns by problem type to guide practical usage across the software life cycle.
- Demonstrate how patterns can be combined (patterns compounds) to enhance elicitation, design, code quality, and testing.
Proposed method
- Define a formal structure for prompt patterns (name, classification, intent, motivation, structure, implementation, consequences).
- Provide a catalog of 13 patterns organized into categories (Requirements Elicitation, System Design and Simulation, Code Quality, Refactoring).
- Describe concrete prompt pattern implementations (e.g., Requirements Simulator, Specification Disambiguation, API Generator, API Simulator, Few-shot Code Example Generation, DSL Creation).
- Illustrate how patterns interact and can be combined to address token limits and iterative design.
- Ground patterns in examples tested with ChatGPT to validate applicability.
Experimental results
Research questions
- RQ1What prompt patterns enable effective elicitation and specification of system requirements using LLMs?
- RQ2How can prompt patterns support exploratory system design, API design, and simulation of software behavior with LLMs?
- RQ3What techniques improve code quality and refactoring when using LLMs, and how can they be composed for better results?
Key findings
- A catalog of 13 prompt patterns is proposed, grouped into four task areas for software engineering with LLMs.
- Patterns support requirements elicitation, system design, API generation/simulation, code quality, and refactoring.
- Patterns can be combined into compounds to tackle design challenges and token-limit constraints.
- The API Generator and API Simulator patterns enable early API design exploration and interactive testing.
- Requirements Simulator and Visualization Generator can together enhance requirement fidelity through visualization-guided exploration.
- Prompt patterns can act as automated, intermediary reasoning (e.g., Specification Disambiguation) to reduce ambiguity in specifications.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.