Use AI Coding Assistants with Workbench
You're using or want to use Coding Assistants with the Workbench? Start with this quick introduction, showcasing different use cases and how you can make the most of AI.
Outlineโ
This How-To will cover different use cases and showcase prompts specifically designed to work with the Workbench:
- Creating an initial structure
- Implementing Entities based on given design
- Implementing Data Persistance
- Implementing Business Logic
- Implementing APIs
- Implementing Integrations
Prerequisitesโ
Have a Coding Assistant installed and ready on your device. We recommend one of the following Assistants:
- Cursor IDE - An AI-first code editor with powerful code generation capabilities
- GitHub Copilot - GitHub's AI pair programmer that integrates with various IDEs
The quality of generated code depends entirely on the AI coding assistant's capabilities and training data. Always review, test and validate AI-generated code before using it in production. The design files provide context, but the final code quality and correctness are the responsibility of the developer.
Preparing your project for Coding Assistantsโ
To help AI Coding Assistants with generating code from your design files and understanding the project we will extend the Readme.md with some general information about the project.
## Design files
* the design-files under `/src-design` represent the designed building blocks of the project
* the subfolder structure reflects the different design element types (e.g. domain entities under `/entity`)
### Source code
* the source code can be found under `/src`
#### Entity classes
* entity classes are grouped inside a folder, where each entity is represented by a separate file
If you want to use a different structure you can simply change the folders mentioned in the Readme.md
Using Coding Assistantsโ
Create an initial structureโ
Based on the provided information in the Readme.md file we want to create an initial folder structure for the project
Create initial folders under src for all the api, domain and integration namespaces (namespace level only) and update Readme.md accordingly.
Once the basic project structure is in place, coding assistants can help you quickly generate the actual implementation across all layers of your application. The following sections show example prompts you can use for each type of implementation task - entities, persistence, business logic, APIs, and integrations. Choose the category that matches what you want to build next.
Prompt collection for different use casesโ
- Entities
- Data Persistence
- Business Logic
- API
- Integration
Create classes for one entity and dependent items
Based on the design files, create a class with properties for entity <EntityXYZ> including all not existing entities that it is relying on.
Create classes for all entities of a namespace
Based on the design files, create classes with properties for all entities defined in namespace <NamespaceXYZ>.
List discrepancies between design and current implementation
Based on the entity design files, list all places where the current implementation doesn't match.
Ensure alignment of entity implementation with design specification
Make sure existing entities and their properties align with design files.
For one entity:
Make sure entity <EntityXYZ> and its properties align with design files.
Implement data persistence for root entitiesโ
Based on the design files, implement data persistence for all root entities of domain namespace <NamespaceXYZ>.
Implement commands of an entity
Implement all commands of entity <EntityXYZ> as methods on the entity.
If you want to make sure that only directly associated commands are implemented you can add the following:
Ignore the parent commands.
Implement all commands of a namespace
Implement all commands defined in namespace <NamespaceXYZ> as methods on the entities. Make sure you implement them according to the described implementation logic.
Implement one domain service
Implement domain service <ServiceXYZ> as separate service class.
Implement all services of a namespace
Based on the service design files, implement all domain services of namespace <NamespaceXYZ>. Make sure you implement them according to the described implementation logic.
List discrepancies between design and current implementation
Based on the command and domain service design files and their described implementation logic, list all places where the current implementation doesn't match.
Ensure alignment of current implementation with design specification
Make sure existing command and domain service implementations align with design files.
For one command:
Make sure command <CommandXYZ> aligns with design files.
For one service:
Make sure service <ServiceXYZ> aligns with design files.
Implement provisioning of a REST API
The following prompt is recommended to be used if the domain implementation (if required) is already present so that it can be reused in the REST API implementation:
Based on the design files, create and implement the API defined in namespace <APINamespaceXYZ>.
If the domain implementation is not yet there, but it is required to create a skeleton first and later on wire the REST API to the domain, the following prompts can be used:
Create a skeleton of the REST API defined in namespace <APINamespaceXYZ> with no implementation.
Implement REST API defined in namespace <APINamespaceXYZ> and make sure you make use of the domain implementation where it makes sense.
Implement Swagger UI
Depending on your settings, this might be already implemented after the "Implement provisioning of a REST API" prompt.
Implement a Swagger UI for the REST API <APINamespaceXYZ>.
Setup Swagger UI for local development
According to how the API specification is generated, local usage of the Swagger UI might not work out of the box.
Ensure Swagger UI works for local development.
List discrepancies between design and current implementation
Based on the API namespace design files, list all places where the current implementation doesn't match.
Ensure alignment of API implementation with design specification
Make sure API <APINamespaceXYZ> aligns with defined OpenAPI specification and described logic implementation.
Implement integration of external REST APIs
Based on the design files, create the implementation for the integration namespace <IntegrationNamespaceXYZ>.
List discrepancies between design and current implementation
Based on the integration namespace design files, list all places where the current implementation doesn't match.
Ensure alignment of integration implementation with design specification
Make sure implementation of integration namespace <IntegrationNamespaceXYZ> aligns with design files.