Skip to content

Commit 975df74

Browse files
committed
Updates the readme_writeme.md file to be consistent with other languages.
1 parent 91411d6 commit 975df74

File tree

1 file changed

+121
-47
lines changed

1 file changed

+121
-47
lines changed

steering_docs/go-tech/readme_writeme.md

Lines changed: 121 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,65 @@
1-
# Go README Generation
1+
# Go README/WRITEME and Documentation Generation
22

3-
## MANDATORY: Knowledge Base Consultation (FIRST STEP)
4-
**🚨 CRITICAL - Must be completed BEFORE any code generation**
3+
## Purpose
4+
Generate and update README files and documentation using the writeme tool to ensure consistency and completeness.
55

6-
```bash
7-
# Step 1: List available knowledge bases
8-
ListKnowledgeBases()
6+
## Requirements
7+
- **Automated Generation**: Use writeme tool for README generation
8+
- **Metadata Dependency**: Requires complete metadata files
9+
- **Virtual Environment**: Run writeme in isolated environment
10+
- **Validation**: Ensure all documentation is up-to-date
911

10-
# Step 2: Query coding standards (REQUIRED)
11-
QueryKnowledgeBases("coding-standards-KB", "Go-code-example-standards")
12+
## File Structure
13+
```
14+
gov2/{service}/
15+
├── README.md # Generated service README
16+
├── go.mod # Module dependencies
17+
└── {service}_metadata.yaml # Metadata (in .doc_gen/metadata/)
18+
```
1219

13-
# Step 3: Query implementation patterns (REQUIRED)
14-
QueryKnowledgeBases("Go-premium-KB", "Go documentation patterns")
20+
## README Generation Process
1521

16-
# Step 4: AWS service research (REQUIRED)
17-
search_documentation("What is [AWS Service] and what are its key API operations?")
18-
read_documentation("https://docs.aws.amazon.com/[service]/latest/[relevant-page]")
19-
```
22+
### Step 1: Setup Writeme Environment
23+
```bash
24+
cd .tools/readmes
2025

21-
**FAILURE TO COMPLETE KNOWLEDGE BASE CONSULTATION WILL RESULT IN INCORRECT CODE STRUCTURE**
26+
# Create virtual environment
27+
python -m venv .venv
2228

23-
## Purpose
24-
Generate comprehensive README.md files for Go AWS SDK examples that provide clear documentation, setup instructions, and usage examples.
29+
# Activate environment (Linux/macOS)
30+
source .venv/bin/activate
2531

26-
## Requirements
27-
- **Service Overview**: Clear description of the AWS service and its purpose
28-
- **Code Examples**: List all available examples with descriptions
29-
- **Prerequisites**: Setup and credential configuration instructions
30-
- **Usage Instructions**: Step-by-step instructions for running examples
31-
- **Testing**: Instructions for running unit and integration tests
32-
- **Resources**: Links to relevant documentation
32+
# Activate environment (Windows)
33+
.venv\Scripts\activate
3334

34-
## File Structure
35+
# Install dependencies
36+
python -m pip install -r requirements_freeze.txt
3537
```
36-
gov2/{service}/
37-
└── README.md # Main service documentation
38+
39+
### Step 2: Generate README
40+
```bash
41+
# Generate README for specific service
42+
python -m writeme --languages Go:2 --services {service}
3843
```
3944

45+
### Step 3: Validate Generation
46+
-**README.md created/updated** in service directory
47+
-**No generation errors** in writeme output
48+
-**All examples listed** in README
49+
-**Proper formatting** and structure
50+
-**Working links** to code files
51+
52+
## README Content Structure
53+
54+
### Generated README Sections
55+
1. **Service Overview**: Description of AWS service
56+
2. **Code Examples**: List of available examples
57+
3. **Prerequisites**: Setup requirements
58+
4. **Installation**: Dependency installation
59+
5. **Usage**: How to run examples
60+
6. **Tests**: Testing instructions
61+
7. **Additional Resources**: Links to documentation
62+
4063
## README Template Structure
4164
```markdown
4265
# AWS SDK for Go V2 {Service Name} examples
@@ -145,6 +168,58 @@ go test ./... -tags=integration
145168
* [AWS SDK for Go V2 API Reference](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2)
146169
```
147170

171+
## Documentation Dependencies
172+
173+
### Required Files for README Generation
174+
-**Metadata file**: `.doc_gen/metadata/{service}_metadata.yaml`
175+
-**Code files**: All referenced Go files must exist
176+
-**Snippet tags**: All snippet tags in metadata must exist in code
177+
-**Module file**: `go.mod` with dependencies
178+
179+
### Metadata Integration
180+
The writeme tool uses metadata to:
181+
- Generate example lists and descriptions
182+
- Create links to specific code sections
183+
- Include proper service information
184+
- Format documentation consistently
185+
186+
## Troubleshooting README Generation
187+
188+
### Common Issues
189+
- **Missing metadata**: Ensure metadata file exists and is valid
190+
- **Broken snippet tags**: Verify all snippet tags exist in code
191+
- **File not found**: Check all file paths in metadata
192+
- **Invalid YAML**: Validate metadata YAML syntax
193+
194+
### Error Resolution
195+
```bash
196+
# Check for metadata errors
197+
python -m writeme --languages Go:2 --services {service} --verbose
198+
199+
# Validate specific metadata file
200+
python -c "import yaml; yaml.safe_load(open('.doc_gen/metadata/{service}_metadata.yaml'))"
201+
202+
# Check for missing snippet tags
203+
grep -r "snippet-start" gov2/{service}/
204+
```
205+
206+
## README Maintenance
207+
208+
### When to Regenerate README
209+
-**After adding new examples**
210+
-**After updating metadata**
211+
-**After changing code structure**
212+
-**Before committing changes**
213+
-**During regular maintenance**
214+
215+
### README Quality Checklist
216+
-**All examples listed** and properly linked
217+
-**Prerequisites accurate** and complete
218+
-**Installation instructions** work correctly
219+
-**Usage examples** are clear and correct
220+
-**Links functional** and point to right locations
221+
-**Formatting consistent** with other services
222+
148223
## Service-Specific README Examples
149224

150225
### S3 Service README
@@ -399,23 +474,22 @@ go test ./... -tags=integration
399474
- Add AWS SDK for Go V2 API reference
400475
- Use consistent link formatting
401476

402-
## README Requirements
403-
-**ALWAYS** include service name and abbreviation in title
404-
-**ALWAYS** provide clear service description and purpose
405-
-**ALWAYS** list all available code examples with descriptions
406-
-**ALWAYS** include prerequisites and setup instructions
407-
-**ALWAYS** provide exact commands for running examples
408-
-**ALWAYS** include testing instructions with warnings
409-
-**ALWAYS** add links to relevant AWS documentation
410-
-**ALWAYS** use consistent formatting and structure
411-
-**ALWAYS** include important warnings about charges and permissions
412-
-**ALWAYS** reference the main gov2 README for additional details
413-
414-
## Common Patterns
415-
- Use consistent section headers across all service READMEs
416-
- Include the same warning section in all READMEs
417-
- Use code blocks for all commands and file paths
418-
- Maintain consistent link formatting
419-
- Include scenario step descriptions based on SPECIFICATION.md
420-
- Use bullet points for action lists
421-
- Keep descriptions concise but informative
477+
## Integration with CI/CD
478+
479+
### Automated README Validation
480+
```bash
481+
# In CI/CD pipeline, validate README is up-to-date
482+
cd .tools/readmes
483+
source .venv/bin/activate
484+
python -m writeme --languages Go:2 --services {service} --check
485+
486+
# Exit with error if README needs updates
487+
if git diff --exit-code gov2/{service}/README.md; then
488+
echo "README is up-to-date"
489+
else
490+
echo "README needs to be regenerated"
491+
exit 1
492+
fi
493+
```
494+
495+
This ensures documentation stays synchronized with code changes.

0 commit comments

Comments
 (0)