Coding with AI? We’re Designing Together

Gradually I started speaking up more

Me:

Can’t you just… fix it?

Claude:

I can, but I’d rather understand the root cause before changing the code.

Me:

There are two reasons I don’t want you to jump straight into coding.

I want to understand how the system works.
If I come up with a better idea than yours, I want to discuss it.

Claude:

That’s actually the better way to work.

While implementing a hair-length adjustment feature, we ran into a strange issue.

Hair strands that didn’t exist in the original image suddenly appeared after increasing the hair length.

At first, Claude suspected that the problem came from the extension (ext) section, where the strand direction was becoming “frozen.”

But something didn’t feel right.

Me:

Where is that strand even coming from?

It looks like it’s supposed to continue from an existing strand, but after destination-in clipping, it suddenly appears only when the extension section is rendered.

What’s strange is that it isn’t connected. It’s just floating next to the original strand.

Claude:

According to the original design, the base section and the extension section share the same split point (splitIdx), so they should never become disconnected.

The starting point (sy_img, scalpY) is probably correct.

The real issue is that the end of the base section gets clipped away by the hair mask, creating the illusion that the extension starts in midair.

The deeper problem is that splitIdx is calculated using the physical step distance while comparing it to the original vertical hair length (origLen).

Once the strand bends because of curl or orientation data, those two measurements no longer represent the same thing.

Then Claude suggested something I really liked.

Instead of guessing, why don’t we verify it?

We can place a temporary marker at the split position and visually confirm whether it’s inside or outside the mask.

Exactly.

Adding Diagnostics to Validate the Hypothesis

Debug first.

Guess later.

Then we traced the code again and found the real culprit.

stepLen = targetLen / steps;

As the target length increased, stepLen increased as well.

Which meant that…

Even the path before reaching the original hair length (origLen) was changing.

That wasn’t supposed to happen.

So no matter how carefully we clipped the extension, the base path itself had already changed.

Our Solution

Instead of changing the step length, we flipped the entire idea.

Before

Target Length

Step Length

After

Fixed Step Length

Number of Steps

We also split the strand generation into two independent stages.

Base (origLen)
+
Extension (delta)

The base section always follows exactly the same path as the original image.

Only the extension is generated separately.

That means increasing the hair length never changes the original strand.

Only the newly extended part is affected.

One More Improvement

There was another issue.

Whenever the orientation data became unreliable, the strand direction simply froze.

Instead, we changed it so that the strand gradually returns toward the downward direction.

The transition became much smoother and looked far more natural.

The Best Part

The interesting thing is…

This wasn’t a case where AI simply gave me the answer.

The turning point came from a question I asked.

“If this artifact doesn’t exist in the original image, why does it suddenly appear after changing the length?”

That question shifted the entire discussion.

Instead of fixing a symptom, we started investigating the underlying architecture.

From there, we designed the solution together.

Analyze the cause
Redesign the structure
Implement the solution

Step by step.

This Is How I Work with AI

People often think AI is just a code generator.

That’s not how I use it.

I treat AI more like a coworker.

Sometimes it proposes an idea.

Sometimes I question its assumptions.

Sometimes I suggest a completely different direction.

Then we review the design together before writing any code.

That collaboration has become the most enjoyable part of development.

AI isn’t replacing the developer.

It’s becoming another engineer sitting next to me, helping me think through problems from a different perspective.

And honestly…

I’m learning just as much from these conversations as I am from the code itself.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *