Augmented Coding: Better with Principles

5 days ago 2

Today I opened the AWS console in order to transcribe a video, and I could not be bothered to do all that clicking.

This has to be six lines in the terminal. I don’t know the six lines, but Claude does.

Claude “automated the entire Amazon Transcribe workflow” in 300 lines of dependency checking, argument parsing, fancy printing, downloading with curl, and converting JSON into .SRT format on its own. Good grief.

The SRT generation was too much. “AWS Transcribe is perfectly able to output srt,” I pointed out drily.

“You’re absolute right!” it panted with eagerness to write more lines of bash. After slashing through the code on the screen, it bragged about the complex awk processing it removed, the ~50 lines of manual subtitle formatting gone. Then once again it touted the features of its over-implemented script.

This is fine.

Until it doesn’t work. 🙄

We hit all kinds of problems. Special characters in the job name, file too large, you can’t download private S3 files with curl, and 8 iterations of syntax errors. Each time it ran the transcription job, it’s a few minutes of waiting.

One trick took this from “I give up, I’ll keep clicking in the console” to worthwhile:

Each time it had to change a step, I told it to make the previous steps recoverable.

“Make sure you check whether the video file has been uploaded already, and don’t do it again.”

“Check whether the transcription job already exists.”

“Use a consistent job name. Stop putting the date in it.”

Each time Claude responds like I just threw the stick again. “You’re absolutely right! The timestamp in the job name defeats the purpose of checking for existing jobs.”

Principle of automation: any step that takes more than a few milliseconds needs to recover previous work.

I learned this principle from years of experience. Migrations especially — you have to be able to retry a failed one. It has to pick up from the last completed step or batch. That means it has to leave intermediate artifacts, then look for them in future runs.

This principle makes migration scripts longer and harder to write. So what! Claude loves to write more lines of code, add more checks, nest those conditionals!

Re-using work made eleven script iterations go quickly and feel productive.

Results:

Creating the script still took 20x as long as clicking in the console. But hey, it was more interesting. Next time I publish a video, there’s less friction, and that gets me to do it more. (That behavior change is the real benefit of automation.)

Of the eleven iterations, ten were Claude’s mistake or oversight. Nine of those it corrected on the first try; one got it stuck, and I had to diagnose the problem. One—the limitation on input video size—was a surprise, and Claude was ready to help.

“Oh no, my video file is too big! What could we do?” I cried.

“Here are a few solutions,” Claude chirped: “Option 1: split the video into chunks… Option 2 [meh]… Option 3, extract the audio. … I’d recommend Option 1.”

After considering these, I urged “Let’s pursue Option 3, because this would keep the timings correct.”

“You’re absolutely right,” Claude fawned, “extracting audio is the best approach to keep timings intact! … It’s much simpler than splitting video.”

Boy, Claude really pivots quickly. This kind of deference gives me the creeps. It can lead to going deep into bad decisions.

Fortunately it’s a script, so there’s only so deep was can go. Claude knew exactly how to convert the video to audio. This much scripting would have taken me all day (between meetings), and with Claude it took an hour. I wouldn’t have done it without AI help, and that’s a behavior change that scales.

The moral of this story: some hard-earned experience combined with AI assistance leads to effective coding.

Read Entire Article