Check you are looking at the right thing
I sat down to design a fairly big piece of backend work: publishing a learning plan and assigning it to individual learners. I explored the code, understood how the existing pieces fit, and wrote a plan.
The plan was almost entirely wrong. Not because the thinking was bad, but because I had been looking at a stale copy of the code.
98 commits behind
When I finally had the live branch pulled properly, it was 98 commits ahead of what I had been reading. And those commits were not trivia: a large part of the thing I was about to design had already been built. The publishing side, the conversion of plan content into real objects, even part of the per-learner structure. I had written a plan for a problem that was already half solved, against a reality that no longer existed.
The rewrite was quick once I was looking at the right thing. But everything before that, the exploration, the design, the confidence, was wasted because the foundation was out of date.
The cheap habit I skipped
This is the least glamorous lesson in software and one of the most expensive to relearn: before you plan, check you are looking at the current state of the world. Which branch is actually live. What has already shipped. What the real tables look like right now, not what they looked like last week.
It is five minutes. Skipping it cost me the entire first pass. When a codebase is moving fast, and the good ones always are, the single most valuable thing you can do before designing is confirm the ground you are standing on is real.
There is a version of this for working with an AI assistant specifically: the model will happily explore and plan against whatever code it is pointed at, with total confidence, whether or not that code is current. The confidence is not the check. You are the check. Point it at the live thing first.