Integrating AI into my workflow
Earlier this year I joined Sana and opened the backend codebase. It was written entirely in Kotlin. I’d never written a line of it. The frontend was TypeScript, which I knew well, but the backend was a different world. The syntax looked close enough to Java (which I’d worked with at Spotify a few years prior) that I could squint and follow the shape of things, but the idioms were foreign. Extension functions, data classes, scope functions like let and apply chained in ways I couldn’t parse on first read.
My instinct was to open the Kotlin docs, find a tutorial, maybe skim a “Kotlin for Java developers” guide. Instead, I pasted a block of code into GPT and typed: “Explain what this does, line by line.”
It worked.
Not perfectly. Not every time. But well enough that I kept doing it. I’d write a function, paste it in, and ask: “Is this idiomatic Kotlin, or am I just writing TypeScript with different punctuation?” GPT would come back with suggestions (use also here, replace this if chain with a when expression, this whole block can collapse into a single let call) and I’d rewrite, paste again, ask again. A feedback loop that felt less like reading documentation and more like pair programming with someone who never gets impatient.
I’d tried ChatGPT before this. Asked it to generate code, got back something that looked plausible but wasn’t usable. Didn’t see the point over just writing it myself. But learning Kotlin was different. I wasn’t asking GPT to write code for me. I was asking it to explain code I was already looking at, to critique code I’d already written. I had something specific to push against, and that changed everything. I ran it through Raycast AI (powered by GPT-4), a tool I already used daily that had just shipped their AI features.
It’s a rubber duck that talks back.
I don’t mean that dismissively. Rubber duck debugging works because the act of explaining your problem forces you to think clearly about it. GPT does that, but it also responds, and the response doesn’t have to be brilliant. It just has to be close enough to give you something to push against. You paste an ugly function, it offers a cleaner version, you spot what it missed, and now you understand the code better than if you’d just stared at it.
Refactoring is where this hits hardest. You’re working in an existing codebase, you find a function that grew ugly over six months of patches, and you need to clean it up without breaking anything. That’s grunt work. The kind of task where having a second pair of eyes (even artificial ones) saves real time. I paste the function, ask for a refactored version, and use the output as a starting point. “Sometimes maybe good, sometimes maybe shit.” When it’s off, I start over, explain what I’m actually trying to do, paste again. GPT has the biggest patience in the world. It doesn’t care if I ask the same question five different ways. It just keeps answering.
And then there are TypeScript errors. Anyone who’s worked with complex TypeScript generics knows the feeling. The compiler spits out a type error four lines long, nested three levels deep, referencing types you didn’t write. I used to squint at those for minutes, mentally unpacking each layer. Now I paste them into GPT and get back a plain-language explanation of what’s actually mismatched.
But none of this works if you can’t tell when it’s wrong. GPT hallucinates. It invents plausible Kotlin APIs that don’t exist. It suggests TypeScript patterns that compile but introduce subtle bugs. It rewrites your function and quietly drops an edge case. You need to know enough to catch that, to read the suggestion and feel the thing that’s off before you run it.
I still write Kotlin every day. I can write decent code now, but I still need a reviewer (a colleague, or increasingly, an AI) to catch the things I miss, to push it from functional to idiomatic. GPT didn’t teach me Kotlin. But it compressed the awkward early phase (the phase where everything takes three times as long because you’re translating in your head) into something shorter and less painful. I’ll take that.