/ Blog
Home Blog Contact Buddy Ads Builder Audit Engine

My Best Workflow for Working with Claude Code

Claude & Anthropic

The most effective Claude Code workflow centers on three practices: maintaining a CLAUDE.md file that Claude reads at the start of every session, running a structured orientation phase before any code is written, and breaking work into atomic subtasks with a commit checkpoint after each one. These habits eliminate the drift and conflicting-instruction spirals that plague unstructured Claude Code use.

Key takeaways

  • A CLAUDE.md file at your project root acts as persistent memory across sessions — Claude reads it automatically at session start. [1]
  • Always orient Claude before tasking it: ask it to read context files and summarize its understanding before writing a single line of code.
  • Atomic subtasks with commit checkpoints after each one give you clean rollback points and keep Claude focused on one thing at a time.
  • A session handoff note — written by Claude at the end of every productive session — is the single fastest way to maintain continuity across long projects.
  • Structure around a session matters more than any individual prompt; Claude Code rewards repeatable systems, not one-off clever instructions.
Key terms
Claude Code
Anthropic's agentic coding environment that allows Claude to read and write files, run terminal commands, and execute multi-step implementation tasks directly in your codebase.
CLAUDE.md
A markdown file placed at a project's root that Claude Code reads automatically at the start of every session, acting as persistent memory for project context, conventions, and constraints.
Atomic subtask
A single, clearly bounded unit of work given to Claude in one step, after which a git commit is made before moving on — enabling clean rollback if the output is wrong.
Session handoff note
A structured summary Claude generates at the end of a session capturing what was completed, what decisions were made, and what the next steps are — used to initialize the following session.
Agentic coding
An AI workflow where the model autonomously takes sequences of actions — reading files, writing code, running commands — to complete a multi-step programming task with minimal human intervention between steps.
---

Why does Claude Code keep going off-track mid-session?

Claude Code drifts not because of capability limits but because of missing structure. When a session starts without clear constraints and project context, Claude makes confident assumptions about your codebase — and those assumptions compound. By the time you notice something is wrong, you may have a 200-line diff to partially revert.

The practitioners who get consistent results from Claude Code — a question that comes up regularly in the r/ClaudeAI community — share one trait: they've built a repeatable system around every session, not just better prompts. The way you organize context and tasks determines output quality more than any other variable.

Key Insight: Claude Code's reliability is less about individual prompt quality and more about the structure you build around each session — how you initialize it, constrain it, and hand off between sessions.
---

How should you set up project-level context files for Claude Code?

Treat context as a versioned artifact you maintain, not something you retype each session. Two file types do most of the work.

CLAUDE.md — your project's constitution

Claude Code reads a CLAUDE.md file from your project root automatically at the start of every session. [1] This is your persistent memory layer. A production-ready CLAUDE.md typically includes:

When building Buddy, the AI Google Ads agent, the CLAUDE.md includes a section on Google Ads API conventions — rate limits, entity hierarchy, and which campaign types the agent supports. [2] Without that, Claude routinely suggested approaches that were valid Python but completely wrong for the Ads API context.

Best Practice: Update your CLAUDE.md at the end of every productive session. Capture what changed, what decisions were made, and what's in progress. Treat it like a ship's log — the next session's Claude reads it cold.

Task-scoped context files

For larger work items, keep a /tasks folder with one markdown file per feature. When starting a session, tell Claude: "Read tasks/budget-optimizer.md before we begin." Each task file should contain:

This gives Claude a curated briefing instead of letting it wander through your entire repo to figure out what matters.

---

What is the best way to initialize a Claude Code session?

How you start a session determines the majority of how well it goes. A consistent three-step initialization sequence prevents the most common failure modes.

  1. Orient before you task. Your first message should never be a task. Use an orientation prompt: "Read CLAUDE.md and the files in /tasks. Then tell me what you understand about the current project state and what we're working on today. Don't write any code yet." The final instruction is critical — without it, Claude often starts coding before it's fully oriented, locking in assumptions that become expensive to unwind.
  2. Confirm scope explicitly. After Claude summarizes its understanding, correct any misalignments before they become code. A typical correction: "Close — but we're only touching the reporting module today. Don't refactor the authentication layer even if you see improvements there. Capture those in CLAUDE.md for a future session."
  3. Request a plan before execution. For any task touching more than two or three files, ask: "Before coding, give me a numbered list of every file you plan to create or modify, what change you'll make to each, and in what order. Flag anything you're uncertain about." This takes 60–90 seconds and — in my experience building Buddy — saves an average of 20–30 minutes of review and rollback per complex session.
Common Mistake: Jumping straight to "here's the task, go" without an orientation phase. Claude will make confident assumptions about your codebase structure and conventions — and they're often wrong enough to cause real cleanup work.
---

How do you keep Claude Code on track during long sessions?

Even with solid initialization, long sessions drift as context accumulates and complexity grows. Three practices keep mid-session quality high.

Atomic subtasks with checkpoint commits

Break larger tasks into clearly bounded subtasks and commit after each one:

  1. Give Claude one subtask with a specific, bounded scope
  2. Review the diff when it's done
  3. If acceptable: commit, then move to the next subtask
  4. If problematic: revert to the checkpoint and reframe the instruction

This is especially important in marketing automation codebases where a bad change to a campaign management function could cause real spend issues. Atomic commits create clean rollback points and force focus. The patterns for handling complex Claude Code projects all converge on this same discipline.

The "pause and summarize" interrupt

When a session starts drifting — Claude is asking clarifying questions that suggest it's lost the thread, or outputs are getting increasingly off-spec — stop it: "Stop. Don't write any more code. Summarize what we've done so far this session, what the current state of the task is, and what you think the next step is."

Half the time this surfaces a misalignment you can correct without losing the work. The other half, you realize a fresh session with updated context is more efficient than trying to course-correct in the current one.

Explicit constraints over implied ones

Claude is good at inferring conventions — but it will override its inferences when it thinks a better approach exists. If a constraint truly matters (never use global state, always return typed dicts, don't install new packages without asking), put it in CLAUDE.md and repeat it explicitly at task time. Redundancy is a feature here, not a bug. [3]

Key Insight: Claude Code works best when you treat it like a highly skilled but new team member — one who needs explicit context, clear constraints, and regular check-ins rather than vague mandates and hope.
---

How do you manage Claude Code work that spans multiple files and sessions?

Multi-session, multi-file work is where unstructured workflows break down completely — and where structure pays compounding dividends.

The session handoff document

At the end of every productive session, before closing out, ask Claude to generate a handoff note: "We're wrapping up. Write a brief handoff note I can use to start the next session — what we completed, what's in progress, what decisions we made and why, and what the next steps are. Format it so I can paste it into CLAUDE.md."

Claude produces a clean, structured summary in a couple of minutes. Reviewing and committing it takes another two. This is the single highest-ROI habit in the entire workflow — the continuity it creates across sessions is difficult to replicate any other way.

Dependency and impact mapping

For complex refactors, ask Claude to map dependencies before touching anything: "Before we change the campaign budget calculation function, map out every file that imports it, every test that covers it, and every downstream function that depends on its output format."

In marketing automation work, functions that seem isolated — like a budget cap calculator — routinely touch bid strategies, alert thresholds, and reporting pipelines simultaneously.

Best Practice: Keep a /sessions folder in your repo (gitignored) with dated session notes. After 10–15 sessions on a project, you'll have a searchable log of every architectural decision and why it was made — something most teams don't have even for human-written code.
---

When should you use Claude Code versus Claude chat?

The choice between interfaces should match the nature of the task, not personal preference.

Use case Claude Code Claude chat
Reading & writing actual files ✓ ✗
Running terminal commands ✓ ✗
Multi-step implementation ✓ ✗
Architecture discussion / design ✗ ✓
Code review of pasted snippets ✗ ✓
Generating specs before execution ✗ ✓
Debugging logic conversationally ✗ ✓

Running a Claude chat session in parallel with a Claude Code session works well: chat handles thinking through approach, Code handles execution. For teams adopting Claude Code at scale, this separation of concerns also makes it easier to review and approve architectural decisions before they're baked into code.

Common Mistake: Using Claude Code for open-ended architectural exploration. When you haven't decided what you want to build yet, Claude Code will start building something — and now you have opinions baked into code that's hard to walk back. Do your architectural thinking in chat first.

Claude Code's agentic capabilities — including tool use and multi-step task execution — are designed for implementation work, not discovery. [1] Use it accordingly.

---

What to do next

  1. Create your CLAUDE.md today. Even a rough version with your stack, a few style rules, and current project status will immediately improve session quality. Spend 20 minutes on it now — you'll recoup that in your next session.
  2. Add the orient-before-task step to your next session. Start with a read-and-summarize prompt before any implementation work. Notice how different the session feels when Claude has actually processed your context.
  3. Set up atomic commit checkpoints. Break your next multi-step task into three to five subtasks, commit after each one, and see how much easier it becomes to catch and correct drift early.
  4. End your next session with a handoff note. Ask Claude to write it, clean it up if needed, and paste it into your CLAUDE.md or task file. Do this three times and it becomes automatic.
  5. Build a /tasks folder for active work items. Move any feature you're actively working on into a dedicated markdown file with spec, acceptance criteria, and progress notes — stop carrying that context in your head or re-typing it each session.
---

Frequently asked questions

Does Claude Code automatically read CLAUDE.md, or do I have to reference it manually?

Claude Code reads CLAUDE.md from your project root automatically at the start of each session — you don't have to reference it in your first message. [1] That said, the orient-before-task prompt ("read CLAUDE.md and tell me what you understand") is still valuable because it confirms Claude has actually processed the file and gives you a chance to catch misalignments before work starts.

How long should a CLAUDE.md file be?

Long enough to cover what Claude genuinely needs, short enough that it stays maintained. In practice, 300–600 words covers most projects — stack decisions, style rules, off-limits areas, and current status. Files that grow beyond ~1,000 words tend to get stale because they're too cumbersome to update regularly. If you need more detail, move it into task-specific files in a /tasks folder and reference them at session start.

What should I do when Claude ignores a constraint I put in CLAUDE.md?

Repeat the constraint explicitly in your task-level instruction — don't rely on CLAUDE.md alone for anything that truly matters. Claude is good at inferring conventions but will override them when it believes a better approach exists. Putting critical constraints in both CLAUDE.md and in the specific task prompt makes them much harder to drift past. [3]

Is the session handoff note approach worth it for short projects?

For single-session tasks or very small scripts, probably not — the overhead isn't justified. The handoff note pays off when a project spans more than two or three sessions, has multiple contributors (including future you), or involves architectural decisions you'll need to explain later. Once you've built the habit on larger projects, you'll likely start doing it even for medium-sized ones because the cost is so low (Claude writes the note; you review it).

Can this workflow apply to non-Python codebases?

Yes — the workflow is language-agnostic. The CLAUDE.md structure, orientation sequence, atomic commits, and handoff notes apply equally to JavaScript, TypeScript, Go, or any other stack. The only layer that changes is the tooling column: swap Ruff for ESLint or your linter of choice, and adjust the testing framework references in your context files accordingly.

How does this workflow change when building integrations with external APIs like Google Ads?

Add API documentation excerpts directly to CLAUDE.md — don't assume Claude knows the current state of the Google Ads API or any other platform. [2] Include relevant endpoint docs, rate limit tables, and entity hierarchy notes. For any code touching live data, also add a "blast radius" check to your session initialization: ask Claude to identify the worst-case outcome of a bug before writing a single line of implementation code.

References

  1. Anthropic. “Claude Code overview.” Accessed Nov 1, 2026.
  2. Google for Developers. “Introduction to the Google Ads API.” Accessed Nov 1, 2026.
  3. Wikipedia. “Prompt engineering.” Accessed Nov 1, 2026.
  4. Original community discussion: r/ClaudeAI thread on Reddit.

Related Reading

AI Disclosure: This article was generated with AI assistance based on a community discussion on Reddit r/ClaudeAI. Expert analysis and practitioner perspective by John Williams, Founder, AHMEEGO · Google Ads Practitioner with $350M+ in managed Google Ads spend. AI was used to draft and structure the content; all strategic recommendations reflect real campaign experience.