From 7bd8cbd7070206f8ba64c6476ac87ba725e03512 Mon Sep 17 00:00:00 2001 From: ninaflaaten Date: Mon, 23 Nov 2026 13:00:29 +0100 Subject: [PATCH 1/2] Expand AI usage documentation --- docs/ai-usage.md | 53 ++++++++++++++++++++++++++++++++++++++++++++---- docs/quality.md | 2 +- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/docs/ai-usage.md b/docs/ai-usage.md index 75b463d2..adf322c5 100644 --- a/docs/ai-usage.md +++ b/docs/ai-usage.md @@ -1,9 +1,10 @@ # AI usage -AI was used as an assistant throughout the development of the web application. The tools we used were Claude, ChatGPT and GitHub Copilot. +AI was used as an assistant throughout the development of the web application. The tools we used were Claude, ChatGPT, GitHub Copilot and Figma AI. This document describes what we used AI for, how we gave the tools context, how we kept control of the code, and what we think about the good and bad sides of using AI in a project like this. ## What AI was used for +- **Design:** Figma AI was used to make the mock-up from our hand-drawn sketches (see [quality.md](quality.md#ideation-process)). - **Setup and configuration:** setting up the project in VS Code, Vitest, and the project structure with backend and database. - **Explaining technical concepts:** how the database, backend and frontend are related, how to implement debounce, the difference between offset- and cursor-based pagination, and when a database index helps. - **Writing code:** suggestions for code, which were reviewed by the team before they were used. @@ -12,6 +13,26 @@ AI was used as an assistant throughout the development of the web application. T - **Generating pictures:** the avatar pictures on the profile page and the placeholder picture for plants without an image were made with AI. - **Refactoring:** splitting large files containing a lot of logic into smaller components and hooks. +## Context and prompting + +### From sketches to a shared design + +Before we wrote any code, we drew the main pages by hand. We then gave the sketches to Figma AI, which made a mock-up based on them. The mock-up gave the group a shared picture of the colors and layout, and made it easier to talk about the design. It was a reference for the visual style, not a finished design, and the app changed a lot during development. + +The mock-up was mostly used as a reference for us, not as context for the other AI tools. When we asked AI for help with the UI, we described what we wanted, or used the components that already existed as an example, so new parts would look like the rest of the app. + +### Working across three tools + +The three tools were used for different things. Copilot was used in the editor for small suggestions while we wrote code, and it only saw the files that were open. Claude and ChatGPT were used in a chat or in the terminal for bigger tasks, such as explaining a concept, writing tests or refactoring a file. + +For most of the project we did not have a shared setup for AI. Each of us gave the tools context ourselves, by pasting in the relevant files, the issue we worked on, error messages or parts of the README and the architecture document. We found that the answers got much better when we gave the tool the code it should build on and told it what not to change. Short and specific prompts worked better than asking for a whole feature at once. + +The downside was that the context was different for each person and each tool. The tools did not know our rules, so we sometimes got suggestions that did not follow the structure of the project, for example new files in the wrong folder, text that was not translated, or a new package for something we already had. We then had to correct this in the review. Prompts that worked well were shared in the group chat, but they were not written down anywhere in the repo. + +### What we would do differently + +In retrospect, we should have added a shared context file, such as an `AGENTS.md`, in the root of the repo from the start. It could have described the project, the tech stack, the code structure and the rules we follow, such as that all text must be translated, that the app must meet WCAG 2.1 AA, and that new code needs tests. Claude, Copilot and ChatGPT can all read such a file or have it pasted in, so all three tools would have had the same context, no matter who used them. Since the file would live in the repo, it would also be reviewed and updated in pull requests like the rest of the code. Many of the corrections we made in the reviews were about rules like these, so a shared file would probably have saved us time. In future projects we will set this up before we start writing code. + ## Concrete examples of AI use ### The seed script @@ -34,10 +55,34 @@ After the peer reviews, we used AI to help us split up `ExplorePlants.tsx`, whic ## How we kept control -All AI-generated suggestions were reviewed, tested and adapted by the team before they were committed. Every change went through a pull request that had to be approved by another group member (see [quality.md](quality.md#work-practices)), so no AI-generated code was merged without a review. Design and architectural decisions were made by the team. - -In retrospect vi could have added a globall context-file for the AI models used. This would have been helpfull to make sure all AI models used followed the same rules. In future we would do this. +All AI-generated suggestions were reviewed, tested and adapted by the team before they were committed. Every change went through a pull request that had to be approved by another group member (see [quality.md](quality.md#work-practices)), so no AI-generated code was merged without a review. The tests and lint in GitHub Actions also had to pass. Design and architectural decisions were made by the team. ### Being critical of a suggestion from AI We did not always follow the suggestions from AI. For example, when My Matches was changed to fetch one page of plants at a time, the old `matchedPlants` field on the user was no longer used by the app. AI first suggested keeping the field because the tests used it, but we decided to remove it, since keeping unused code only for the tests made no sense. Before removing it, we searched the code for every place it was used, to make sure it was safe. Then we updated the tests to use the new field, and wrote new tests for the `myMatches` query. + +This was not the only time. AI often suggests more code than is needed, such as extra checks, extra state or a more general solution than the problem asks for. It also tends to keep old code instead of removing it, and to make a test pass by changing the test instead of the code. AI is also very sure of itself, even when it is wrong, so an answer that sounds right is not always right. We therefore treated the suggestions as a first draft and not as an answer. + +## Reflection + +### What AI was good for + +AI saved us a lot of time on work that is repetitive or follows a known pattern, such as setup, tests with mocks, the seed script and moving code during a refactor. It was also useful as a teacher that is always available. When we did not understand something, such as cursor-based pagination or why a database index helps, we could ask follow-up questions until it made sense, and then try it out in our own code. AI also helped us think of test cases we would not have thought of ourselves, and made it easier to get high test coverage. + +### Learning + +The biggest risk for us was that AI could do the work we were supposed to learn from. It is easy to accept code that works without understanding why it works, and then you have not learned anything, and you can not explain or fix the code later. It also became clear in the reviews: if the person who made the pull request could not explain the code, the reviewer could not trust it either. We tried to use AI to explain things rather than only to write them, and the rule was that you should be able to explain all code you made a pull request for. We still think we learned less about some parts, such as the configuration of Vite and Vitest, than we would have done without AI, since we mostly used the setup AI suggested. + +### Copyright and data + +AI models are trained on code and pictures made by other people, often without them having agreed to it, and it is not always clear who owns what the model makes. For code this was a small problem for us, since most of the code follows common patterns, and all of it was reviewed and changed by us. The pictures are more uncertain. The avatars and the placeholder picture are made with AI, and we can not know how much they are based on the work of real artists. If the app was to be used for real, we would think about using pictures made by a person or with a clear license instead. The plant data and images come from the Perenual API, and not from AI. + +We also had to think about what we gave the tools. We never pasted secrets, such as the `.env` file or passwords to the VM, into an AI tool, since we do not control what happens with the data afterwards. + +### Energy use + +Training and running large AI models uses a lot of energy and water. This is a bit at odds with the focus on sustainable web development in the rest of the project (see [quality.md](quality.md#sustainable-web-development)), where we tried to keep requests and responses small. A single prompt does not use much, but many long conversations over a whole semester add up, especially when the same question is asked again because the tool did not get the right context. Better context, such as a shared context file, would also have meant fewer prompts. We could also have been better at choosing a smaller model or just looking in the documentation for simple questions, instead of always asking AI. + +### Summary + +AI made us faster and helped us understand things we did not know, but it did not replace our own thinking. It worked best when we knew what we wanted, gave it the right context and checked the result, and worst when we asked it to do a lot at once without understanding the code. In a future project we would set up a shared context file from the start, agree on how we use AI as a group, and be more aware of when it is better to do the work ourselves to learn it. diff --git a/docs/quality.md b/docs/quality.md index 6b08bd55..db363cbc 100644 --- a/docs/quality.md +++ b/docs/quality.md @@ -26,7 +26,7 @@ GitHub Actions ([.github/workflows/ci.yml](../.github/workflows/ci.yml)) runs on Hand-drawn sketch of the profile page with a profile picture and fields for information about the user -- We then used Figma to find inspiration for colors and layout. The mock-up below was used as a reference for the visual style, not as a finished design. +- We then gave the sketches to Figma AI, which made a mock-up based on them. The mock-up below was used as a reference for the visual style, not as a finished design. Figma mock-up of a plant app with a green sidebar menu, a search bar, plant cards with photos and a list of care tasks From 6a811cdf95e684fd2e5289d4c99082ddb597f96c Mon Sep 17 00:00:00 2001 From: ninaflaaten Date: Mon, 23 Nov 2026 13:34:11 +0100 Subject: [PATCH 2/2] Add AI decklaration about help with merge conflicts --- docs/ai-usage.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/ai-usage.md b/docs/ai-usage.md index adf322c5..3bb3b356 100644 --- a/docs/ai-usage.md +++ b/docs/ai-usage.md @@ -12,6 +12,7 @@ AI was used as an assistant throughout the development of the web application. T - **Writing documentation:** drafting and refining documentation and comments in the code. - **Generating pictures:** the avatar pictures on the profile page and the placeholder picture for plants without an image were made with AI. - **Refactoring:** splitting large files containing a lot of logic into smaller components and hooks. +- **Resolving merge conflicts:** when several of us had changed the same files, AI helped us combine the changes faster. We checked the result and ran the tests before we committed it. ## Context and prompting