Sometimes I know exactly what I need, but I don't know how I can get it done. In the past, I would have spent hours reading the reference documentation or tried to find tutorials which explain how I can write the code (or configuration) I need. This is a slow and frustrating process, especially, if you don't have a lot of experience from the tools you must use.
Nowadays, I just start a new discussion with an AI chatbot and let the conversation evolve into a working code (or configuration). Here are six concrete success stories from my short AI assisted engineering journey:
Check out my other AI posts:
1. Creating AWS Infrastructure With Terraform
I had to create an AWS infrastructure with Terraform, but I had only a basic knowledge of AWS, and I had never created Terraform configuration from the scratch. I had only made minor changes to an existing Terraform configuration. To be honest, I didn't think that I can finish this task.
I took a look at the Terraform documentation, but it's not really useful if you are just getting started. Thus, I decided to give AI assisted engineering a shot. I described my application and explained what AWS services I want to use. After ChatGPT generated the initial terraform configuration, I started doing incremental improvements to it by following these steps:
- I did a basic smoke test by running the terraform plan command.
- I compared the generated configuration with both AWS and Terraform documentation, and verified that the generated configuration does what I wanted it to do and ensured that ChatGPT didn't cut any corners.
- I asked ChatGPT to fix the configuration (if the terraform plan command failed) or improve it (if I noticed that the configuration is missing something or isn't following the best practices).
- Rinse and repeat.
It took me maybe 4-5 days to create the first PR. Even though I (and one other member of my team) had to make changes to the Terraform configuration, I was surprised to see that the PR didn't have any serious problems.
2. Writing OpenAPI Specifications
I am a huge fan of OpenAPI, but I am not a fan of YAML. That's why writing OpenAPI specifications has always felt like a tedious chore. That changed when I started using ChatGPT. Now I simply describe the API endpoint and its data model, and ask ChatGPT to generate the OpenAPI specification. After ChatGPT has done its magic, I can simply fill the blanks and add the generated specification to my project.
That being said, using AI isn't necessary faster (at least in the beginning) because it takes time to write a proper description of the implemented API endpoint. That's why I recommend that:
- You should create an API endpoint specification template which contains all common headers and errors. This will save your time because you can concentrate on describing the requirements of your API endpoint.
- If you can share your current OpenAPI specification with AI, you should definitely do it because it ensures that the generated specification is more consistent with your existing API. This means that you have to make less changes to the generated OpenAPI specification when you add it to your project.
3. Learning React in a Real Software Project
I am a person who learns by doing. When I wanted to learn React, I didn't want to read tutorials or watch video courses. I wanted to write code. Also, I was lucky enough to be
in a project which had a frontend application that's written with React. Thus, I could just pick up a task which required me to write React code and finish the task by following these steps:
- Describe the problem to ChatGPT and ask it to write the code that fulfills my requirements.
- Test if the provided code works and ensure that it follows the best practices used in the project.
- If the code requires more work, I will fix it myself or ask ChatGPT to fix it.
- When I am happy with the code, I create a new PR and wait for review comments.
- If the code requires more work, I will fix it myself or move back to step one.
After the PR was accepted, I merged it and picked a new task from the backlog. When I had done this for a week, I noticed that I didn't need to use AI for everything and I could write at least some React code without asking for help.
After I had repeated this process for a few weeks, I started to understand concepts like hooks and state management. Also, I noticed that my questions changed a bit. I was asking more questions about CSS, Typescript, and Material UI, and less questions about React. I don't pretend to be a React expert, but at the moment I don't need any help for writing the React code that's required to implement CRUD applications.
The best part of this whole process was that I could ask the same stupid questions over and over again. It was like having a personal coach who never judges or gets tired of answering the same questions.
4. Fixing Flaky Playwright Tests
I had written a small Playwright test suite which I ran manually after I did a WordPress update. The problem was that some tests of the test suite were failing randomly even though the website was working as expected. I suspected that this is caused by unresolved promises (aka missing await keywords), but I couldn't find the problem.
So, I shared my test code with ChatGTP, described my problem, and asked ChatGPT to fix my tests. I have to admit that I was surprised to see that ChatGPT found the problem and fixed it. This happened four months ago and my test suite is no longer suffering from false positives.
5. Creating Docker Compose Scripts
I recently started a new hobby project, and I wanted to run Keycloak and PostgreSQL with Docker on my local development environment. Thus, I asked ChatGTP to:
- Write a database initialization script which creates the required database and database users.
- Create the docker-compose.yaml file which configures the required Docker containers.
- Write the shell scripts which are used to:
- Start the docker containers.
- Stop the docker containers.
- Reset the dev environment (delete all data).
The first version of the docker-compose.yaml file didn't work. The problem was that the PostgreSQL image created the application's database and the database initialization script failed because the created database was already found from the PostgreSQL server. After I pointed this out, ChatGPT fixed the problem and everything was working as expected.
6. Configuring Keycloak
My hobby project has pretty a basic architecture. It has a frontend application which must redirect anonymous users to Keycloak, obtain a JWT token from Keycloak, and include the JWT token in the HTTP requests sent to the backend application. The backend application must validate the JWT token and implement the authorization rules.
The thing is that I have a love and hate relationship with Keycloak. I am grateful that it's open source and I can use it for free, but configuring it can be a bit painful. The last time I used it was three years ago, and it took me several days to get the configuration working. I really didn't want to go down the rabbit hole again. That's why I described my requirements to ChatGPT and asked if it can help me to configure Keycloak. Five minutes later I had created a new realm and configured the required clients (one for frontend and one for backend).
After I had verified that the configuration was working correctly, I exported the Realm configuration as JSON and asked ChatGPT to make sure that Keycloak imports the Realm configuration when it's started for the first time. After ChatGPT had done the required changes to my docker-compose.yaml file, I tested the new configuration and noticed that it was working as expected.
I have to admit that I was pretty impressed because this whole process took maybe half an hour.
What Did I Learn From All This?
First, AI didn’t replace me. It just helped me to get the job done faster. But speed doesn't remove the need for expertise. You still have to describe the problem, know the tools you’re using, validate that the solution works as expected, and understand why the solution works as expected.
Second, I was surprised to see how good AI is at scraping information that's hard to find with search engines. The best example of this is the Keycloak configuration. In the past, I had to spent days digging through outdated tutorials and contradictory documentation. This time I got the job done under half an hour.
Third, Collaborating with AI felt like discussing with a senior colleague. The only difference is that AI never gets tired, never loses patience, and is happy to answer the same beginner question five times in a row. This is extremely helpful when you are trying to learn new skills.
I’m just getting started with AI assisted engineering, and I will share my experiences with you. If you’re interested, you should subscribe my newsletter by using the form below.