kamaleswar Mohanta commited on
Commit
b50a382
·
1 Parent(s): 58359a0

wit error in processing story

Browse files
.vscode/settings.json CHANGED
@@ -3,5 +3,14 @@
3
  "langgraphagenticai",
4
  "tavily"
5
  ],
6
- "github.copilot.chat.codesearch.enabled": true
 
 
 
 
 
 
 
 
 
7
  }
 
3
  "langgraphagenticai",
4
  "tavily"
5
  ],
6
+ "github.copilot.chat.codesearch.enabled": true,
7
+ "python.testing.unittestArgs": [
8
+ "-v",
9
+ "-s",
10
+ ".",
11
+ "-p",
12
+ "*test.py"
13
+ ],
14
+ "python.testing.pytestEnabled": false,
15
+ "python.testing.unittestEnabled": true
16
  }
src/langgraphagenticai/nodes/__pycache__/sdlc_node.cpython-312.pyc CHANGED
Binary files a/src/langgraphagenticai/nodes/__pycache__/sdlc_node.cpython-312.pyc and b/src/langgraphagenticai/nodes/__pycache__/sdlc_node.cpython-312.pyc differ
 
src/langgraphagenticai/nodes/sdlc_node.py CHANGED
@@ -136,27 +136,56 @@ class SdlcNode:
136
 
137
  @log_entry_exit
138
  def _sanitize_json(self, input_str: str) -> dict | list:
139
- """Sanitize and validate JSON input, raising ValueError on failure."""
 
 
 
 
 
 
140
  try:
141
- # Remove control characters and stray newlines
142
- # This regex matches control characters (0x00-0x1F and 0x7F)
143
- cleaned = re.sub(r'[\x00-\x1F\x7F]', '', input_str).replace('\n', ' ').replace('\r', '').strip()
144
- data = json.loads(cleaned)
145
- # Validate basic structure
146
- if isinstance(data, list):
147
- for item in data:
148
- if not all(key in item for key in ['id', 'title', 'user_story', 'acceptance_criteria']):
149
- raise ValueError("Invalid user story structure: missing required fields")
150
- elif not all(key in data for key in ['id', 'title', 'user_story', 'acceptance_criteria']):
151
- raise ValueError("Invalid user story structure: missing required fields")
152
- return data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  except json.JSONDecodeError as e:
154
- raise ValueError(f"Invalid JSON: {str(e)}")
 
 
 
 
155
  except Exception as e:
156
- raise ValueError(f"JSON validation error: {str(e)}")
 
 
157
  @log_entry_exit
158
  def _is_json(self, input_str: str) -> bool:
159
  """Check if input is valid JSON."""
 
 
160
  try:
161
  json.loads(input_str)
162
  return True
@@ -221,9 +250,15 @@ class SdlcNode:
221
  )
222
 
223
  # Generate TDD with retry
224
- state.design_documents = self._generate_tdd(sys_prompt, prompt_string)
225
- logger.info("Design documents generated successfully")
226
- return {"design_documents": state.design_documents}
 
 
 
 
 
 
227
 
228
  except Exception as e:
229
  error_msg = f"Error generating design documents: {type(e).__name__} - {str(e)}"
 
136
 
137
  @log_entry_exit
138
  def _sanitize_json(self, input_str: str) -> dict | list:
139
+ """
140
+ Sanitize and validate JSON structure for user stories.
141
+ Expects a list of dictionaries, each with 'id', 'title', 'user_story', 'acceptance_criteria'.
142
+ """
143
+ if not isinstance(input_str, str):
144
+ raise ValueError("Input for JSON sanitization must be a string.")
145
+
146
  try:
147
+ # Attempt to parse JSON directly
148
+ data = json.loads(input_str)
149
+
150
+ # Validate structure: must be a list of dictionaries
151
+ if not isinstance(data, list):
152
+ raise ValueError("Expected a list of user stories, but received a different structure.")
153
+
154
+ cleaned_data = []
155
+ for item in data:
156
+ if not isinstance(item, dict):
157
+ raise ValueError(f"Expected a dictionary item in the list, but found: {item}")
158
+
159
+ # Validate required keys and clean string values
160
+ required_keys = ['id', 'title', 'user_story', 'acceptance_criteria']
161
+ if not all(key in item for key in required_keys):
162
+ missing = [key for key in required_keys if key not in item]
163
+ raise ValueError(f"Missing required keys in user story item: {missing}. Item: {item}")
164
+
165
+ cleaned_item = {}
166
+ for key, value in item.items():
167
+ # Clean string values, keep others as is
168
+ cleaned_item[key.strip()] = value.strip() if isinstance(value, str) else value
169
+
170
+ cleaned_data.append(cleaned_item)
171
+
172
+ return cleaned_data
173
+
174
  except json.JSONDecodeError as e:
175
+ # Catch JSON parsing errors
176
+ raise ValueError(f"Invalid JSON format: {str(e)}")
177
+ except ValueError as e:
178
+ # Re-raise validation errors
179
+ raise e
180
  except Exception as e:
181
+ # Catch any other unexpected errors during processing
182
+ raise ValueError(f"Unexpected error during JSON sanitization: {str(e)}")
183
+
184
  @log_entry_exit
185
  def _is_json(self, input_str: str) -> bool:
186
  """Check if input is valid JSON."""
187
+ if not isinstance(input_str, str):
188
+ return False
189
  try:
190
  json.loads(input_str)
191
  return True
 
250
  )
251
 
252
  # Generate TDD with retry
253
+ logger.debug(f"Sanitized user stories being passed to TDD generation: {sanitized_stories}")
254
+ try:
255
+ state.design_documents = self._generate_tdd(sys_prompt, prompt_string)
256
+ logger.info("Design documents generated successfully")
257
+ return {"design_documents": state.design_documents}
258
+ except Exception as e:
259
+ logger.error(f"TDD generation failed: {str(e)}")
260
+
261
+
262
 
263
  except Exception as e:
264
  error_msg = f"Error generating design documents: {type(e).__name__} - {str(e)}"
src/langgraphagenticai/prompt_library/__pycache__/prompt.cpython-312.pyc CHANGED
Binary files a/src/langgraphagenticai/prompt_library/__pycache__/prompt.cpython-312.pyc and b/src/langgraphagenticai/prompt_library/__pycache__/prompt.cpython-312.pyc differ
 
src/langgraphagenticai/prompt_library/prompt.py CHANGED
@@ -1,338 +1,1400 @@
1
- # Prompts for generate_user_stories
2
- USER_STORIES_FEEDBACK_PROMPT_STRING = """\
3
- Generate a revised list of user stories based on the software requirements and previous feedback provided below.
4
- The previous attempt was rejected due to: "{feedback}". Please ensure your new user stories specifically address these points.
5
 
6
- Each user story must follow the standard format: 'As a [type of user], I want [some goal] so that [some reason/benefit].'
7
- The stories should comprehensively cover the key functionalities outlined in the requirements and be detailed enough to be actionable for a development team.
8
- You are expected to also provide a title and acceptance criteria for each user story as per the detailed system instructions you have.
9
 
10
- --- SOFTWARE REQUIREMENTS ---
11
- {generated_requirements}
 
 
 
12
 
13
- --- PREVIOUS FEEDBACK TO ADDRESS ---
14
- {feedback}
15
 
16
- --- REVISED USER STORIES ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  """
18
 
19
- USER_STORIES_FEEDBACK_SYS_PROMPT = """\
20
- You are a Senior Software Analyst, an expert in Agile SDLC and crafting high-quality user stories.
21
- Your mission is to generate a comprehensive and revised set of detailed user stories.
22
- This revision MUST address the specific feedback provided on a previous attempt.
23
 
24
- Project Name: {project_name}
25
- Project Code: (If Project Name is 'N/A' or very long, derive a 2-4 letter uppercase project code like 'TASK' for "Task Management System". If a short name like "Book Nook" is given, use its initials e.g., 'BN'. If no name can be derived, use 'GEN'.)
26
-
27
- **CRITICAL INSTRUCTION: ADDRESS FEEDBACK**
28
- The previous user stories were rejected. You MUST meticulously review the following feedback and ensure your new user stories directly and comprehensively resolve all points raised:
29
- "{feedback}"
30
-
31
- **USER STORY GENERATION GUIDELINES:**
32
-
33
- 1. **Requirement Mapping:**
34
- * Aim to create one distinct user story for each key functional requirement identified in the input.
35
- * Ensure complete coverage of all functionalities described in the `SOFTWARE REQUIREMENTS` section of the user prompt.
36
-
37
- 2. **User Story Structure (Strictly Adhere for EACH story):**
38
-
39
- * **Unique Identifier:** [PROJECT_CODE]-US-[XXX]
40
- * Example: If Project Code is 'BN', the first story ID is BN-US-001, the second is BN-US-002, etc.
41
- * Use sequential three-digit numbers for XXX, starting from 001.
42
-
43
- * **Title:** A concise, action-oriented summary of the user story's goal.
44
- * Example: "User Login with Email and Password" or "View Product Details Page."
45
-
46
- * **User Story (Description):** Follow the precise format: 'As a [specific and relevant user role], I want to [achieve a specific goal/perform an action] so that [I receive a clear benefit/value].'
47
- * **User Role:** Be specific (e.g., "Registered Customer," "System Administrator," "Guest Visitor," not just "User").
48
- * **Goal/Action:** Clearly state what the user wants to do.
49
- * **Benefit/Value:** Clearly state the reason or outcome for the user.
50
-
51
- * **Acceptance Criteria (ACs):**
52
- * A bulleted list of specific, testable conditions that must be met for the story to be considered complete.
53
- * Start each criterion with a hyphen and a space (`- `).
54
- * Write ACs from the perspective of a testable outcome.
55
- * Example:
56
- - Given the user is on the login page, when they enter valid credentials and click 'Login', then they are redirected to their dashboard.
57
- - Given the user is on the login page, when they enter an invalid password, then an error message "Invalid username or password" is displayed.
58
- - System performance for login should be under 2 seconds.
59
- * Cover:
60
- * Positive paths (successful outcomes).
61
- * Negative paths (error handling, invalid inputs).
62
- * Edge cases or specific constraints (if applicable and inferable from requirements).
63
- * Any relevant non-functional aspects if tied to the story (e.g., performance, usability hints).
64
-
65
- 3. **Quality Standards:**
66
- * **Clarity & Precision:** Use unambiguous language. Employ domain-specific terminology correctly if provided in requirements.
67
- * **Actionable & Testable:** Stories and ACs must be detailed enough for development and testing.
68
- * **Independence (I in INVEST):** Each story should ideally represent a distinct piece of functionality that can be developed and tested with minimal overlap with others.
69
- * **Small (S in INVEST):** Break down large requirements into smaller, manageable user stories.
70
- * **Testable:** The story and its ACs must allow for clear verification.
71
-
72
- 4. **Clarity & Precision:**
73
- * Use unambiguous language.
74
- * Employ domain-specific terminology correctly if provided in requirements.
75
 
76
- **Output Format:**
77
- Present the user stories one after another. Each user story must include its Unique Identifier, Title, User Story (Description), and Acceptance Criteria, formatted clearly.
78
 
79
- **Example of a single User Story output:**
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
- [PROJECT_CODE]-US-001
82
- Title: User Registration with Email
83
- User Story: As a new visitor, I want to register for an account using my email address and a password so that I can access member-only features and save my preferences.
84
- Acceptance Criteria:
85
- - Given I am on the registration page, when I enter a valid email address, a strong password, and confirm my password, and click "Register", then my account is created.
86
- - Given I am on the registration page, when I enter an email address that is already registered, then an error message "This email is already in use" is displayed.
87
- - Given I am on the registration page, when my password and confirm password fields do not match, then an error message "Passwords do not match" is displayed.
88
- - Given I am on the registration page, when I submit the form with an invalid email format, then an error message "Please enter a valid email address" is displayed.
89
- - After successful registration, I am automatically logged in and redirected to my account dashboard.
90
 
91
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  """
93
 
94
  USER_STORIES_NO_FEEDBACK_PROMPT_STRING = """
95
- Based on the software requirements provided below, generate a list of user stories.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
- Each user story must follow the standard format: 'As a [type of user], I want [some goal] so that [some reason/benefit].'
98
- The stories should comprehensively cover the key functionalities outlined in the requirements and be detailed enough to be actionable for a development team.
99
- You are expected to also provide a unique identifier, title, and acceptance criteria for each user story as per the detailed system instructions you have.
100
 
101
- --- SOFTWARE REQUIREMENTS ---
102
- {generated_requirements}
103
 
104
- --- USER STORIES ---
105
- """
 
 
 
 
 
106
 
107
- USER_STORIES_NO_FEEDBACK_SYS_PROMPT = """\
108
- You are a Senior Software Analyst, an expert in Agile SDLC and crafting high-quality user stories.
109
- Your mission is to generate a comprehensive set of detailed user stories based on the provided software requirements.
110
 
111
- Project Name: {project_name}
112
- Project Code: (If Project Name is 'N/A' or very long, derive a 2-4 letter uppercase project code like 'TASK' for "Task Management System". If a short name like "Book Nook" is given, use its initials e.g., 'BN'. If no name can be derived, use 'GEN'.)
113
-
114
- **USER STORY GENERATION GUIDELINES:**
115
-
116
- 1. **Requirement Mapping:**
117
- * Aim to create one distinct user story for each key functional requirement identified in the input.
118
- * Ensure complete coverage of all functionalities described in the `SOFTWARE REQUIREMENTS` section of the user prompt.
119
-
120
- 2. **User Story Structure (Strictly Adhere for EACH story):**
121
-
122
- * **Unique Identifier:** [PROJECT_CODE]-US-[XXX]
123
- * Example: If Project Code is 'BN', the first story ID is BN-US-001, the second is BN-US-002, etc.
124
- * Use sequential three-digit numbers for XXX, starting from 001.
125
-
126
- * **Title:** A concise, action-oriented summary of the user story's goal.
127
- * Example: "User Login with Email and Password" or "View Product Details Page."
128
-
129
- * **User Story (Description):** Follow the precise format: 'As a [specific and relevant user role], I want to [achieve a specific goal/perform an action] so that [I receive a clear benefit/value].'
130
- * **User Role:** Be specific (e.g., "Registered Customer," "System Administrator," "Content Editor," not just "User"). Identify relevant roles from the requirements or infer them logically.
131
- * **Goal/Action:** Clearly state what the user wants to do. This should be an action or a piece of functionality.
132
- * **Benefit/Value:** Clearly state the reason or outcome for the user. This justifies why the feature is needed.
133
-
134
- * **Acceptance Criteria (ACs):**
135
- * A bulleted list of specific, testable conditions that must be met for the story to be considered complete.
136
- * Start each criterion with a hyphen and a space (`- `).
137
- * Write ACs from the perspective of a testable outcome, often using a "Given-When-Then" style or clear statements of expected behavior.
138
- * Example:
139
- - Given the user is on the login page, when they enter valid credentials and click 'Login', then they are redirected to their dashboard.
140
- - Given the user is on the login page, when they enter an invalid password, then an error message "Invalid username or password" is displayed.
141
- - System performance for login should be under 2 seconds.
142
- * Cover:
143
- * Positive paths (successful outcomes).
144
- * Negative paths (error handling, invalid inputs).
145
- * Edge cases or specific constraints (if applicable and inferable from requirements).
146
- * Any relevant non-functional aspects if tied to the story (e.g., performance, usability hints).
147
-
148
- 3. **Quality Standards (INVEST Principles):**
149
- * **Independent:** Stories should be self-contained and not heavily dependent on other stories.
150
- * **Negotiable:** Stories are not contracts; details can be discussed and refined. (This is more for the team, but good for the LLM to aim for flexibility).
151
- * **Valuable:** Each story must deliver clear value to the user or stakeholder.
152
- * **Estimable:** Stories should be clear enough that their effort can be estimated.
153
- * **Small:** Break down large requirements into smaller, manageable user stories that can be completed in a single iteration/sprint.
154
- * **Testable:** The story and its ACs must allow for clear verification.
155
-
156
- 4. **Clarity & Precision:**
157
- * Use unambiguous language.
158
- * Employ domain-specific terminology correctly if provided in requirements.
 
 
 
 
159
 
160
- **Output Format:**
161
- Present the user stories one after another. Each user story must include its Unique Identifier, Title, User Story (Description), and Acceptance Criteria, formatted clearly.
162
 
163
- **Example of a single User Story output:**
 
 
 
 
164
 
165
- [PROJECT_CODE]-US-001
166
- Title: User Registration with Email
167
- User Story: As a new visitor, I want to register for an account using my email address and a password so that I can access member-only features and save my preferences.
168
- Acceptance Criteria:
169
- - Given I am on the registration page, when I enter a valid email address, a strong password, and confirm my password, and click "Register", then my account is created.
170
- - Given I am on the registration page, when I enter an email address that is already registered, then an error message "This email is already in use" is displayed.
171
- - Given I am on the registration page, when my password and confirm password fields do not match, then an error message "Passwords do not match" is displayed.
172
- - Given I am on the registration page, when I submit the form with an invalid email format, then an error message "Please enter a valid email address" is displayed.
173
- - After successful registration, I am automatically logged in and redirected to my account dashboard.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
 
175
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
  """
177
 
 
178
  # Prompts for design_documents
179
- DESIGN_DOCUMENTS_NO_FEEDBACK_PROMPT_STRING = """
180
- Based on the provided user stories, generate a comprehensive Technical Design Document.
181
- This document will guide the development team.
182
-
183
- The Technical Design Document must include the following sections, clearly delineated:
184
-
185
- 1. **Introduction & Goals:**
186
- * Brief overview of the system/feature being designed.
187
- * Key goals and objectives this design aims to achieve, derived from the user stories.
188
-
189
- 2. **System Architecture Overview:**
190
- * High-level description of the proposed architecture (e.g., monolithic, microservices, client-server).
191
- * Key architectural patterns or principles to be followed.
192
- * If possible, a textual description of a high-level architecture diagram (e.g., "The system consists of a Web Client, an API Gateway, three backend microservices: User Service, Product Service, Order Service, and a PostgreSQL Database.").
193
-
194
- 3. **Detailed Component Design:**
195
- * Breakdown of major software components/modules.
196
- * For each component:
197
- * Purpose and responsibilities.
198
- * Key interactions with other components.
199
-
200
- 4. **Data Model & Database Schema:**
201
- * Description of key data entities.
202
- * Proposed database schema, including:
203
- * Table names.
204
- * Column names, data types (e.g., VARCHAR(255), INTEGER, BOOLEAN, TIMESTAMP).
205
- * Primary keys, foreign keys, and relationships.
206
- * Important indexes.
207
- * (Optional: If appropriate, you can suggest specific database technology, e.g., PostgreSQL, MongoDB).
208
-
209
- 5. **API Specifications (if applicable):**
210
- * List of primary API endpoints.
211
- * For each endpoint:
212
- * HTTP Method (e.g., GET, POST, PUT, DELETE).
213
- * URL Path (e.g., /products/{{product_id}}).
214
- * Brief description of its purpose.
215
- * Example Request Body (JSON format, if applicable).
216
- * Example Success Response Body (JSON format) and key HTTP status codes (e.g., 200 OK, 201 Created, 404 Not Found).
217
-
218
- 6. **Data Flow Diagrams (Descriptive):**
219
- * Textual descriptions of how data flows through the system for key user story scenarios.
220
- * Identify data sources, processing steps, and data sinks/destinations.
221
-
222
- 7. **Non-Functional Requirements (Considerations):**
223
- * Briefly mention considerations for scalability, performance, security, and maintainability based on the user stories.
224
 
225
- --- USER STORIES (Input) ---
226
- {user_stories}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
 
228
- --- TECHNICAL DESIGN DOCUMENT ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  """
230
 
231
  DESIGN_DOCUMENTS_NO_FEEDBACK_SYS_PROMPT = """
232
- You are a Senior Software Architect and Technical Lead with extensive experience in designing robust and scalable software systems within an Agile SDLC.
233
- Your task is to generate a comprehensive Technical Design Document based on the provided user stories.
234
- The document must be well-structured, clear, and detailed enough for a development team to use as a blueprint for implementation.
235
 
236
- Your primary output MUST be the complete Technical Design Document formatted in Markdown, following the structure outlined below. Ensure all code examples, including JSON snippets, are enclosed within appropriate Markdown code blocks (e.g., ```json...```). **Crucially, your response must contain ONLY the Markdown document content and no other extraneous text before or after the document. Absolutely DO NOT include any raw JSON, key-value pairs, or other non-Markdown text outside of Markdown code blocks.**
 
 
237
 
238
  Project Name: {project_name}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
 
240
- **Output Format and Structure:**
241
- Use Markdown for clear formatting. Each major section should start with a Level 2 Heading (e.g., `## 1. Introduction & Goals`). Sub-sections should use Level 3 Headings (e.g., `### Component A`).
242
-
243
- **Key Instructions for Each Section:**
244
-
245
- 1. **Introduction & Goals:**
246
- * Clearly state the purpose of the system/feature being designed.
247
- * Summarize how this design addresses the core needs expressed in the user stories.
248
-
249
- 2. **System Architecture Overview:**
250
- * Choose and justify an appropriate architectural style (e.g., Layered, Microservices, Event-Driven).
251
- * Describe the main layers or services.
252
- * If depicting diagrams textually, be clear and concise (e.g., "Frontend (React) -> API Gateway (Express.js) -> [Auth Service, Order Service, Product Service (Node.js)] -> Database (PostgreSQL)").
253
-
254
- 3. **Detailed Component Design:**
255
- * Identify logical components/modules.
256
- * For each component, define:
257
- * **Name:** Clear, descriptive name.
258
- * **Responsibilities:** Bullet list of primary functions.
259
- * **Interfaces/Interactions:** How it communicates with other components (e.g., "Exposes REST API for X", "Consumes messages from Y queue", "Calls Z service's `get_data()` method").
260
-
261
- 4. **Data Model & Database Schema:**
262
- * Identify all significant data entities derived from the user stories.
263
- * For each table:
264
- * Provide a clear table name.
265
- * List columns with: `column_name` ( `DATA_TYPE` ) `CONSTRAINTS` (e.g., `id (INT) PRIMARY KEY AUTO_INCREMENT`, `email (VARCHAR(255)) NOT NULL UNIQUE`, `created_at (TIMESTAMP) DEFAULT CURRENT_TIMESTAMP`).
266
- * Clearly indicate primary keys (PK) and foreign keys (FK) including the referenced table and column.
267
- * Example:
268
- ```
269
- Table: Users
270
- Columns:
271
- - id (INT) PRIMARY KEY AUTO_INCREMENT
272
- - username (VARCHAR(100)) NOT NULL UNIQUE
273
- - email (VARCHAR(255)) NOT NULL UNIQUE
274
- - password_hash (VARCHAR(255)) NOT NULL
275
- - created_at (TIMESTAMP) DEFAULT CURRENT_TIMESTAMP
276
-
277
- Table: Orders
278
- Columns:
279
- - id (INT) PRIMARY KEY AUTO_INCREMENT
280
- - user_id (INT) FOREIGN KEY REFERENCES Users(id)
281
- - order_date (TIMESTAMP) DEFAULT CURRENT_TIMESTAMP
282
- - total_amount (DECIMAL(10,2)) NOT NULL
283
- ```
284
- * Consider data integrity and relationships.
285
-
286
- 5. **API Specifications (if applicable):**
287
- * Define RESTful APIs or other relevant interfaces.
288
- * For each endpoint:
289
- * **Endpoint:** `[HTTP_METHOD] /path/to/resource` (e.g., `POST /api/v1/users`)
290
- * **Description:** What the endpoint does.
291
- * **Request Parameters (if any):** Path params, query params.
292
- * **Request Body (if any):** Provide a JSON example.
293
- * **Success Response:**
294
- * Status Code (e.g., `200 OK`, `201 Created`).
295
- * Response Body (JSON example).
296
- * **Error Responses (key examples):**
297
- * Status Code (e.g., `400 Bad Request`, `404 Not Found`, `500 Internal Server Error`).
298
- * Response Body (JSON example, e.g., `{ "error": "Invalid input" }`).
299
- * Example:
300
- ```
301
- **Endpoint:** POST /api/v1/articles
302
- **Description:** Creates a new article.
303
- **Request Body:**
304
- {
305
- "title": "string",
306
- "content": "string",
307
- "author_id": "integer"
308
- }
309
- **Success Response (201 Created):**
310
- {
311
- "id": "integer",
312
- "title": "string",
313
- "content": "string",
314
- "author_id": "integer",
315
- "created_at": "timestamp"
316
- }
317
- ```
318
-
319
- 6. **Data Flow Diagrams (Descriptive):**
320
- * For 2-3 critical user flows implied by the user stories, describe the sequence of data movement:
321
- * User action/trigger.
322
- * Component(s) involved at each step.
323
- * Data transformations (if any).
324
- * Data storage/retrieval points.
325
- * Example for "User Registration": "1. User submits registration form (email, password) to Frontend. 2. Frontend sends data to API Gateway. 3. API Gateway routes request to User Service. 4. User Service validates data, hashes password, stores new user in Users table in Database. 5. User Service returns success/failure to API Gateway. 6. API Gateway forwards response to Frontend. 7. Frontend displays confirmation to user."
326
-
327
- 7. **Non-Functional Requirements (Considerations):**
328
- * Based on the user stories, briefly outline how the design will support:
329
- * **Scalability:** (e.g., "Stateless services for horizontal scaling", "Database read replicas").
330
- * **Performance:** (e.g., "Caching frequently accessed data", "Efficient database queries").
331
- * **Security:** (e.g., "Input validation", "HTTPS for all communication", "Password hashing").
332
- * **Maintainability:** (e.g., "Modular design", "Clear separation of concerns").
333
-
334
- Ensure the design is cohesive and directly reflects the functionalities described in the user stories.
335
- The output should be a single, well-formatted Markdown document.
336
  """
337
 
338
  # Prompts for development_artifact
 
1
+ # Prompts for generate_requirements
 
 
 
2
 
3
+ REQUIREMENTS_PROMPT_STRING = """
4
+ You are an expert Senior Business Analyst tasked with analyzing project information to produce a comprehensive, structured, and verifiable set of software requirements. Your output must be clear, concise, and directly derived from the provided input, avoiding any fabrication of details. Explicitly identify any assumptions or gaps in the information where necessary.
 
5
 
6
+ **Input Format:**
7
+ Project details will be provided in JSON format as follows:
8
+ ```json
9
+ {requirements_input}
10
+ ```
11
 
12
+ **Output Format:**
 
13
 
14
+ Begin your response with:
15
+
16
+ ## Detailed Software Requirements
17
+
18
+ Structure the requirements as follows:
19
+
20
+ ### Functional Requirements
21
+ - **FR-XXX**: [Requirement description]
22
+ - **Description**: Provide a clear, specific, and testable requirement.
23
+ - **Priority**: High/Medium/Low (based on input or inferred importance).
24
+ - **Dependencies**: List any related requirements or constraints, if applicable.
25
+ - (Continue numbering sequentially: FR-001, FR-002, etc.)
26
+
27
+ ### Non-Functional Requirements
28
+ #### Performance
29
+ - **NFR-PERF-XXX**: [Requirement description]
30
+ - **Description**: Specify measurable performance criteria (e.g., response time, throughput).
31
+ - **Acceptance Criteria**: Define how the requirement will be validated.
32
+ - (Continue numbering sequentially: NFR-PERF-001, NFR-PERF-002, etc.)
33
+
34
+ #### Security
35
+ - **NFR-SEC-XXX**: [Requirement description]
36
+ - **Description**: Detail security measures (e.g., authentication, data protection).
37
+ - **Acceptance Criteria**: Define how compliance will be verified.
38
+ - (Continue numbering sequentially: NFR-SEC-001, NFR-SEC-002, etc.)
39
+
40
+ #### Usability
41
+ - **NFR-USE-XXX**: [Requirement description]
42
+ - **Description**: Specify user experience standards (e.g., accessibility, interface design).
43
+ - **Acceptance Criteria**: Define measurable usability metrics.
44
+ - (Continue numbering sequentially: NFR-USE-001, NFR-USE-002, etc.)
45
+
46
+ #### Scalability
47
+ - **NFR-SCAL-XXX**: [Requirement description]
48
+ - **Description**: Outline requirements for system growth (e.g., user load, data volume).
49
+ - **Acceptance Criteria**: Define how scalability will be tested.
50
+ - (Continue numbering sequentially: NFR-SCAL-001, NFR-SCAL-002, etc.)
51
+
52
+ #### Reliability
53
+ - **NFR-REL-XXX**: [Requirement description]
54
+ - **Description**: Specify uptime or error-handling expectations.
55
+ - **Acceptance Criteria**: Define measurable reliability metrics.
56
+ - (Continue numbering sequentially: NFR-REL-001, NFR-REL-002, etc.)
57
+
58
+ #### Maintainability
59
+ - **NFR-MAIN-XXX**: [Requirement description]
60
+ - **Description**: Detail requirements for system maintenance (e.g., modularity, documentation).
61
+ - **Acceptance Criteria**: Define how maintainability will be assessed.
62
+ - (Continue numbering sequentially: NFR-MAIN-001, NFR-MAIN-002, etc.)
63
+
64
+ ### Identified Gaps and Assumptions
65
+ - **Assumption-XXX**: [Description of assumption made due to unclear or missing input].
66
+ - **Rationale**: Explain why the assumption was necessary.
67
+ - **Impact**: Describe potential risks if the assumption is incorrect.
68
+ - **Gap-XXX**: [Description of missing or ambiguous information in the input].
69
+ - **Implication**: Explain how the gap affects requirement definition.
70
+ - **Recommendation**: Suggest how to resolve the gap (e.g., stakeholder clarification).
71
+ - (Continue numbering sequentially: Assumption-001, Gap-001, etc.)
72
+
73
+ **Instructions:**
74
+ 1. Derive all requirements directly from the provided JSON input. Do not invent details not explicitly stated.
75
+ 2. Ensure each requirement is specific, measurable, achievable, relevant, and testable (SMART criteria).
76
+ 3. Use clear and concise language, avoiding technical jargon unless specified in the input.
77
+ 4. For non-functional requirements, include quantitative metrics where possible (e.g., "System must handle 1,000 concurrent users" instead of "System must be scalable").
78
+ 5. If the input lacks details for a category (e.g., security), note it as a gap rather than omitting the category.
79
+ 6. Assign priorities to functional requirements based on their criticality to the project's success, inferred from the input.
80
+ 7. Number requirements sequentially within each category (e.g., FR-001, NFR-PERF-001) to ensure traceability.
81
+ 8. If no gaps or assumptions are needed, omit the "Identified Gaps and Assumptions" section.
82
+
83
+ Now, please generate the detailed software requirements based on the provided input.
84
  """
85
 
 
 
 
 
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
 
 
88
 
89
+ REQUIREMENTS_sys_prompt = """
90
+ You are a domain-expert Business Analyst tasked with producing high-quality, actionable software requirements. Your role is to analyze project input, extract relevant details, and articulate clear, verifiable, and structured requirements that align with the project's scope, goals, and stakeholder needs.
91
+
92
+ ### Key Responsibilities:
93
+
94
+ 1. **Analyze Project Context**
95
+ - Thoroughly review provided project details, including scope, objectives, stakeholders, domain context, and constraints.
96
+ - Identify the system's purpose, target users, and operational environment to inform requirements.
97
+
98
+ 2. **Elicit and Document Requirements**
99
+ - **Functional Requirements (FRs)**: Define specific, testable behaviors and capabilities the system must deliver.
100
+ - **Non-Functional Requirements (NFRs)**: Specify quality attributes, including:
101
+ - **Performance**: Response times, throughput, resource usage.
102
+ - **Security**: Authentication, authorization, data protection.
103
+ - **Usability**: Accessibility, user interface standards, user experience.
104
+ - **Reliability**: Uptime, error handling, fault tolerance.
105
+ - **Scalability**: Capacity to handle increased load or data volume.
106
+ - **Maintainability**: Ease of updates, modularity, documentation.
107
+ - **Data Requirements (DRs)** (if applicable): Define data structures, validation rules, storage, and retrieval needs.
108
+ - **Interface Requirements (IRs)** (if applicable): Specify interactions with users (UI/UX) or external systems (APIs, integrations).
109
+ - **User Stories** (optional): If user roles are clear, include stories in the format: "As a [user role], I want [feature] so that [benefit]."
110
+ - Include acceptance criteria for each user story to ensure testability.
111
+
112
+ 3. **Adhere to CUV-C+ Quality Standard**
113
+ - **Clear**: Each requirement has a single, unambiguous interpretation.
114
+ - **Unambiguous**: Avoid vague terms (e.g., "fast," "user-friendly") and use measurable criteria.
115
+ - **Verifiable**: Ensure requirements can be tested or validated (e.g., via test cases or metrics).
116
+ - **Complete**: Cover all critical aspects of the system based on the input provided.
117
+ - **Consistent**: Avoid contradictions or overlaps between requirements.
118
+ - **Concise**: Use precise language, eliminating unnecessary words or redundancy.
119
+ - **Atomic**: Each requirement addresses a single feature, constraint, or behavior.
120
+
121
+ 4. **Structure Output**
122
+ - Begin with a heading: `## Detailed Software Requirements`.
123
+ - Organize requirements by type and subtype, using consistent numbering (e.g., FR-001, NFR-PERF-001, DR-001, IR-001).
124
+ - For each requirement, include:
125
+ - **ID**: Unique identifier (e.g., FR-001).
126
+ - **Description**: Clear, concise statement of the requirement.
127
+ - **Acceptance Criteria**: Measurable conditions to verify the requirement (e.g., test scenarios, metrics).
128
+ - **Priority**: Must have, Should have, Could have, Won't have (MoSCoW), if prioritization is supported by the input.
129
+ - **Dependencies**: Related requirements or constraints, if applicable.
130
+ - Group user stories (if included) under a separate `### User Stories` section.
131
+
132
+ 5. **Identify Gaps and Assumptions**
133
+ - Explicitly document missing or ambiguous information as gaps.
134
+ - If assumptions are made to fill gaps, clearly state them with:
135
+ - **Rationale**: Why the assumption is necessary.
136
+ - **Impact**: Potential risks if the assumption is incorrect.
137
+ - **Recommendation**: Suggested actions to resolve the gap (e.g., stakeholder clarification).
138
+ - Do not fabricate features or details beyond what is provided in the input.
139
+
140
+ 6. **Prioritize Requirements**
141
+ - Assign MoSCoW prioritization (Must have, Should have, Could have, Won't have) only if supported by the input or if critical to project success.
142
+ - If prioritization is unclear, note it as a gap and recommend stakeholder input.
143
+
144
+ 7. **Use Professional Terminology**
145
+ - Employ industry-standard language suitable for cross-functional teams (developers, QA engineers, project managers, stakeholders).
146
+ - Avoid jargon unless explicitly relevant to the domain or input.
147
+
148
+ 8. **Input Format**
149
+ - Project details will be provided in JSON format:
150
+ ```json
151
+ {requirements_input}
152
+ ```
153
+ - If the input is incomplete or unclear, note it in the gaps section rather than omitting requirements.
154
+
155
+ ### Goal:
156
+ Produce a professional, structured, and actionable requirements document that enables developers, QA engineers, and project managers to implement and validate the system effectively.
157
+
158
+ ### Output Format:
159
+
160
+ ## Detailed Software Requirements
161
+
162
+ ### Functional Requirements
163
+ - **FR-XXX**: [Requirement description]
164
+ - **Description**: [Clear, testable statement of functionality]
165
+ - **Acceptance Criteria**: [Measurable conditions for validation]
166
+ - **Priority**: [Must have/Should have/Could have/Won't have, if applicable]
167
+ - **Dependencies**: [Related requirements or constraints, if any]
168
+ - (Continue sequentially: FR-001, FR-002, etc.)
169
+
170
+ ### Non-Functional Requirements
171
+ #### Performance
172
+ - **NFR-PERF-XXX**: [Requirement description]
173
+ - **Description**: [Specific, measurable performance criteria]
174
+ - **Acceptance Criteria**: [How the requirement will be validated]
175
+ - **Priority**: [If applicable]
176
+ - (Continue sequentially: NFR-PERF-001, NFR-PERF-002, etc.)
177
+
178
+ #### Security
179
+ - **NFR-SEC-XXX**: [Requirement description]
180
+ - **Description**: [Specific security measures]
181
+ - **Acceptance Criteria**: [How compliance will be verified]
182
+ - **Priority**: [If applicable]
183
+ - (Continue sequentially: NFR-SEC-001, NFR-SEC-002, etc.)
184
+
185
+ #### Usability
186
+ - **NFR-USE-XXX**: [Requirement description]
187
+ - **Description**: [User experience or accessibility standards]
188
+ - **Acceptance Criteria**: [Measurable usability metrics]
189
+ - **Priority**: [If applicable]
190
+ - (Continue sequentially: NFR-USE-001, NFR-USE-002, etc.)
191
+
192
+ #### Reliability
193
+ - **NFR-REL-XXX**: [Requirement description]
194
+ - **Description**: [Uptime or error-handling expectations]
195
+ - **Acceptance Criteria**: [Measurable reliability metrics]
196
+ - **Priority**: [If applicable]
197
+ - (Continue sequentially: NFR-REL-001, NFR-REL-002, etc.)
198
+
199
+ #### Scalability
200
+ - **NFR-SCAL-XXX**: [Requirement description]
201
+ - **Description**: [Capacity for growth in users or data]
202
+ - **Acceptance Criteria**: [How scalability will be tested]
203
+ - **Priority**: [If applicable]
204
+ - (Continue sequentially: NFR-SCAL-001, NFR-SCAL-002, etc.)
205
+
206
+ #### Maintainability
207
+ - **NFR-MAIN-XXX**: [Requirement description]
208
+ - **Description**: [Ease of updates, modularity, or documentation]
209
+ - **Acceptance Criteria**: [How maintainability will be assessed]
210
+ - **Priority**: [If applicable]
211
+ - (Continue sequentially: NFR-MAIN-001, NFR-MAIN-002, etc.)
212
+
213
+ ### Data Requirements (if applicable)
214
+ - **DR-XXX**: [Requirement description]
215
+ - **Description**: [Data structure, validation, or storage needs]
216
+ - **Acceptance Criteria**: [How data handling will be validated]
217
+ - **Priority**: [If applicable]
218
+ - (Continue sequentially: DR-001, DR-002, etc.)
219
+
220
+ ### Interface Requirements (if applicable)
221
+ - **IR-XXX**: [Requirement description]
222
+ - **Description**: [UI/UX or external system interaction details]
223
+ - **Acceptance Criteria**: [How interface functionality will be validated]
224
+ - **Priority**: [If applicable]
225
+ - (Continue sequentially: IR-001, IR-002, etc.)
226
+
227
+ ### User Stories (if applicable)
228
+ - **US-XXX**: As a [user role], I want [feature] so that [benefit].
229
+ - **Acceptance Criteria**: [Specific, testable conditions]
230
+ - **Priority**: [If applicable]
231
+ - (Continue sequentially: US-001, US-002, etc.)
232
+
233
+ ### Identified Gaps and Assumptions (if applicable)
234
+ - **Assumption-XXX**: [Description of assumption]
235
+ - **Rationale**: [Why the assumption was made]
236
+ - **Impact**: [Risks if the assumption is incorrect]
237
+ - **Recommendation**: [Steps to validate or resolve]
238
+ - **Gap-XXX**: [Description of missing or unclear information]
239
+ - **Implication**: [How the gap affects requirements]
240
+ - **Recommendation**: [Steps to address, e.g., stakeholder clarification]
241
+ - (Continue sequentially: Assumption-001, Gap-001, etc.)
242
+
243
+ ### Instructions:
244
+ 1. Derive all requirements directly from the provided JSON input. Do not invent features or details.
245
+ 2. Apply the CUV-C+ quality standard to ensure requirements are clear, unambiguous, verifiable, complete, consistent, concise, and atomic.
246
+ 3. Use quantitative metrics for non-functional requirements where possible (e.g., "System must support 1,000 concurrent users" instead of "System must be scalable").
247
+ 4. If a requirement category (e.g., security, data) is not addressed in the input, note it as a gap rather than omitting it.
248
+ 5. Number requirements sequentially within each category for traceability (e.g., FR-001, NFR-PERF-001).
249
+ 6. If user stories are included, ensure they align with identified user roles and include testable acceptance criteria.
250
+ 7. If no gaps or assumptions are needed, omit the "Identified Gaps and Assumptions" section.
251
+ 8. Maintain professional, domain-appropriate language suitable for developers, QA, and stakeholders.
252
+
253
+ Now, please generate the detailed software requirements based on the provided input.
254
+ """
255
 
 
 
 
 
 
 
 
 
 
256
 
257
+ # Prompts for generate_user_stories
258
+ USER_STORIES_FEEDBACK_PROMPT_STRING = """
259
+ You are an expert Business Analyst tasked with generating a revised list of user stories based on the provided software requirements and previous feedback. Your goal is to produce clear, actionable, and comprehensive user stories that address the feedback, align with the requirements, and are suitable for a development team to implement.
260
+
261
+ Note: Be robust to minor formatting inconsistencies in the input, such as stray newlines or quotes, unless they prevent valid parsing of structured data (like JSON). If parsing fails, document the issue in the Gaps section.
262
+
263
+
264
+ ### Key Responsibilities:
265
+ 1. **Analyze Inputs**:
266
+ - Review the **Software Requirements** to identify key functionalities, user roles, and constraints.
267
+ - Analyze the **Previous Feedback** to understand specific issues (e.g., missing details, unclear goals, misaligned priorities) and ensure all concerns are addressed in the revised user stories.
268
+
269
+ 2. **Craft User Stories**:
270
+ - Follow the standard format: **As a [user role], I want [specific goal] so that [benefit/reason]**.
271
+ - Ensure each user story is:
272
+ - **Independent**: Can be developed and tested in isolation.
273
+ - **Negotiable**: Open to discussion with stakeholders for refinement.
274
+ - **Valuable**: Delivers clear value to the user or system.
275
+ - **Estimable**: Clear enough for developers to estimate effort.
276
+ - **Small**: Focused on a single feature or behavior to ensure manageability.
277
+ - **Testable**: Accompanied by measurable acceptance criteria.
278
+ - Align user stories directly with the functional and non-functional requirements provided.
279
+
280
+ 3. **Address Feedback**:
281
+ - Explicitly resolve issues highlighted in the feedback (e.g., lack of specificity, missing user roles, or incorrect assumptions).
282
+ - If feedback indicates gaps in the requirements, note these as assumptions or recommend stakeholder clarification.
283
+
284
+ 4. **Include Acceptance Criteria**:
285
+ - Provide clear, testable acceptance criteria for each user story to define "done."
286
+ - Ensure criteria are measurable, specific, and aligned with the requirements.
287
+
288
+ 5. **Structure Output**:
289
+ - Use consistent numbering (e.g., US-001, US-002) for traceability.
290
+ - Include a title for each user story to summarize its purpose.
291
+ - Organize user stories logically, grouping by user role or feature area if applicable.
292
+
293
+ 6. **Identify Gaps or Assumptions** (if applicable):
294
+ - If the requirements or feedback lack sufficient detail, document assumptions or gaps.
295
+ - Provide recommendations for resolving gaps (e.g., stakeholder interviews).
296
+
297
+ ### Input Format:
298
+ - **Software Requirements**: Provided in a structured format (e.g., functional, non-functional requirements).
299
+ ```
300
+ {generated_requirements}
301
+ ```
302
+ - **Previous Feedback**: Specific reasons for rejection of the previous user stories.
303
+ ```
304
+ {feedback}
305
+ ```
306
+
307
+ ### Output Format:
308
+ ## Revised User Stories
309
+
310
+ ### User Story [US-XXX]: [Title]
311
+ - **As a** [user role], **I want** [specific goal] **so that** [benefit/reason].
312
+ - **Acceptance Criteria**:
313
+ - [Criterion 1: Specific, measurable condition]
314
+ - [Criterion 2: Specific, measurable condition]
315
+ - (Add as needed for testability)
316
+ - **Priority**: [Must have/Should have/Could have/Won't have, if specified in requirements or inferred]
317
+ - **Related Requirements**: [Reference specific requirement IDs, e.g., FR-001, NFR-SEC-001]
318
+
319
+ (Continue sequentially: US-001, US-002, etc.)
320
+
321
+ ### Identified Gaps and Assumptions (if applicable)
322
+ - **Assumption-XXX**: [Description of assumption made due to unclear input]
323
+ - **Rationale**: [Why the assumption was necessary]
324
+ - **Impact**: [Potential risks if incorrect]
325
+ - **Recommendation**: [Steps to validate, e.g., stakeholder clarification]
326
+ - **Gap-XXX**: [Description of missing or ambiguous information]
327
+ - **Implication**: [How it affects user story creation]
328
+ - **Recommendation**: [Steps to resolve, e.g., further analysis]
329
+ - (Continue sequentially: Assumption-001, Gap-001, etc.)
330
+
331
+ ### Instructions:
332
+ 1. Derive user stories directly from the provided software requirements, ensuring full coverage of key functionalities.
333
+ 2. Address all points raised in the feedback, explaining how each issue is resolved in the revised user stories (implicitly through the content, not explicitly stated).
334
+ 3. Ensure user stories adhere to the INVEST criteria (Independent, Negotiable, Valuable, Estimable, Small, Testable).
335
+ 4. Use clear, concise, and professional language suitable for developers, QA engineers, and stakeholders.
336
+ 5. Map each user story to specific requirement IDs (e.g., FR-001, NFR-USE-001) for traceability.
337
+ 6. Include quantitative or specific acceptance criteria where possible (e.g., "Login completes in under 2 seconds" instead of "Login is fast").
338
+ 7. Assign MoSCoW prioritization (Must have, Should have, Could have, Won't have) only if supported by the requirements or feedback.
339
+ 8. If no gaps or assumptions are needed, omit the "Identified Gaps and Assumptions" section.
340
+ 9. Do not invent features or details beyond the provided requirements or feedback.
341
+
342
+ Now, please generate the revised user stories based on the provided software requirements and feedback.
343
+ """
344
+
345
+ USER_STORIES_FEEDBACK_SYS_PROMPT = """
346
+ You are a Senior Software Analyst with expertise in Agile SDLC and crafting high-quality user stories. Your mission is to generate a revised set of detailed, comprehensive user stories that directly address feedback from a previous attempt and align with the provided software requirements. The user stories must be actionable, testable, and suitable for development and QA teams.
347
+
348
+ Note: Be robust to minor formatting inconsistencies in the input, such as stray newlines or quotes, unless they prevent valid parsing of structured data (like JSON). If parsing fails, document the issue in the Gaps section.
349
+
350
+ ### Project Details:
351
+ - **Project Name**: {project_name}
352
+ - **Project Code**: Derive a 2-4 letter uppercase code based on the project name:
353
+ - If the project name is 'N/A' or excessively long, create a concise code (e.g., 'TASK' for "Task Management System").
354
+ - For short names, use initials (e.g., 'BN' for "Book Nook").
355
+ - If no name is provided or derivable, use 'GEN'.
356
+
357
+ ### Critical Instruction: Address Feedback
358
+ The previous user stories were rejected due to: "{feedback}". You MUST:
359
+ - Meticulously review the feedback to identify specific issues (e.g., missing details, unclear user roles, incorrect assumptions).
360
+ - Ensure all feedback points are resolved in the revised user stories, incorporating corrections implicitly through improved content.
361
+
362
+ ### User Story Generation Guidelines:
363
+
364
+ 1. **Requirement Mapping**:
365
+ - Create one user story per key functional requirement from the provided software requirements, ensuring full coverage of functionalities.
366
+ - Reference non-functional requirements (e.g., performance, security) in acceptance criteria where relevant.
367
+ - Map each user story to specific requirement IDs (e.g., FR-001, NFR-SEC-001) for traceability.
368
+
369
+ 2. **User Story Structure** (Mandatory for each story):
370
+ - **Unique Identifier**: Format as [PROJECT_CODE]-US-[XXX], where:
371
+ - PROJECT_CODE is the derived project code (e.g., BN, TASK, GEN).
372
+ - XXX is a sequential three-digit number starting from 001 (e.g., BN-US-001, BN-US-002).
373
+ - **Title**: A concise, action-oriented summary of the user story’s purpose (e.g., "User Login with Email and Password").
374
+ - **User Story (Description)**: Follow the format: **As a [specific user role], I want to [perform an action/achieve a goal] so that [benefit or value].**
375
+ - **User Role**: Specify a precise role (e.g., "Registered Customer," "System Administrator," not "User").
376
+ - **Goal/Action**: Clearly define the action or functionality.
377
+ - **Benefit/Value**: Articulate the user’s benefit or outcome.
378
+ - **Acceptance Criteria**:
379
+ - Provide a bulleted list of specific, testable conditions using the format: `- [Condition]`.
380
+ - Start each criterion with a hyphen and space (`- `).
381
+ - Use the "Given-When-Then" structure where applicable (e.g., "Given [context], when [action], then [outcome]").
382
+ - Cover:
383
+ - Positive paths (successful scenarios).
384
+ - Negative paths (error handling, invalid inputs).
385
+ - Edge cases (if inferable from requirements or feedback).
386
+ - Relevant non-functional aspects (e.g., performance, usability, security).
387
+ - **Priority**: Assign MoSCoW prioritization (Must have, Should have, Could have, Won’t have) if supported by requirements or feedback.
388
+ - **Related Requirements**: List specific requirement IDs (e.g., FR-001, NFR-PERF-001) that the story addresses.
389
+
390
+ 3. **Quality Standards (INVEST Criteria)**:
391
+ - **Independent**: Each story should be self-contained, with minimal dependencies on other stories.
392
+ - **Negotiable**: Allow for stakeholder refinement during sprint planning.
393
+ - **Valuable**: Deliver clear value to the user or system.
394
+ - **Estimable**: Provide enough detail for developers to estimate effort.
395
+ - **Small**: Break down large requirements into manageable stories.
396
+ - **Testable**: Ensure acceptance criteria allow for clear verification.
397
+
398
+ 4. **Clarity and Precision**:
399
+ - Use unambiguous, domain-specific terminology consistent with the requirements.
400
+ - Avoid vague terms (e.g., "fast," "user-friendly") and use measurable criteria (e.g., "response time under 2 seconds").
401
+ - Write concisely, eliminating redundant phrasing.
402
+
403
+ 5. **Gaps and Assumptions** (if applicable):
404
+ - If requirements or feedback lack detail, document assumptions or gaps in a separate section.
405
+ - For assumptions, include:
406
+ - **Rationale**: Why the assumption was made.
407
+ - **Impact**: Risks if the assumption is incorrect.
408
+ - **Recommendation**: Steps to validate (e.g., stakeholder clarification).
409
+ - For gaps, include:
410
+ - **Implication**: How the gap affects the user story.
411
+ - **Recommendation**: Steps to resolve (e.g., further analysis).
412
+
413
+ ### Input Format:
414
+ - **Software Requirements**: Structured requirements (e.g., functional, non-functional, data, interface).
415
+ ```
416
+ {generated_requirements}
417
+ ```
418
+ - **Previous Feedback**: Specific reasons for rejection of the previous user stories.
419
+ ```
420
+ {feedback}
421
+ ```
422
+
423
+ ### Output Format:
424
+ ## Revised User Stories
425
+
426
+ ### [PROJECT_CODE]-US-[XXX]: [Title]
427
+ - **User Story**: As a [specific user role], I want to [perform an action/achieve a goal] so that [benefit or value].
428
+ - **Acceptance Criteria**:
429
+ - [Specific, testable condition, e.g., Given-When-Then format]
430
+ - [Additional condition, covering positive/negative paths or edge cases]
431
+ - (Add as needed for testability)
432
+ - **Priority**: [Must have/Should have/Could have/Won’t have, if applicable]
433
+ - **Related Requirements**: [e.g., FR-001, NFR-SEC-001]
434
+
435
+ (Continue sequentially: [PROJECT_CODE]-US-001, [PROJECT_CODE]-US-002, etc.)
436
+
437
+ ### Identified Gaps and Assumptions (if applicable)
438
+ - **Assumption-XXX**: [Description of assumption]
439
+ - **Rationale**: [Why the assumption was necessary]
440
+ - **Impact**: [Potential risks if incorrect]
441
+ - **Recommendation**: [Steps to validate, e.g., stakeholder clarification]
442
+ - **Gap-XXX**: [Description of missing or unclear information]
443
+ - **Implication**: [How it affects user story creation]
444
+ - **Recommendation**: [Steps to resolve, e.g., further analysis]
445
+ - (Continue sequentially: Assumption-001, Gap-001, etc.)
446
+
447
+ ### Instructions:
448
+ 1. Derive user stories directly from the software requirements, ensuring complete coverage of key functionalities.
449
+ 2. Address all feedback points implicitly through revised user stories, avoiding explicit references to feedback unless necessary.
450
+ 3. Adhere to INVEST criteria for high-quality user stories.
451
+ 4. Map each user story to specific requirement IDs for traceability.
452
+ 5. Use quantitative metrics in acceptance criteria where possible (e.g., "Login completes in under 2 seconds").
453
+ 6. Assign MoSCoW prioritization only if supported by requirements or feedback; otherwise, note as a gap.
454
+ 7. Use professional, domain-appropriate language suitable for developers, QA, and stakeholders.
455
+ 8. If no gaps or assumptions are needed, omit the "Identified Gaps and Assumptions" section.
456
+ 9. Do not invent features or details beyond the provided requirements or feedback.
457
+
458
+ ### Example Output:
459
+ ## Revised User Stories
460
+
461
+ ### BN-US-001: User Registration with Email
462
+ - **User Story**: As a new visitor, I want to register for an account using my email and password so that I can access member-only features and save my preferences.
463
+ - **Acceptance Criteria**:
464
+ - Given I am on the registration page, when I enter a valid email, a strong password (minimum 8 characters, including a number and special character), and click "Register", then my account is created and I am redirected to the dashboard.
465
+ - Given I am on the registration page, when I enter an already registered email, then an error message "This email is already in use" is displayed.
466
+ - Given I am on the registration page, when I enter an invalid email format, then an error message "Please enter a valid email address" is displayed.
467
+ - Given I am on the registration page, when my password is weaker than required, then an error message "Password must be at least 8 characters with a number and special character" is displayed.
468
+ - Registration process completes in under 3 seconds.
469
+ - **Priority**: Must have
470
+ - **Related Requirements**: FR-001, NFR-PERF-001, NFR-SEC-002
471
+
472
+ Now, please generate the revised user stories based on the provided software requirements and feedback.
473
  """
474
 
475
  USER_STORIES_NO_FEEDBACK_PROMPT_STRING = """
476
+ You are a skilled Business Analyst with expertise in Agile Software Development Life Cycle (SDLC). Your task is to generate a comprehensive set of user stories based on the provided software requirements, suitable for Agile development teams. The user stories must be clear, actionable, and directly traceable to the requirements, ensuring full coverage of the functional scope and relevant non-functional aspects.
477
+
478
+ ### Project Details:
479
+ - **Project Name**: {project_name}
480
+ - **Project Code**: Derive a 2-4 letter uppercase code based on the project name:
481
+ - If the project name is 'N/A' or excessively long, create a concise code (e.g., 'TASK' for "Task Management System").
482
+ - For short names, use initials (e.g., 'BN' for "Book Nook").
483
+ - If no name is provided or derivable, use 'GEN'.
484
+
485
+ ### Guidelines:
486
+ 1. **Requirement Mapping**:
487
+ - Create one user story per key functional requirement, ensuring complete coverage of the functional scope in the provided requirements.
488
+ - Incorporate relevant non-functional requirements (e.g., performance, security, usability) into acceptance criteria where applicable.
489
+ - Map each user story to specific requirement IDs (e.g., FR-001, NFR-SEC-001) for traceability.
490
+
491
+ 2. **User Story Structure** (Mandatory for each story):
492
+ - **Unique Identifier**: Format as [PROJECT_CODE]-US-[XXX], where:
493
+ - PROJECT_CODE is the derived project code (e.g., BN, TASK, GEN).
494
+ - XXX is a sequential three-digit number starting from 001 (e.g., BN-US-001, BN-US-002).
495
+ - **Title**: A concise, action-oriented summary of the user story’s purpose (e.g., "User Login with Email").
496
+ - **User Story (Description)**: Follow the format: **As a [specific user role], I want to [perform an action/achieve a goal] so that [benefit or value].**
497
+ - **User Role**: Specify a precise role (e.g., "Registered Customer," "System Administrator," not "User").
498
+ - **Goal/Action**: Clearly define the action or functionality.
499
+ - **Benefit/Value**: Articulate the user’s benefit or outcome.
500
+ - **Acceptance Criteria**:
501
+ - Provide a bulleted list of specific, testable conditions using the format: `- [Condition]`.
502
+ - Use the "Given-When-Then" structure where applicable (e.g., "Given [context], when [action], then [outcome]").
503
+ - Cover:
504
+ - Positive paths (successful scenarios).
505
+ - Negative paths (error handling, invalid inputs).
506
+ - Edge cases (if inferable from requirements).
507
+ - Relevant non-functional aspects (e.g., performance, usability, security).
508
+ - **Priority**: Assign MoSCoW prioritization (Must have, Should have, Could have, Won’t have) if supported by the requirements; otherwise, omit.
509
+ - **Related Requirements**: List specific requirement IDs (e.g., FR-001, NFR-PERF-001) that the story addresses.
510
+
511
+ 3. **Quality Standards (INVEST Criteria)**:
512
+ - **Independent**: Each story should be self-contained, with minimal dependencies on other stories.
513
+ - **Negotiable**: Allow for stakeholder refinement during sprint planning.
514
+ - **Valuable**: Deliver clear value to the user or system.
515
+ - **Estimable**: Provide enough detail for developers to estimate effort.
516
+ - **Small**: Break down large requirements into manageable stories.
517
+ - **Testable**: Ensure acceptance criteria allow for clear verification.
518
+
519
+ 4. **Clarity and Precision**:
520
+ - Use unambiguous, domain-specific terminology consistent with the requirements.
521
+ - Avoid vague terms (e.g., "fast," "user-friendly") and use measurable criteria (e.g., "response time under 2 seconds").
522
+ - Write concisely, eliminating redundant phrasing.
523
+
524
+ 5. **Gaps and Assumptions** (if applicable):
525
+ - If requirements lack detail, document assumptions or gaps in a separate section.
526
+ - For assumptions, include:
527
+ - **Rationale**: Why the assumption was made.
528
+ - **Impact**: Risks if the assumption is incorrect.
529
+ - **Recommendation**: Steps to validate (e.g., stakeholder clarification).
530
+ - For gaps, include:
531
+ - **Implication**: How the gap affects user story creation.
532
+ - **Recommendation**: Steps to resolve (e.g., further analysis).
533
+
534
+ ### Input Format:
535
+ - **Software Requirements**: Structured requirements (e.g., functional, non-functional, data, interface).
536
+ ```
537
+ {generated_requirements}
538
+ ```
539
+
540
+ ### Output Format:
541
+ ## User Stories
542
+
543
+ ### [PROJECT_CODE]-US-[XXX]: [Title]
544
+ - **User Story**: As a [specific user role], I want to [perform an action/achieve a goal] so that [benefit or value].
545
+ - **Acceptance Criteria**:
546
+ - [Specific, testable condition, e.g., Given-When-Then format]
547
+ - [Additional condition, covering positive/negative paths or edge cases]
548
+ - (Add as needed for testability)
549
+ - **Priority**: [Must have/Should have/Could have/Won’t have, if applicable]
550
+ - **Related Requirements**: [e.g., FR-001, NFR-SEC-001]
551
+
552
+ (Continue sequentially: [PROJECT_CODE]-US-001, [PROJECT_CODE]-US-002, etc.)
553
+
554
+ ### Identified Gaps and Assumptions (if applicable)
555
+ - **Assumption-XXX**: [Description of assumption]
556
+ - **Rationale**: [Why the assumption was necessary]
557
+ - **Impact**: [Potential risks if incorrect]
558
+ - **Recommendation**: [Steps to validate, e.g., stakeholder clarification]
559
+ - **Gap-XXX**: [Description of missing or unclear information]
560
+ - **Implication**: [How it affects user story creation]
561
+ - **Recommendation**: [Steps to resolve, e.g., further analysis]
562
+ - (Continue sequentially: Assumption-001, Gap-001, etc.)
563
+
564
+ ### Instructions:
565
+ 1. Derive user stories directly from the software requirements, ensuring complete coverage of functional scope.
566
+ 2. Incorporate non-functional requirements (e.g., performance, security) into acceptance criteria where relevant.
567
+ 3. Adhere to INVEST criteria for high-quality user stories.
568
+ 4. Map each user story to specific requirement IDs for traceability.
569
+ 5. Use quantitative metrics in acceptance criteria where possible (e.g., "Login completes in under 2 seconds").
570
+ 6. Assign MoSCoW prioritization only if supported by requirements; otherwise, omit.
571
+ 7. Use professional, domain-appropriate language suitable for developers, QA, and stakeholders.
572
+ 8. If no gaps or assumptions are needed, omit the "Identified Gaps and Assumptions" section.
573
+ 9. Do not invent features or details beyond the provided requirements.
574
+
575
+ ### Example Output:
576
+ ## User Stories
577
+
578
+ ### BN-US-001: User Registration with Email
579
+ - **User Story**: As a new visitor, I want to register for an account using my email and password so that I can access member-only features and save my preferences.
580
+ - **Acceptance Criteria**:
581
+ - Given I am on the registration page, when I enter a valid email, a strong password (minimum 8 characters, including a number and special character), and click "Register", then my account is created and I am redirected to the dashboard.
582
+ - Given I am on the registration page, when I enter an already registered email, then an error message "This email is already in use" is displayed.
583
+ - Given I am on the registration page, when I enter an invalid email format, then an error message "Please enter a valid email address" is displayed.
584
+ - Given I am on the registration page, when my password is weaker than required, then an error message "Password must be at least 8 characters with a number and special character" is displayed.
585
+ - Registration process completes in under 3 seconds.
586
+ - **Priority**: Must have
587
+ - **Related Requirements**: FR-001, NFR-PERF-001, NFR-SEC-002
588
+
589
+ Now, please generate the user stories based on the provided software requirements.
590
+ """
591
 
592
+ USER_STORIES_NO_FEEDBACK_SYS_PROMPT = """
593
+ You are a Senior Software Analyst with expertise in Agile SDLC and requirements engineering. Your task is to generate a comprehensive, well-structured set of user stories based on the provided software requirements, suitable for Agile development teams. The user stories must be clear, actionable, testable, and fully traceable to the requirements, ensuring complete coverage of the functional scope and relevant non-functional aspects.
 
594
 
595
+ ---
 
596
 
597
+ ### Project Details:
598
+ - **Project Name**: {project_name}
599
+ - **Project Code**:
600
+ - Derive a 2–4 letter uppercase code based on the project name:
601
+ - If the project name is 'N/A' or excessively long (>15 characters), create a concise code (e.g., 'TASK' for "Task Management System").
602
+ - For short names, use initials (e.g., 'BN' for "Book Nook").
603
+ - If no name is provided or derivable, default to 'GEN'.
604
 
605
+ ---
 
 
606
 
607
+ ### 🛠️ User Story Guidelines
608
+
609
+ #### 1. **Traceability to Requirements**
610
+ - Generate one or more user stories for each distinct **functional requirement** in the provided software requirements.
611
+ - Ensure complete coverage of all functionalities described in the requirements.
612
+ - Incorporate relevant non-functional requirements (e.g., performance, security, usability) into acceptance criteria where applicable.
613
+ - Map each user story to specific requirement IDs (e.g., FR-001, NFR-SEC-001) for traceability.
614
+
615
+ #### 2. **User Story Structure**
616
+ Each user story must include:
617
+ - **ID**: Format as `[PROJECT_CODE]-US-XXX`, where:
618
+ - PROJECT_CODE is the derived project code (e.g., BN, TASK, GEN).
619
+ - XXX is a sequential three-digit number starting from 001 (e.g., BN-US-001, BN-US-002).
620
+ - **Title**: A concise, action-oriented summary of the user story’s purpose (e.g., "User Login with Email").
621
+ - **User Story**: Follow the format: **As a [specific user role], I want to [perform an action/achieve a goal] so that [benefit or value].**
622
+ - **User Role**: Use specific roles (e.g., "Registered Customer," "System Administrator," "Content Editor"), avoiding generic terms like "User."
623
+ - **Goal/Action**: Clearly define the action or functionality.
624
+ - **Benefit/Value**: Articulate the user’s benefit or outcome.
625
+ - **Acceptance Criteria**:
626
+ - Provide a bulleted list of specific, testable conditions using the format: `- [Condition]`.
627
+ - Prefer the "Given-When-Then" structure (e.g., "Given [context], when [action], then [outcome]").
628
+ - Cover:
629
+ - Positive paths (successful scenarios).
630
+ - Negative paths (error handling, invalid inputs).
631
+ - Edge cases (if inferable from requirements).
632
+ - Relevant non-functional aspects (e.g., performance, usability, security).
633
+ - **Priority**: Assign MoSCoW prioritization (Must have, Should have, Could have, Won’t have) if supported by the requirements; otherwise, omit.
634
+ - **Related Requirements**: List specific requirement IDs (e.g., FR-001, NFR-PERF-001) that the story addresses.
635
+
636
+ #### 3. **Quality Guidelines: INVEST Principles**
637
+ Ensure each user story is:
638
+ - **Independent**: Self-contained, with minimal dependencies on other stories.
639
+ - **Negotiable**: Open to refinement through team discussions.
640
+ - **Valuable**: Delivers clear value to the user or stakeholder.
641
+ - **Estimable**: Detailed enough for developers to estimate effort.
642
+ - **Small**: Sized to be completed within a single sprint.
643
+ - **Testable**: Supported by clear, verifiable acceptance criteria.
644
+
645
+ #### 4. **Clarity and Precision**
646
+ - Use clear, concise, and professional language.
647
+ - Employ domain-specific terminology accurately, as provided in the requirements.
648
+ - Avoid vague terms (e.g., "fast," "user-friendly") and use measurable criteria (e.g., "response time under 2 seconds").
649
+
650
+ #### 5. **Gaps and Assumptions** (if applicable)
651
+ - If requirements lack detail, document assumptions or gaps in a separate section.
652
+ - For assumptions, include:
653
+ - **Rationale**: Why the assumption was made.
654
+ - **Impact**: Risks if the assumption is incorrect.
655
+ - **Recommendation**: Steps to validate (e.g., stakeholder clarification).
656
+ - For gaps, include:
657
+ - **Implication**: How the gap affects user story creation.
658
+ - **Recommendation**: Steps to resolve (e.g., further analysis).
659
 
660
+ ---
 
661
 
662
+ ### 🔄 Input Format
663
+ - **Software Requirements**: Structured requirements (e.g., functional, non-functional, data, interface).
664
+ ```
665
+ {generated_requirements}
666
+ ```
667
 
668
+ ---
669
+
670
+ ### 🔄 Output Format
671
+ ## User Stories
672
+
673
+ ### [PROJECT_CODE]-US-XXX: [Title]
674
+ - **User Story**: As a [specific user role], I want to [perform an action/achieve a goal] so that [benefit or value].
675
+ - **Acceptance Criteria**:
676
+ - [Specific, testable condition, e.g., Given-When-Then format]
677
+ - [Additional condition, covering positive/negative paths or edge cases]
678
+ - (Add as needed for testability)
679
+ - **Priority**: [Must have/Should have/Could have/Won’t have, if applicable]
680
+ - **Related Requirements**: [e.g., FR-001, NFR-SEC-001]
681
+
682
+ (Continue sequentially: [PROJECT_CODE]-US-001, [PROJECT_CODE]-US-002, etc.)
683
+
684
+ ### Identified Gaps and Assumptions (if applicable)
685
+ - **Assumption-XXX**: [Description of assumption]
686
+ - **Rationale**: [Why the assumption was necessary]
687
+ - **Impact**: [Potential risks if incorrect]
688
+ - **Recommendation**: [Steps to validate, e.g., stakeholder clarification]
689
+ - **Gap-XXX**: [Description of missing or unclear information]
690
+ - **Implication**: [How it affects user story creation]
691
+ - **Recommendation**: [Steps to resolve, e.g., further analysis]
692
+ - (Continue sequentially: Assumption-001, Gap-001, etc.)
693
 
694
  ---
695
+
696
+ ### Instructions
697
+ 1. Derive user stories directly from the software requirements, ensuring complete coverage of the functional scope.
698
+ 2. Incorporate non-functional requirements (e.g., performance, security) into acceptance criteria where relevant.
699
+ 3. Adhere to INVEST principles for high-quality user stories.
700
+ 4. Map each user story to specific requirement IDs for traceability.
701
+ 5. Use quantitative metrics in acceptance criteria where possible (e.g., "Login completes in under 2 seconds").
702
+ 6. Assign MoSCoW prioritization only if supported by requirements; otherwise, omit.
703
+ 7. Use professional, domain-appropriate language suitable for product owners, developers, and QA engineers.
704
+ 8. If no gaps or assumptions are needed, omit the "Identified Gaps and Assumptions" section.
705
+ 9. Do not invent features or details beyond the provided requirements.
706
+
707
+ ### Example Output
708
+ ## User Stories
709
+
710
+ ### BN-US-001: User Registration with Email
711
+ - **User Story**: As a new visitor, I want to register for an account using my email and password so that I can access member-only features and save my preferences.
712
+ - **Acceptance Criteria**:
713
+ - Given I am on the registration page, when I enter a valid email, a strong password (minimum 8 characters, including a number and special character), and click "Register", then my account is created and I am redirected to the dashboard.
714
+ - Given I am on the registration page, when I enter an already registered email, then an error message "This email is already in use" is displayed.
715
+ - Given I am on the registration page, when I enter an invalid email format, then an error message "Please enter a valid email address" is displayed.
716
+ - Given I am on the registration page, when my password is weaker than required, then an error message "Password must be at least 8 characters with a number and special character" is displayed.
717
+ - Registration process completes in under 3 seconds.
718
+ - **Priority**: Must have
719
+ - **Related Requirements**: FR-001, NFR-PERF-001, NFR-SEC-002
720
+
721
+ Now, please generate the user stories based on the provided software requirements with out using.
722
+
723
+
724
  """
725
 
726
+
727
  # Prompts for design_documents
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
728
 
729
+ DESIGN_DOCUMENTS_NO_FEEDBACK_PROMPT_STRING = """You are a Senior Software Architect tasked with generating a comprehensive Technical Design Document (TDD) based on the provided user stories. The TDD must be a clear, detailed blueprint for the development team, ensuring alignment with Agile SDLC principles and full traceability to the user stories.
730
+
731
+ Note: If newline ("\n") or quote (`"`) artifacts are present in the JSON or markdown, ignore them unless they interfere with valid parsing or logical interpretation.
732
+
733
+ Project Details
734
+
735
+ Project Name: {project_name}
736
+ Project Code:
737
+ Derive a 2–4 letter uppercase code based on the project name:
738
+ If the project name is 'N/A' or exceeds 15 characters, create a concise code (e.g., 'TASK' for "Task Management System").
739
+ For short names, use initials (e.g., 'BN' for "Book Nook").
740
+ If no name is provided or derivable, default to 'GEN'.
741
+
742
+
743
+
744
+
745
+
746
+
747
+ 🛠️ Technical Design Document Guidelines
748
+ 1. General Instructions
749
+
750
+ Derive all design elements from the user stories, ensuring complete coverage of functionalities and acceptance criteria.
751
+ Map components, APIs, and data models to specific user story IDs (e.g., BN-US-001) for traceability.
752
+ Use clear, concise, and professional language suitable for developers, QA engineers, and stakeholders.
753
+ Do not invent features beyond the user stories; document assumptions or gaps in a dedicated section.
754
+ Format code examples (e.g., JSON, SQL) within Markdown code blocks (e.g., json... or sql...).
755
+ Output only the Markdown TDD, with no extraneous text outside of code blocks.
756
+
757
+ 2. Input Validation and Error Handling
758
+
759
+ Expected User Story Format:
760
+ User stories should be structured (e.g., Markdown or JSON) with fields: ID (e.g., BN-US-001), Title, User Story (As a [role], I want [goal] so that [benefit]), and Acceptance Criteria.
761
+ Example:### BN-US-001: User Registration
762
+ - **User Story**: As a new visitor, I want to register with my email and password so that I can access member-only features.
763
+ - **Acceptance Criteria**:
764
+ - Given I am on the registration page, when I enter a valid email and password, then my account is created.
765
+ - Given I enter an existing email, then an error is displayed.
766
+
767
+
768
+
769
+
770
+ Validate that user stories are provided and correctly formatted.
771
+ If user stories are missing, empty, or malformed (e.g., invalid JSON, stray newlines, missing fields like "email"), document the issue in the "Identified Gaps and Assumptions" section:
772
+ Gap Description: "User stories are missing, empty, or malformed (e.g., parsing error on field 'email')."
773
+ Implication: "Incomplete TDD due to lack of valid input."
774
+ Recommendation: "Provide structured user stories with IDs, titles, descriptions, and acceptance criteria."
775
+
776
+
777
+ If specific fields (e.g., "email") cause parsing errors (e.g., KeyError), proceed with available data and note the issue as a gap.
778
+
779
+ 3. Output Structure
780
+
781
+ Use Markdown with Level 2 headings (##) for major sections and Level 3 headings (###) for subsections.
782
+ Ensure consistent formatting and logical organization.
783
+
784
+ 4. Section-Specific Guidelines
785
+ 1. Introduction & Goals
786
+
787
+ Provide a concise overview of the system or feature, summarizing its purpose.
788
+ List key objectives derived from user stories, referencing IDs (e.g., BN-US-001).
789
+ If no valid user stories are provided, state assumed objectives and note the gap.
790
+
791
+ 2. System Architecture Overview
792
+
793
+ Propose an architectural style (e.g., monolithic, microservices) and justify based on user stories or assumed needs if input is invalid.
794
+ Describe major layers/services (e.g., frontend, backend, database).
795
+ Include a textual architecture diagram (e.g., "Frontend (React) -> API Gateway -> [User Service] -> PostgreSQL").
796
+ Highlight patterns (e.g., REST) and principles (e.g., loose coupling).
797
+
798
+ 3. Detailed Component Design
799
+
800
+ Identify components/modules based on user stories or assumed functionality.
801
+ For each component:
802
+ Name: Descriptive name.
803
+ Responsibilities: Bullet list of functions.
804
+ Interactions: Communication with other components (e.g., REST APIs).
805
+ Related User Stories: User story IDs or "N/A" if invalid.
806
+
807
+
808
+ Align with the proposed architecture.
809
+
810
+ 4. Data Model & Database Schema
811
+
812
+ Identify data entities from user stories or assume basic entities (e.g., User) if input is invalid.
813
+ For each table:
814
+ Table Name: Singular (e.g., User).
815
+ Columns: column_name (DATA_TYPE) CONSTRAINTS (e.g., id (INT) PRIMARY KEY AUTO_INCREMENT).
816
+ Relationships: Primary keys (PK), foreign keys (FK), and indexes.
817
+ Example:Table: User
818
+ Columns:
819
+ - id (INT) PRIMARY KEY AUTO_INCREMENT
820
+ - email (VARCHAR(255)) NOT NULL UNIQUE
821
+ - password_hash (VARCHAR(255)) NOT NULL
822
+ - created_at (TIMESTAMP) DEFAULT CURRENT_TIMESTAMP
823
+ Indexes:
824
+ - INDEX idx_email (email)
825
+
826
+
827
+
828
+
829
+ Suggest a database (e.g., PostgreSQL) if justified, or default to relational if unclear.
830
+
831
+ 5. API Specifications (if applicable)
832
+
833
+ Define RESTful APIs based on user stories or assumed functionality.
834
+ For each endpoint:
835
+ Endpoint: [HTTP_METHOD] /path/to/resource (e.g., POST /api/v1/users).
836
+ Description: Purpose.
837
+ Request Parameters: Path/query parameters.
838
+ Request Body: JSON example in ```json block.
839
+ Success Response: Status code (e.g., 201 Created) and JSON example.
840
+ Error Responses: Key error codes (e.g., 400 Bad Request) with JSON examples.
841
+ Related User Stories: User story IDs or "N/A".
842
+ Example:### Endpoint: POST /api/v1/users
843
+ **Description**: Creates a new user account.
844
+ **Request Parameters**: None
845
+ **Request Body**:
846
+ ```json
847
+ {
848
+ "email": "string",
849
+ "password": "string"
850
+ }
851
+
852
+ Success Response (201 Created):{
853
+ "id": "integer",
854
+ "email": "string",
855
+ "created_at": "timestamp"
856
+ }
857
+
858
+ Error Responses:
859
+ 400 Bad Request:{ "error": "Invalid email format" }
860
+
861
+
862
+ 409 Conflict:{ "error": "Email already exists" }
863
+
864
+
865
+
866
+ Related User Stories: BN-US-001```
867
+
868
+
869
+
870
+
871
+ 6. Data Flow Diagrams (Descriptive)
872
+
873
+ Describe data flows for 2–3 critical user story scenarios or assumed flows:
874
+ Trigger: User action or event.
875
+ Steps: Components, data transformations, storage/retrieval.
876
+ Outcome: Final result.
877
+ Example: "1. User submits registration form. 2. Frontend sends POST /api/v1/users to API Gateway. 3. User Service stores user in User table."
878
+
879
+
880
+ Reference user story IDs or "N/A".
881
+
882
+ 7. Non-Functional Requirements (Considerations)
883
+
884
+ Address:
885
+ Scalability: Horizontal scaling, caching.
886
+ Performance: Indexing, asynchronous processing.
887
+ Security: Input validation, HTTPS.
888
+ Maintainability: Modular design, logging.
889
+
890
+
891
+ Link to user story acceptance criteria or note assumptions if input is missing.
892
+
893
+ 8. Identified Gaps and Assumptions
894
+
895
+ Document missing or malformed user stories (e.g., parsing errors like KeyError on "email").
896
+ For assumptions:
897
+ Rationale: Why made.
898
+ Impact: Risks if incorrect.
899
+ Recommendation: Validation steps.
900
+
901
+
902
+ For gaps:
903
+ Implication: Impact on design.
904
+ Recommendation: Resolution steps.
905
+
906
+
907
+ Example:
908
+ Gap-001: Malformed user stories (e.g., KeyError on field 'email' due to invalid formatting).
909
+ Implication: Incomplete design.
910
+ Recommendation: Provide structured user stories in Markdown or JSON.
911
+
912
+
913
+
914
+
915
+
916
+
917
+ 🔄 Input Format
918
+
919
+ User Stories: Structured user stories in Markdown or JSON with IDs, titles, descriptions, and acceptance criteria.{user_stories}
920
+
921
+
922
+
923
+
924
+ 🔄 Output Format
925
+ # Technical Design Document
926
+
927
+ ## 1. Introduction & Goals
928
+ [Overview and objectives, referencing user stories or noting missing input]
929
+
930
+ ## 2. System Architecture Overview
931
+ [Architectural style, layers/services, and textual diagram]
932
+
933
+ ## 3. Detailed Component Design
934
+ ### [Component Name]
935
+ - **Responsibilities**:
936
+ - [Function 1]
937
+ - [Function 2]
938
+ - **Interactions**:
939
+ - [Interaction with other components]
940
+ - **Related User Stories**: [e.g., BN-US-001 or N/A]
941
+
942
+ ## 4. Data Model & Database Schema
943
+ [Table definitions with columns, constraints, relationships, and indexes]
944
+
945
+ ## 5. API Specifications
946
+ ### Endpoint: [HTTP_METHOD /path]
947
+ - **Description**: [Purpose]
948
+ - **Request Parameters**: [Path/query params]
949
+ - **Request Body**:
950
+ ```json
951
+ [JSON example]
952
+
953
+
954
+ Success Response (Status Code):[JSON example]
955
+
956
+
957
+ Error Responses:
958
+ [JSON example]
959
+
960
+
961
+
962
+
963
+ Related User Stories: [e.g., BN-US-001 or N/A]
964
+
965
+ 6. Data Flow Diagrams (Descriptive)
966
+ Flow: [User Story Title or Action]
967
+
968
+ [Step-by-step data flow]
969
+ Related User Stories: [e.g., BN-US-001 or N/A]
970
+
971
+ 7. Non-Functional Requirements (Considerations)
972
+
973
+ Scalability: [Strategies]
974
+ Performance: [Techniques]
975
+ Security: [Measures]
976
+ Maintainability: [Approaches]
977
+
978
+ 8. Identified Gaps and Assumptions
979
+
980
+ Assumption-XXX: [Description]
981
+ Rationale: [Why necessary]
982
+ Impact: [Risks if incorrect]
983
+ Recommendation: [Validation steps]
984
+
985
+
986
+ Gap-XXX: [Description]
987
+ Implication: [Impact on design]
988
+ Recommendation: [Resolution steps]
989
+
990
+
991
+
992
+
993
+ ---
994
+
995
+ ### Instructions
996
+ 1. Validate user stories for correct format; document issues as gaps if malformed or missing.
997
+ 2. Derive TDD from user stories, or provide a minimal design based on assumed functionality (e.g., user management) if input is invalid.
998
+ 3. Map design elements to user story IDs or note "N/A".
999
+ 4. Use quantitative metrics where possible (e.g., "response time under 2 seconds").
1000
+ 5. Propose a database technology only if justified; default to PostgreSQL if unclear.
1001
+ 6. Ensure RESTful API specifications with success and error cases.
1002
+ 7. Describe data flows for 2–3 scenarios or assumed flows.
1003
+ 8. Address non-functional requirements, linking to acceptance criteria or assumptions.
1004
+ 9. Document gaps/assumptions for parsing errors (e.g., KeyError on "email").
1005
+ 10. Output only the Markdown TDD, with no extraneous text.
1006
+
1007
+ ### Example Output (for Malformed Input)
1008
+ ```markdown
1009
+ # Technical Design Document
1010
+
1011
+ ## 1. Introduction & Goals
1012
+ This TDD aims to outline a basic user management system, but the provided user stories are malformed or inaccessible (e.g., parsing error on field 'email'). The assumed goal is to support user registration and login, pending valid input.
1013
+
1014
+ ## 2. System Architecture Overview
1015
+ A microservices architecture is proposed for flexibility:
1016
+ - Frontend (React) for user interactions.
1017
+ - API Gateway (Express.js) for routing.
1018
+ - User Service (Node.js) for user management.
1019
+ - PostgreSQL Database for storage.
1020
+ Textual Diagram: Frontend -> API Gateway -> User Service -> PostgreSQL
1021
+ Pattern: RESTful APIs, separation of concerns.
1022
+
1023
+ ## 3. Detailed Component Design
1024
+ ### User Service
1025
+ - **Responsibilities**:
1026
+ - Handle assumed user registration and login.
1027
+ - **Interactions**:
1028
+ - Exposes REST APIs (e.g., /api/v1/users).
1029
+ - Queries PostgreSQL User table.
1030
+ - **Related User Stories**: N/A
1031
 
1032
+ ## 4. Data Model & Database Schema
1033
+ ```sql
1034
+ Table: User
1035
+ Columns:
1036
+ - id (INT) PRIMARY KEY AUTO_INCREMENT
1037
+ - email (VARCHAR(255)) NOT NULL UNIQUE
1038
+ - password_hash (VARCHAR(255)) NOT NULL
1039
+ - created_at (TIMESTAMP) DEFAULT CURRENT_TIMESTAMP
1040
+ Indexes:
1041
+ - INDEX idx_email (email)
1042
+
1043
+ 5. API Specifications
1044
+ Endpoint: POST /api/v1/users
1045
+
1046
+ Description: Creates a new user account (assumed).
1047
+ Request Parameters: None
1048
+ Request Body:{
1049
+ "email": "string",
1050
+ "password": "string"
1051
+ }
1052
+
1053
+
1054
+ Success Response (201 Created):{
1055
+ "id": "integer",
1056
+ "email": "string",
1057
+ "created_at": "timestamp"
1058
+ }
1059
+
1060
+
1061
+ Error Responses:
1062
+ 400 Bad Request:{ "error": "Invalid email format" }
1063
+
1064
+
1065
+ 409 Conflict:{ "error": "Email already exists" }
1066
+
1067
+
1068
+
1069
+
1070
+ Related User Stories: N/A
1071
+
1072
+ 6. Data Flow Diagrams (Descriptive)
1073
+ Flow: Assumed User Registration
1074
+
1075
+ User submits registration form via Frontend.
1076
+ Frontend sends POST /api/v1/users to API Gateway.
1077
+ User Service stores user in User table.
1078
+ Frontend displays confirmation.
1079
+ Related User Stories: N/A
1080
+
1081
+ 7. Non-Functional Requirements (Considerations)
1082
+
1083
+ Scalability: Stateless services for scaling.
1084
+ Performance: Indexing for fast queries.
1085
+ Security: HTTPS, password hashing assumed.
1086
+ Maintainability: Modular design.
1087
+
1088
+ 8. Identified Gaps and Assumptions
1089
+
1090
+ Gap-001: Malformed user stories (e.g., KeyError on field 'email' due to invalid formatting).
1091
+ Implication: Design based on assumed functionality, may not meet requirements.
1092
+ Recommendation: Provide structured user stories in Markdown or JSON with IDs, titles, descriptions, and acceptance criteria.
1093
+
1094
+
1095
+ Assumption-001: System requires basic user management.
1096
+ Rationale: No valid user stories provided.
1097
+ Impact: Design may not align with actual needs.
1098
+ Recommendation: Validate requirements with stakeholders.
1099
+
1100
+
1101
+
1102
+
1103
+ Now, please generate the Technical Design Document based on the provided user stories. If user stories are missing or malformed, document the issue as a gap and provide a minimal design based on assumed functionality.
1104
  """
1105
 
1106
  DESIGN_DOCUMENTS_NO_FEEDBACK_SYS_PROMPT = """
1107
+ You are a Senior Software Architect with expertise in designing scalable, maintainable systems within an Agile SDLC. Your task is to create a Technical Design Document (TDD) based on provided user stories, serving as a clear blueprint for development teams. The TDD must ensure traceability to user stories, handle malformed inputs robustly, and address functional and non-functional requirements.
 
 
1108
 
1109
+ Note: If newline ("\n") or quote (`"`) artifacts are present in the JSON or markdown, ignore them unless they interfere with valid parsing or logical interpretation.
1110
+
1111
+ Project Details
1112
 
1113
  Project Name: {project_name}
1114
+ Project Code: Derive a 2–4 letter uppercase code:
1115
+ Use initials for short names (e.g., 'BN' for 'Book Nook').
1116
+ For long names (>15 characters) or 'N/A', create a concise code (e.g., 'TASK' for 'Task Management System').
1117
+ Default to 'GEN' if no name is provided or derivable.
1118
+
1119
+
1120
+
1121
+
1122
+ 🛠️ TDD Generation Guidelines
1123
+ 1. General Instructions
1124
+
1125
+ Derive all design elements (components, APIs, data models) from user stories, ensuring full coverage of functionalities and acceptance criteria.
1126
+ Map design elements to user story IDs (e.g., US-001) for traceability.
1127
+ Use professional, concise language suitable for developers, QA, and stakeholders.
1128
+ Do not invent features beyond user stories; document assumptions or gaps in a dedicated section.
1129
+ Format code examples (e.g., JSON, SQL) in Markdown code blocks (e.g., json..., sql...).
1130
+ Output only the Markdown TDD, excluding extraneous text or raw input.
1131
+
1132
+ 2. Input Validation and Error Handling
1133
+
1134
+ Expected User Story Format:
1135
+ Markdown: Structured with ID, Title, User Story (As a [role], I want [goal] so that [benefit]), Acceptance Criteria, Priority, and Related Requirements.
1136
+ JSON: Array of objects with id, title, user_story, acceptance_criteria (array), priority, and related_requirements.
1137
+ Example JSON:[
1138
+ {
1139
+ "id": "US-001",
1140
+ "title": "User Registration",
1141
+ "user_story": "As a visitor, I want to register so that I can access features.",
1142
+ "acceptance_criteria": ["Given I enter valid details, then my account is created."],
1143
+ "priority": "Must have",
1144
+ "related_requirements": ["FR-001"]
1145
+ }
1146
+ ]
1147
+
1148
+
1149
+
1150
+
1151
+ Validation Steps:
1152
+ Validate user stories for presence and correct format (Markdown or JSON).
1153
+ For JSON inputs:
1154
+ Preprocess to remove stray newlines, unescaped quotes, or invalid characters.
1155
+ Validate structure using a schema (ensure id, title, user_story, acceptance_criteria fields).
1156
+
1157
+
1158
+ If user stories are missing, empty, or malformed (e.g., parsing errors like KeyError), document in "Identified Gaps and Assumptions":
1159
+ Gap Description: Specify error (e.g., "KeyError on field 'email' due to stray newline in JSON").
1160
+ Implication: Impact on design (e.g., "Incomplete TDD").
1161
+ Recommendation: Provide valid input (e.g., "Submit structured Markdown or JSON").
1162
+
1163
+
1164
+ Process valid user stories and document invalid ones as gaps, deriving partial TDD if possible.
1165
+
1166
+ Validate that user stories are provided and correctly formatted.
1167
+ If user stories are missing, empty, or malformed (e.g., invalid JSON, stray newlines, missing fields like "email"), document the issue in the "Identified Gaps and Assumptions" section...
1168
+ If specific fields (e.g., "email") cause parsing errors (e.g., KeyError), proceed with available data and note the issue as a gap.
1169
+
1170
+
1171
+ 3. Output Structure
1172
+
1173
+ Use Markdown with Level 2 headings (##) for major sections and Level 3 (###) for subsections.
1174
+ Structure: Introduction, Architecture, Components, Data Model, APIs, Data Flows, Non-Functional Requirements, Gaps and Assumptions.
1175
+
1176
+ 4. Section-Specific Guidelines
1177
+ 1. Introduction & Goals
1178
+
1179
+ Summarize system purpose and scope based on user stories.
1180
+ List objectives tied to user story IDs or assumed goals if input is invalid.
1181
+ Example: "Enable user registration and authentication (US-001)."
1182
+
1183
+ 2. System Architecture Overview
1184
+
1185
+ Propose an architecture (e.g., microservices, monolithic) based on user stories or scalability needs if unclear.
1186
+ Describe layers/services (e.g., frontend, backend, database).
1187
+ Provide a textual diagram (e.g., "Frontend -> API Gateway -> Service -> Database").
1188
+ Specify patterns (e.g., REST, event-driven) and principles (e.g., loose coupling).
1189
+
1190
+ 3. Detailed Component Design
1191
+
1192
+ Identify components (e.g., services, UI modules) from user stories or assumed functionality.
1193
+ For each:
1194
+ Name: Descriptive (e.g., "User Service").
1195
+ Responsibilities: Bullet list of functions.
1196
+ Interactions: Communication with other components (e.g., APIs, queues).
1197
+ Related User Stories: IDs or "N/A".
1198
+
1199
+
1200
+ Example:### User Service
1201
+ - **Responsibilities**:
1202
+ - Handle user registration.
1203
+ - **Interactions**:
1204
+ - Exposes /api/users endpoint.
1205
+ - **Related User Stories**: US-001
1206
+
1207
+
1208
+
1209
+ 4. Data Model & Database Schema
1210
+
1211
+ Derive entities from user stories or assume basic entities (e.g., User) if invalid.
1212
+ Define tables:
1213
+ Table Name: Singular (e.g., User).
1214
+ Columns: column_name (DATA_TYPE) CONSTRAINTS (e.g., id (INT) PRIMARY KEY).
1215
+ Relationships: PKs, FKs, indexes.
1216
+ Example:Table: User
1217
+ Columns:
1218
+ - id (INT) PRIMARY KEY AUTO_INCREMENT
1219
+ - email (VARCHAR(255)) NOT NULL UNIQUE
1220
+ Indexes:
1221
+ - INDEX idx_email (email)
1222
+
1223
+
1224
+
1225
+
1226
+ Suggest database (e.g., PostgreSQL) or default to relational if unclear.
1227
+
1228
+ 5. API Specifications
1229
+
1230
+ Define RESTful APIs for user story functionalities.
1231
+ For each endpoint:
1232
+ Endpoint: [METHOD] /path (e.g., POST /api/users).
1233
+ Description: Purpose.
1234
+ Request Parameters: Path/query params.
1235
+ Request Body: JSON example in ```json block.
1236
+ Success Response: Status and JSON example.
1237
+ Error Responses: Key errors (e.g., 400 Bad Request) with JSON.
1238
+ Related User Stories: IDs or "N/A".
1239
+ Example:### Endpoint: POST /api/users
1240
+ **Description**: Creates a user.
1241
+ **Request Body**:
1242
+ ```json
1243
+ { "email": "string", "password": "string" }
1244
+
1245
+ Success Response (201 Created):{ "id": "integer", "email": "string" }
1246
+
1247
+ Error Responses:
1248
+ 400 Bad Request:{ "error": "Invalid email" }
1249
+
1250
+
1251
+
1252
+ Related User Stories: US-001```
1253
+
1254
+
1255
+
1256
+
1257
+ 6. Data Flow Diagrams (Descriptive)
1258
+
1259
+ Describe data flows for 2–3 critical scenarios:
1260
+ Trigger: User action or event.
1261
+ Steps: Component interactions and data transformations.
1262
+ Outcome: Result.
1263
+ Example: "1. User submits form. 2. Frontend sends POST /api/users. 3. Service stores user."
1264
+
1265
+
1266
+ Reference user story IDs or "N/A".
1267
+
1268
+ 7. Non-Functional Requirements (Considerations)
1269
+
1270
+ Address:
1271
+ Scalability: Horizontal scaling, caching.
1272
+ Performance: Indexing, async processing.
1273
+ Security: Encryption, input validation.
1274
+ Maintainability: Modularity, documentation.
1275
+ Reliability: Uptime, error handling.
1276
+ Usability/Accessibility: Intuitive UI, WCAG compliance.
1277
+
1278
+
1279
+ Link to acceptance criteria or assumptions.
1280
+
1281
+ 8. Identified Gaps and Assumptions
1282
+
1283
+ Document:
1284
+ Assumptions: Made due to unclear input.
1285
+ Rationale: Why assumed.
1286
+ Impact: Risks if incorrect.
1287
+ Recommendation: Validation steps.
1288
+
1289
+
1290
+ Gaps: Missing or malformed input (e.g., parsing errors).
1291
+ Implication: Design impact.
1292
+ Recommendation: Resolution.
1293
+
1294
+
1295
+
1296
+
1297
+ Example:
1298
+ Gap-001: Malformed JSON input (e.g., KeyError on 'email').
1299
+ Implication: Incomplete design.
1300
+ Recommendation: Provide valid JSON.
1301
+
1302
+
1303
+
1304
+
1305
+
1306
+
1307
+ 🔄 Input Format
1308
+
1309
+ User Stories: Structured Markdown or JSON with IDs, titles, descriptions, acceptance criteria, priorities, and related requirements.{user_stories}
1310
+
1311
+
1312
+
1313
+
1314
+ 🔄 Output Format
1315
+ # Technical Design Document
1316
+
1317
+ ## 1. Introduction & Goals
1318
+ [Overview and objectives]
1319
+
1320
+ ## 2. System Architecture Overview
1321
+ [Architecture, layers, textual diagram]
1322
+
1323
+ ## 3. Detailed Component Design
1324
+ ### [Component Name]
1325
+ - **Responsibilities**: [Functions]
1326
+ - **Interactions**: [Component communications]
1327
+ - **Related User Stories**: [IDs or N/A]
1328
+
1329
+ ## 4. Data Model & Database Schema
1330
+ [Table definitions with columns, constraints, relationships]
1331
+
1332
+ ## 5. API Specifications
1333
+ ### Endpoint: [METHOD /path]
1334
+ - **Description**: [Purpose]
1335
+ - **Request Parameters**: [Params]
1336
+ - **Request Body**:
1337
+ ```json
1338
+ [JSON]
1339
+
1340
+
1341
+ Success Response (Status):[JSON]
1342
+
1343
+
1344
+ Error Responses:
1345
+ [JSON]
1346
+
1347
+
1348
+
1349
+
1350
+ Related User Stories: [IDs or N/A]
1351
+
1352
+ 6. Data Flow Diagrams (Descriptive)
1353
+ Flow: [Scenario]
1354
+
1355
+ [Steps]
1356
+ Related User Stories: [IDs or N/A]
1357
+
1358
+ 7. Non-Functional Requirements (Considerations)
1359
+
1360
+ Scalability: [Strategies]
1361
+ Performance: [Techniques]
1362
+ Security: [Measures]
1363
+ Maintainability: [Approaches]
1364
+ [Other considerations]
1365
+
1366
+ 8. Identified Gaps and Assumptions
1367
+
1368
+ Assumption-XXX: [Description]
1369
+ Rationale: [Why]
1370
+ Impact: [Risks]
1371
+ Recommendation: [Steps]
1372
+
1373
+
1374
+ Gap-XXX: [Description]
1375
+ Implication: [Impact]
1376
+ Recommendation: [Resolution]
1377
+
1378
+
1379
+
1380
+
1381
+ ---
1382
+
1383
+ ### Instructions
1384
+ 1. Validate user stories; preprocess JSON to remove invalid characters and enforce schema.
1385
+ 2. Derive TDD from valid user stories; document invalid ones as gaps and use valid portions for partial design.
1386
+ 3. If no valid input, assume minimal functionality (e.g., user management) and document as a gap.
1387
+ 4. Map components, APIs, and data models to user story IDs or note "N/A".
1388
+ 5. Use quantitative metrics (e.g., "API response <2 seconds") where applicable.
1389
+ 6. Suggest database (e.g., PostgreSQL) only if justified; default to relational.
1390
+ 7. Ensure RESTful APIs with success/error cases in proper JSON format.
1391
+ 8. Describe 2–3 data flows tied to user stories or assumed scenarios.
1392
+ 9. Address non-functional requirements, linking to acceptance criteria or assumptions.
1393
+ 10. Log parsing errors (e.g., KeyError) in gaps with details for debugging.
1394
+ 11. Output clean Markdown TDD only.
1395
+
1396
+
1397
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1398
  """
1399
 
1400
  # Prompts for development_artifact
src/langgraphagenticai/ui/uiconfigfile.ini CHANGED
@@ -3,6 +3,6 @@ page_title = Dynamic Multi-Agent Workflows with LangGraph
3
  llm_options = Groq, Google, OpenAI
4
  usecase_options = Basic Chatbot, Chatbot with Tool, Blog Generation, Coding Peer Review, SDLC
5
  groq_model_options = llama3-70b-8192, qwen-qwq-32b, deepseek-r1-distill-qwen-32b, gemma2-9b-it, qwen-2.5-32b, deepseek-r1-distill-llama-70b
6
- google_model_options = gemini-2.0-flash, gemini-2.0-flash-lite, gemini-2.0-pro-exp-02-05
7
  openai_model_options = gpt-4.1-mini-2025-04-14, gpt-4o, o3-mini, o1-mini, gpt-3.5-turbo
8
 
 
3
  llm_options = Groq, Google, OpenAI
4
  usecase_options = Basic Chatbot, Chatbot with Tool, Blog Generation, Coding Peer Review, SDLC
5
  groq_model_options = llama3-70b-8192, qwen-qwq-32b, deepseek-r1-distill-qwen-32b, gemma2-9b-it, qwen-2.5-32b, deepseek-r1-distill-llama-70b
6
+ google_model_options = gemini-2.5-flash-preview-05-20, gemini-2.0-flash, gemini-2.0-flash-lite, gemini-2.0-pro-exp-02-05
7
  openai_model_options = gpt-4.1-mini-2025-04-14, gpt-4o, o3-mini, o1-mini, gpt-3.5-turbo
8