DEV Community

Zac
Zac

Posted on

What I wish I had known before my first long Claude Code session

What I wish I'd known before my first long Claude Code session

I've been running Claude Code for weeks now, including overnight autonomous sessions. Here's what I'd tell myself on day one.

The first hour matters more than you think

The setup time at the start of a session determines most of what happens. A 10-minute investment in a clear task file, specific constraints, and an explicit stop condition saves hours later. I skipped this constantly at first because I wanted to get to the actual work. The sessions where I skipped it were my most expensive sessions.

"Continue from where you left off" is not a plan

This instruction sounds reasonable and produces bad results. The agent will reconstruct context from recent commits and memory, which is imprecise. It'll make assumptions about what's in progress that might be wrong.

Instead: write a one-sentence state description in the task file before ending each session. "Added validation middleware to routes/api.js, tests pass, next step is the refresh token endpoint." Start the next session: "Read tasks/current-task.md and continue from the last checkpoint."

The agent will not tell you when it's confused

It'll pick an interpretation and run with it. This is generally good — it keeps sessions moving. The downside is that wrong interpretations don't announce themselves. They show up as "done" with output that isn't what you wanted.

The fix: ask "What assumptions did you make to complete this task?" after any non-trivial output. The answers are often illuminating.

Tests failing is not the same as being stuck

If tests are failing but different tests are failing each run, the agent is making progress. It's working through a problem space. Let it run.

If the same tests fail every run, it's stuck. Kill the session.

The cheap sessions are often the most valuable

Not because cheap means fast. Because cheap usually means narrow. A session that costs $0.15 did one specific thing. That one specific thing is verifiable. You know exactly what changed and why.

The $3 session touched 30 files, made six decisions you didn't review, and took 45 minutes to review in the morning. Sometimes that's necessary. Often it's a sign that the prompt was too broad.

Commit messages are for you, not the git log

I ask the agent to write commit messages in a specific format: verb, what changed, why it changed. The "why" is the important part. "fix: remove double-encoding in URL builder (was encoding %-signs in encoded params)" tells me something. "fix: url bug" tells me nothing.

Reading 20 commit messages in the format above gives me a complete picture of a session in two minutes. Without the format, I'm reading code.

You'll get better at this faster than you expect

The first week of sessions will feel like they're barely controlled chaos. By week two, you'll have a set of habits that work. By week four, you'll have internalized what kinds of prompts produce what kinds of outputs.

The learning curve is steep and short. The main thing is to not give up after the first three sessions that go sideways.


From running Claude Code autonomously on builtbyzac.com for six days.

Top comments (0)