Skip to content

Commit 0b6d127

Browse files
authored
feat: enhance code generation guidelines with validation and scope management (#22)
* docs: add rational on readme * docs: add MCP inspector and remove list of tools from readme * feat: enhance code generation guidelines with validation and scope management
1 parent 7bb88f5 commit 0b6d127

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,6 @@ dmypy.json
123123
.bobignore
124124
# do not commit to source control it is dynamicly generated
125125
*_version.py
126+
127+
# local testing
128+
test_output/

static/instructions.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,49 @@ When generating Terraform configurations:
198198
4. **Ensure proper module versioning to maintain stability**
199199
5. **Include appropriate comments to explain the purpose and configuration of resources**
200200
6. **Always validate generated logic** with `terraform init` and `terraform validate`
201+
7. **Verify generated Terraform when possible** - Use available tools to run `terraform init`, `terraform validate`, and `terraform plan` to ensure configurations are syntactically correct and logically sound
202+
8. **Stay focused on user requirements** - Avoid adding extra features or configurations not explicitly requested (e.g., don't include user_data blocks when generating VSI code unless specifically asked)
203+
9. **Ask clarifying questions when ambiguous** - If the user's request lacks specific details or could be interpreted multiple ways, ask targeted questions to ensure accurate implementation
204+
10. **Leverage IBM Cloud MCP when available** - If you have access to IBM Cloud MCP tools, use them to verify region lists, image IDs (for VSIs based on region), availability zones, and other cloud-specific parameters to ensure accuracy
205+
11. **Generate vanilla Terraform configurations** - Always generate the most straightforward Terraform files (`.tf` files) and a README. Avoid creating scripts, Makefiles, or automation tools to launch Terraform unless explicitly requested. You may generate a template tfvars file if needed.
206+
207+
## Validation and Quality Assurance
208+
209+
### Terraform Validation
210+
- **Always attempt to verify generated Terraform configurations**
211+
- Run `terraform init` to ensure proper provider and module initialization
212+
- Execute `terraform validate` to check syntax and configuration validity
213+
- Use `terraform plan` when possible to verify logical correctness. Ignore authentication errors as you may not have valid credentials
214+
- Provide corrected configurations
215+
216+
### Scope Management
217+
- **Focus strictly on user requirements** - Don't add unrequested features
218+
- **Common examples of scope creep to avoid:**
219+
- Do not add user_data blocks to VSI configurations unless explicitly requested
220+
- Do not add monitoring or logging configurations unless asked
221+
- Do not add security groups beyond basic requirements
222+
- Do not implement backup strategies unless specified
223+
- **When in doubt, ask** - It's better to clarify requirements than assume additional needs
224+
225+
### Clarification Best Practices
226+
- **Ask targeted questions** when user requests are ambiguous
227+
- **Common clarification areas:**
228+
- Specific region requirements for resource placement
229+
- Network configuration preferences (subnets, CIDR blocks)
230+
- Security requirements and compliance needs
231+
- Resource sizing and performance requirements
232+
- Integration points with existing infrastructure
233+
- **Provide context** in your questions to help users make informed decisions
234+
235+
### IBM Cloud MCP Integration
236+
- **Leverage IBM Cloud MCP tools when available** for accurate cloud-specific information
237+
- **Use for verification of:**
238+
- Available regions and availability zones
239+
- Valid image IDs for virtual server instances (region-specific)
240+
- Current service offerings and capabilities
241+
- Pricing and resource limits
242+
- Network and connectivity options
243+
- **Cross-reference generated configurations** with real IBM Cloud data when possible
201244

202245
## Best Practices Summary
203246

0 commit comments

Comments
 (0)