An example workspace demonstrating requirements-based AI code generation using UML models and user stories formulated in GitHub issues.
This AI lab showcases how to leverage AI agents to automatically generate production-ready code from high-level requirements. The approach combines:
- UML models (PlantUML diagrams) that define the domain structure and contracts
- User stories captured as GitHub issues with acceptance criteria
- Test-driven development (TDD) workflow enforcing quality through Red-Green-Refactor cycles
- AI-assisted code generation that transforms requirements into working implementations across multiple programming languages
This is a complete example workspace showing how AI can bridge the gap between business requirements and tested, working code.
- Model the domain - Create UML class diagrams in PlantUML defining interfaces, classes, attributes, methods, and relationships
- Write user stories - Formulate requirements as GitHub issues with clear acceptance criteria
- Invoke AI generation - Use
@Generate <language>to automatically generate tests and implementation - Review and iterate - AI generates code following TDD principles, you review and refine
- TypeScript (Deno runtime) - See
.github/instructions/ts.instructions.md - Java (JUnit, Gradle) - See
.github/instructions/java.instructions.md - Python (pytest) - See
.github/instructions/python.instructions.md - C# (xUnit/NUnit, dotnet) - See
.github/instructions/csharp.instructions.md
ailab/
├── .github/
│ ├── agents/
│ │ └── Generator.agent.md # TDD Generator agent (tdd-generator mode)
│ ├── instructions/
│ │ ├── ts.instructions.md # TypeScript TDD guidelines
│ │ ├── java.instructions.md # Java TDD guidelines
│ │ ├── python.instructions.md # Python TDD guidelines
│ │ └── csharp.instructions.md # C# TDD guidelines
│ └── prompts/
│ └── Generate.prompt.md # @Generate command for AI code generation
├── model/
│ └── model.md # PlantUML domain models
├── typescript/ # TypeScript implementation
│ ├── src/ # Runtime code
│ └── tests/ # Test files
├── java/ # Java implementation
│ ├── src/main/java/ # Runtime code
│ ├── src/test/java/ # Test files
│ └── build.gradle # Gradle build configuration
├── python/ # Python implementation
│ ├── src/ # Runtime code
│ └── tests/ # Test files
└── csharp/ # C# implementation
├── src/ # Runtime code
└── tests/ # Test files
Model the Domain - Create PlantUML diagrams in model/:
- Define interfaces and classes
- Specify attributes and methods with visibility
- Document relationships and multiplicities
- Add constraints and business rules
Formulate User Stories - Create GitHub issues with:
- Label:
userstory - Clear acceptance criteria (Given-When-Then or checklist format)
- References to relevant model elements
- Business perspective (not implementation details)
Invoke AI Code Generation:
@Generate typescript
Or for a specific issue:
@Generate #1 java
What the AI Does:
- Scans GitHub issues labeled
userstory - Loads PlantUML model for structural contracts
- Reads language-specific TDD instructions
- For each acceptance criterion:
- Writes failing tests first
- Implements minimal code to pass tests
- Verifies and refactors
- Reports progress and highlights assumptions
- Review generated tests and implementation
- Run tests to verify functionality
- Refine model or user story if needed
- Iterate until all acceptance criteria are met
cd typescript
deno test --allow-read --allow-write --allow-net
deno run --allow-read --allow-write --allow-net src/main.ts
deno fmtcd java
gradle clean test
gradle run
gradle buildcd python
pytest
python -m src.maincd csharp
dotnet test
dotnet run --project srcThe current model implements a Security Service that checks if lockable items (doors, windows) in houses and cars are properly secured:
Lockableinterface defines lock/unlock contractDoorandWindowimplementLockableHouseandCaraggregate lockable itemsSecurityServicevalidates security across all items
See model/model.md for the complete PlantUML diagram.
This workspace includes a custom TDD Generator agent that runs in
tdd-generator mode:
Capabilities:
- Automatically fetches GitHub issues labeled
userstory - Parses PlantUML models for domain structure
- Applies language-specific TDD patterns from
.github/instructions/ - Generates tests before implementation (Red-Green-Refactor)
- Continuously runs tests and reports progress
- Documents assumptions and ambiguities
Usage:
@Generate typescript # Process all user story issues in TypeScript
@Generate #1 java # Process specific issue in Java
@Generate python # Process all user story issues in Python
The agent follows a strict TDD workflow defined in
.github/agents/Generator.agent.md and uses language-specific instructions to
ensure idiomatic, tested code.
- Requirements Traceability - Direct link from user story → tests → implementation
- Quality Assurance - TDD ensures all code is tested and meets acceptance criteria
- Multi-Language Support - Same workflow across TypeScript, Java, Python, and C#
- AI Acceleration - Automate the tedious parts while maintaining quality standards
- Living Documentation - UML models and tests serve as executable specifications
Add New Languages:
- Create
.github/instructions/<language>.instructions.mdfollowing the established format - Define file structure, test framework, and TDD workflow
- Update README with language-specific commands
- Update
.gitignorewith language-specific patterns
Add New Features:
- Update PlantUML model in
model/model.md - Create GitHub issue with
userstorylabel and acceptance criteria - Run
@Generate <language>to implement
See GitHub issue #1 for a
complete user story example with acceptance criteria, and model/model.md for
the corresponding UML model.
This project is licensed under the MIT License - see the LICENSE file for details.