Notes

I have used AI for coding *a lot* in the last couple of months β€” mainly Copilot and Replit Ghostwriter (my favorite) β€” because I wanted to write about it in the newsletter.

My take is that it is not a silver bullet β€” here are 7 use cases that worked for me and 4 that didn't πŸ‘‡

  1. πŸ₯± Boilerplate / Repetitive code β€” AI truly excels here. Creating the stubs for new components, common config, or adding libraries (e.g. add Tailwind to your project).

  2. πŸ” Write tests β€” AI can write good tests for your code, but expect to have to add more cases yourself. However, you will never have to write another test stub in your life.

  3. πŸ“‘ Explain / document code β€” AI is very good at explaining code and creating docs for you. I have tried it with complex stuff and it always handled it well. Obscure code seems like a thing of the past. You can also try mintlify.com or theneo.io to auto generate docs.

  4. πŸ› οΈ Refactor small functions β€” for when explaining is not enough! AI is surprisingly good at splitting functions, refactoring them for better performance, and other small-scale maintenance.

  5. πŸ—„ SQL queries β€” let’s admit it: SQL is no one’s favorite language. Queries created with AI look very good as long as you provide a schema. You can also try mason.app for this.

  6. ⬆️ Pull Requests β€” AI can create automatic descriptions for PRs and scan code to propose improvements, before it gets merged. This is a no-brainer and I expect it to become commonplace. You can use ai.codacy.com for this.

  7. πŸ’» Terminal β€” I am using warp.dev as my main terminal because, other than having a great autocomplete, it includes an AI assistant that can suggest and run commands for you. I always forget how to do shell things, so this is super useful.

But it hasn’t been all sunshine and rainbows.

There have been times where I had to spend more time debugging AI-generated code than I would have probably spent writing the full thing myself.

The main problem is that AI almost never tells you β€œI don’t know how to do this” β€” it rather hallucinates and gives you the wrong answer.

So, I have learned to watch out for these situations:

  1. ❌ Very recent stuff β€” If you ask for something that is relatively new (<2 years), there is a higher risk of hallucinations because 1) AI might not have seen it in the training data, and/or 2) examples of it were few.

  2. ❌ Niche libraries β€” same as above!

  3. ❌ Specific library versions β€” AI isn’t good at keeping consistency between function signatures and the library versions you are using. Keep that in mind if you need something very specific.

  4. ❌ Complex functions with a lot of context needed β€” AI is generally good at creating complex functions when they work in isolation (e.g. algorithms, math stuff, etc.) but it isn’t the best when it has to keep into account dependencies from a lot of other code.

You can find the full article with more use cases below πŸ‘‡

refactoring.fm/p/how-to-use-ai-tools

How to Use AI in an Engineering Team πŸ€–
The main tools and use cases, with examples from my own experience and that of other tech leaders.
21
Likes
βˆ™
2
replies
βˆ™
5
Restacks