Building Requirements with LLM Support
This document outlines a systematic, prompt-based methodology for refining, structuring, and visualizing software requirements using AI.
AI Prompting for Structured Requirements Engineering
This document outlines a systematic, prompt-based methodology for refining, structuring, and visualizing software requirements using AI. The approach integrates specialized AI roles, enforces structured outputs, and validates critical quality attributes to transform raw input into a prioritized, actionable, and design-ready backlog.
The process is divided into four main steps:
- Refinement and Analysis
- Prioritization and Sequencing
- Test Case Generation
- Technical Design (Diagramming).
Tips:
- Each step should be performed in a new session to limit interference from deprecated context.
- If you need to incorporate new information at any given step, I suggest you go one prompt back, insert it there, try doing some validation, and then proceed.
- Always remember you can make changes to the output before feeding it as an input to the next prompt, but if you want the actual instructions to be part of the context, you should ask the LLM and not do it manually.
- ChatGPT can generate files for you to download if you ask. Please note that the links expire quickly and cannot be reactivated. You will have to redo it if you want the link to work again. Claude and Gemini don’t suffer from this issue, but you need to ask them to provide the output on the canvas.
Step 1: Refinement and Analysis
Goal: To convert raw, unstructured input into a clear, complete, and well-reasoned set of requirements. This phase uses a sequence of prompts to progressively clarify, correct, and enhance the initial ideas.
Prompt 1: Initial Clarification
Prompt
**Role:** You are a **Senior Technical Editor** with expertise in **Natural Language Processing (NLP)** and technical communication.
**Task:** Rewrite the following requirements to be simple, direct, and composed of short sentences. It is crucial that you do not add or remove any information from the original content.
\[INSERT RAW REQUIREMENTS HERE\]
Prompt 2: Manual Review and Correction
Attach the output from the previous prompt.
Prompt
**Role:** You are a **Senior Technical Editor** with expertise in **Natural Language Processing (NLP)** and technical communication.
**Task:** Based on the rewritten text, apply the following corrections. Ensure the new instructions are integrated cohesively, maintaining clarity and concision.
\[INSERT SPECIFIC CORRECTIONS HERE\]
Prompt 3: Suggestion and Enhancement
Attach the output from the previous prompt.
Prompt
**Role:** You are a **Lead Product Strategist** with extensive experience in **product management and market analysis**. You excel at identifying opportunities to increase a product's value and user engagement by aligning features with strategic business goals.
**Task:** Analyze the current requirements and provide strategic recommendations.
1. Provide suggestions to improve the clarity and value of the existing requirements.
2. Generate 3-5 new ideas that could complement the existing features.
3. For the new ideas, apply a prioritization method (e.g., MoSCoW or Cost/Benefit) and briefly justify each priority.
Present your output in a Markdown table with the columns: 'Type (Improvement/Complement)', 'Suggestion/Idea Description', 'Suggested Priority', and 'Priority Justification'.
Prompt 4: Enhancement Integration
Attach the output from the previous prompt.
Prompt
**Role:** You are a **Senior Technical Editor** with expertise in **Natural Language Processing (NLP)** and technical communication.
**Task:** Incorporate the following requirements suggestions:
\[INSERT SPECIFIC CORRECTIONS HERE\]
Prompt 5: Inconsistency and Ambiguity Analysis
Attach the output from the previous prompt.
Prompt
**Role:** You are a **Principal Quality Assurance Analyst** specializing in **formal verification, logic, and ambiguity detection** in technical specifications. You possess a critical, adversarial mindset for identifying unstated assumptions, logical fallacies, and semantic inconsistencies that could lead to implementation errors.
**Task:** Rigorously analyze the revised requirements for inconsistencies, ambiguities, or conflicts. If you identify a potential problem, report it on a list before making any changes.
Prompt 6: Manual Review and Correction
Attach the output from the previous prompt.
Prompt
**Role:** You are a **Senior Technical Editor** with expertise in **Natural Language Processing (NLP)** and technical communication.
**Task:** Based on the rewritten text, apply the following corrections. Ensure the new instructions are integrated cohesively, maintaining clarity and concision.
\[INSERT SPECIFIC CORRECTIONS HERE\]
Step 2: Prioritization and Sequencing
Goal: To produce a final, optimized work sequence by prioritizing requirements and resolving dependency conflicts with engineering oversight.
Prompt 1: Requirement formalization
Attach the output from Step 1, Prompt 6.
Prompt
**Role:** You are a **Requirements Engineering Specialist** with deep expertise in **requirements elicitation and formal documentation**. You are skilled in synthesizing complex discussions and analyses into atomic, unambiguous, and uniquely identifiable requirements that adhere to industry best practices.
**Task:** Analyze all the preceding text and extract the refined requirements. Generate a final, numbered list where each item is a single, clear, and concise requirement.
Prompt 2: Granular Refinement
Attach the output from the previous prompt.
Prompt
**Role:** You are a **Requirements Analyst** specializing in **functional decomposition and ensuring requirement atomicity**. You possess strong analytical skills to identify distinct functional components within a larger statement, ensuring that each resulting requirement is testable and independently manageable.
**Task:** Based on the numbered list you just generated, perform the following modification and then regenerate the complete list.
For item \[REQUIREMENT NUMBER\], divide it into \[N\] distinct requirements, focusing on the concepts of \[CONCEPT A, CONCEPT B, ETC.\]. Ensure each new requirement in the regenerated list remains clear and concise.
Prompt 3: Initial Sequencing
Attach the output from the previous prompt.
Prompt
**Role:** You are an **Agile Delivery Manager** with deep expertise in **backlog management, agile methodologies, and dependency-aware planning**.
**Task:** Your task is to prioritize and sequence the most recent list of requirements.
1. **Prioritization Method:** \[CHOOSE: MoSCoW or Eisenhower\]
2. **Engineer's Classifications:** \[INSERT CLASSIFICATIONS BY NUMBER, e.g., MoSCoW: 1: Must, 2: Should, 3: Could; Eisenhower: 1: Important/Urgent, 2: Not Important/Urgent\]
3. **Known Dependencies:** \[INSERT KNOWN DEPENDENCIES, e.g., Requirement 5 depends on Requirement 3; Requirement 10 depends on 5\]
Generate a Markdown table titled "**Prioritized Sequence**" with the columns: 'ID', 'Requirement', 'Classification', and 'Dependencies (ID)'.
Order the table strictly from highest to lowest priority. If there is a tie in priority, apply this **tie-breaking rule**: the dependent requirement must appear _immediately after_ the requirement it depends on.
Prompt 4: Advanced Dependency Analysis
Attach the output from the previous prompt.
Prompt
**Role:** You are a **Principal Software Architect** with deep expertise in **system design, dependency management, and incremental software delivery**. You excel at analyzing system-level dependencies and devising architectural solutions, such as stubs and interfaces, to decouple components and enable parallel or prioritized development workflows.
**Task:** Analyze the “Prioritized Sequence” table you just created to identify and resolve priority conflicts caused by dependencies.
1. **Identify Conflicts:** List all cases where a dependency forces a lower-priority requirement to be executed before a higher-priority requirement.
2. **Suggest Solutions:** For each conflict, suggest a modification that "breaks" the dependency with the smallest possible work increment. The goal is to allow the high-priority item to begin without the full completion of its low-priority dependency.
Your output must be a numbered list using the following format for each identified conflict:
\[CONFLICT \#\]. Conflict: Requirement \[Dependent ID \- Priority\] depends on Requirement \[Dependency ID \- Priority\].
\[CONFLICT \#\].\[SUGGESTION \#\]. Suggestion: \[DESCRIBE THE MINIMUM INCREMENTAL WORK NEEDED TO BREAK THE DEPENDENCY\].
Prompt 5: Decision Integration and Final Sequence Generation
Attach the output from the previous prompt.
Prompt
**Role:** You are a **Technical Project Coordinator** specializing in **backlog refinement and release planning**.
**Task:** Based on the dependency conflict analysis and the engineer's decisions below, apply the required modifications and regenerate the final "Prioritized Sequence" table.
Engineer's Decisions: \[INSERT DECISIONS HERE, one per line. For example:
C1 (use 1.1): Update R5 to 'Display placeholder for X...'
C3 (reject S3.2): No change to R9.
C4 (use 4.1): Modify R12 to '...'\]
After applying the modifications, generate the "**Prioritized Sequence**" table again, using the original priority classifications and the dependency tie-breaking rule. Ensure the final list is ordered from high to low priority and reflects the resolved conflicts.
Step 3: Test Case Generation
Goal: To translate validated, testable requirements into concrete black-box test cases using formal techniques like Equivalence Class Partitioning (ECP) and Boundary Value Analysis (BVA), creating an actionable basis for quality assurance.
Prompt 1: Identify Test Case Candidates
Attach the output from Step 3, Prompt 5.
Prompt
**Role:** You are a **Senior Test Analyst** with deep expertise in **black-box testing techniques**, specifically **Equivalence Class Partitioning (ECP)** and **Boundary Value Analysis (BVA)**. Your function is to analyze requirements to determine the most effective data-driven testing strategies.
**Task:** Analyze the provided list of requirements and identify all candidates suitable for ECP or BVA.
1. Identify requirements that involve data inputs with ranges, specific value sets, numbers, or explicit conditions.
2. For each candidate, recommend the most appropriate technique (ECP, BVA, or Both).
3. Provide a brief justification for your recommendation.
Present the output as a Markdown table with the columns: `Requirement ID`, `Requirement Text`, `Applicable Technique(s)`, and `Justification`.
Prompt 2: Generate Specific Test Cases
Attach the output from the previous prompt.
Prompt
**Role:** You are a **Senior Test Analyst** with deep expertise in **black-box testing techniques**, specifically **Equivalence Class Partitioning (ECP)** and **Boundary Value Analysis (BVA)**.
**Task:** For each requirement, generate the test cases using **ECP, BVA, or Both** as applicable.
**If using ECP:**
1. Identify the valid and invalid equivalence classes for the relevant inputs.
2. Generate a set of test cases, covering one value from each class.
**If using BVA:**
1. Identify the boundaries for the relevant inputs.
2. Generate test cases for the minimum, minimum+1, nominal, maximum-1, and maximum values for each boundary.
Present the final output in a structured report. For each technique used, provide a Markdown table with the columns: `Test Case ID`, `Description / Value`, `Input Data`, and `Expected Outcome`.
**Example Output Structure:**
### Test Cases for Requirement [ID]
#### Equivalence Class Partitioning (ECP)
| Test Case ID | Description / Class | Input Data | Expected Outcome |
| :--- | :--- | :--- | :--- |
| TC-ID-01 | Valid Class A | ... | ... |
| TC-ID-02 | Invalid Class B | ... | ... |
#### Boundary Value Analysis (BVA)
| Test Case ID | Description / Value | Input Data | Expected Outcome |
| :--- | :--- | :--- | :--- |
| TC-ID-03 | Minimum | ... | ... |
| TC-ID-04 | Minimum + 1 | ... | ... |
Step 4: Technical Design (Diagramming)
Goal: To translate the validated requirements into formal design and architecture diagrams, creating a bridge between requirements and implementation.
Prompt 1: From Requirements to Class Diagram + Glossary
Attach the requirements file in Markdown.
Prompt
**Role:** You are a **Senior Systems Architect** with deep expertise in **Object-Oriented Design (OOD)**. Your primary function is to translate complex business requirements into clear, robust static system models. You are a master of **UML** and use **PlantUML** for all modeling tasks.
**Task:** Your task is to analyze a set of user requirements and generate two precise artifacts:
1. A **PlantUML Class Diagram** that models the static structure (classes, attributes, methods, and relationships) described in the requirements, following OOD best practices.
2. A **Glossary** that provides a brief, professional description for each class identified.
Follow these steps to process the user's input:
1. **Analyze the Requirements**: Read the provided requirements text to understand the domain.
2. **Identify Classes and Attributes**: Identify all significant **nouns** in the text. These will become your classes and attributes. Group related attributes under the most appropriate class.
3. **Identify Behaviors (Methods)**: Identify all the **verbs** and action descriptions. These will become the methods of your classes. Assign each method to the class that is responsible for performing that action.
4. **Identify Relationships**: Determine the relationships between the classes (e.g., association, inheritance, composition). For example, a "customer \*has an\* account" implies an association.
5. **Generate PlantUML**: Create a PlantUML code block for the class diagram. Use standard PlantUML syntax.
6. **Generate Glossary**: After the PlantUML block, create a "## Glossary ##" section. For each class in the diagram, provide a one-sentence description.
**Example Output Structure:**
**Input Requirements:**
"A customer can purchase a parking spot. The system must handle payment by credit card. If payment is via credit card, the system must authorize the payment. A purchase has a date and a tax amount."
**Expected Output:**
plantuml
\`\`\`
@startuml
class Customer {
}
class ParkingSpot {
}
class CreditCardSystem {
\+authorize\_payment(customer, amount, date)
}
class Purchase {
\-Purchase\_Date: Date
\-Tax: number
}
Customer \-- Purchase
Purchase \-- ParkingSpot
Customer \-- CreditCardSystem
@enduml
\`\`\`
\`\`\`
\# Glossary
\* **Customer**: Represents the user who buys a parking spot.
\* **ParkingSpot**: Represents the physical spot that can be purchased or leased.
\* **CreditCardSystem**: Represents an external system responsible for authorizing credit card transactions.
\* **Purchase**: Represents the transaction record for the sale of a parking spot.
\`\`\`
Prompt 2: From Class Diagram to Sequence Diagram
Attach the class diagram file in PlantUML and the requirements in Markdown.
Prompt
**Role:** You are a **Software Design Engineer** specializing in **behavioral modeling and dynamic system analysis**. Your core function is to create detailed **Sequence Diagrams** that illustrate runtime behavior, ensuring they are perfectly consistent with established static architectural models (Class Diagrams). You are highly proficient in **PlantUML** for creating these dynamic views.
**Task:** Your task is to generate a professional **PlantUML Sequence Diagram** that illustrates a specific workflow described in a user-provided **functional requirement**. You must ensure the sequence diagram is valid and strictly consistent with the provided PlantUML Class Diagram.
1. **Analyze the Context**: Review the provided PlantUML Class Diagram to understand the available classes, their methods, and their relationships.
2. **Analyze the Requirement**: Read the user's requirement description to understand the workflow, the participants, and the order of interactions.
3. **Identify Participants**: Identify the objects (instances of classes from the diagram) and actors that participate in the process described in the requirement.
4. **Model Interactions**: Create a PlantUML Sequence Diagram that shows the chronological interactions between the participants.
5. **Enforce Consistency**:
\* Every message sent to an object **must** correspond to a method defined in its class in the provided diagram.
\* Interactions should only occur between objects whose classes have a valid relationship path in the class diagram.
6. **Generate PlantUML**: Provide the final output as a single PlantUML code block.
**Example Output Structure:**
**Input Class Diagram:**
plantuml
\`\`\`
@startuml
class GasStationOwner {
\+parking\_spot\_request()
}
class ParkingSpot {
\+next\_available()
}
GasStationOwner "1" \-- "0..\*" ParkingSpot
@enduml
\`\`\`
Prompt 3: From Requirements to Workflow
Attach the requirements in Markdown.
Prompt
**Role:** You are a **Senior Systems Analyst** specializing in **workflow analysis and process modeling**. Your key function is to bridge the gap between business stakeholders and development teams by translating narrative requirements directly into precise workflow models. You are an expert in using **PlantUML** to rapidly create clear and accurate **Sequence Diagrams** that capture this business logic.
**Task:** Your task is to read a requirements description for a specific functionality and generate a **PlantUML Sequence Diagram** that accurately models the described workflow.
1. **Analyze the Requirement**: Read the provided text to understand the goal of the workflow.
2. **Identify Participants (Nouns)**: Identify all the users, system components, or objects (**nouns**) that participate in the process. These will become the actors and participants in your diagram.
3. **Identify Actions (Verbs)**: Identify the actions (**verbs**) that occur and the information that is exchanged. These will become the messages between participants.
4. **Determine Sequence**: Arrange the actions in the correct chronological order from top to bottom as described in the requirement.
5. **Add Details**: Include any specific data passed between participants as message parameters. Add any conditions mentioned in the text as guards or notes (e.g., \`\[payment time \= now\]\`).
6. **Generate PlantUML**: Create a single PlantUML code block representing the complete workflow.
**Example Output Structure:**
**Input Requirement:**
"A customer requests a parking spot from the Gas Station Owner by providing an account number. The owner finds the next available spot and tells the customer where to park. If the payment time is monthly, the owner adds the charge to the customer's bill."
**Expected Output:**
plantuml
\`\`\`
@startuml
actor Customer
participant "owner:GasStationOwner" as Owner
Customer -> Owner: parking_spot_request(account_number)
activate Owner
Owner --> Customer: where_to_park(available_spot)
alt payment time = monthly
Owner -> Bill: add_to_bill(customer, amount, date)
end
deactivate Owner
@enduml
\`\`\`