AI Tools: A Follow-Up
More thoughts on AI coming in. This will be a short post but I thought it was important to follow up on my last post lamenting AI tools.
tldr; I was only slightly right.
Introduction
After writing my previous post I kept using co-pilot and found that - whilst I still want it to just "get out of the way" sometimes - it was really useful as a support tool. I particularly found it useful for writing function documentation during a brain fog (I always checked and rewrote what it said because, hey, AI makes a lot of mistakes and assumptions) and for getting me started when writing a readme.
But I was listening to an episode of The Dysfunctional Developer where they were talking about how they were using AI and the thing that really stuck out to me was "be verbose". Now I thought this was interesting. Usually when I've been using these tools I'm assuming that short concise questions and answers is the way forward. I'm already providing whole files as context, sometimes with errors and all sorts, so I thought "why polute the input with even more data?" I wanted to avoid the dreaded hallucination problem.
But here's the interesting part. The more information, the more context, the more structure I gave the AI; the move useful it became.
Writing a README
It was when writing a readme for a test repo I was working on that I tried this more verbose approach. Rather than saying "write me a readme for this repo" and providing a bunch of files for context, I gave more specific instructions like:
Write me a readme with a title of 'my repo title' and a short description outlining the application intention.
Include a section on the software required to run the project; remember I'm using pnpm as my package manager and this is a monorepo. Also include a note on nvm/fnm and what they're for.
Additionally, include a section called 'Installation' with steps to clone the repo and install the required packages.
Finally, include a section called 'Development' which includes the commands to run the project in development mode, build the project and run the tests.
And it worked!
It was still not quite what I wanted and I ended up rewriting some aspects but the core structure was there, along with some useful bits I wouldn't have thought to include on a first pass.
Which I think brings me nicely to my new way of thinking of these tools; as junior developers. Give them clear, sometimes verbose instructions and the output will actually be decent and useful. I know this might be obvious to some but for me this completely changes the game when it comes to using these tools. I feel like I can use them more effectively and understand how I should be working with them, not having them work for me.
An aside: Cursor
To try and provide a more rounded view of the tools available, I tried out cursor. And wow. It's impressive.
It still has the same inline code completion as copilot but where it really shines is the agent mode. It was a huge productivity booster for working with new tech, particularly where it will iteratively create, fix and update the code it generates in line with your lint and test settings. It was fantastic.
This isn't a full on endorement and I still haven't fully explored all it can do but it's been a fun way to work with code and I'm interested to see what else I can do with it.