LESSON 5

Claude Code: The Coding Agent That Ships Product

Claude Code is not autocomplete. It reads your entire codebase, writes tests, runs them, iterates until green, and opens the PR — without hand-holding. Here is how to harness it.

9 min read·Automation

GitHub Copilot finishes your sentences.

Claude Code ships your features.

That is not a marketing distinction. It is a fundamental difference in architecture, capability, and how you should think about the work.

DOCTRINE

Autocomplete is a faster keyboard. Claude Code is an autonomous engineer that understands your codebase, writes tests, runs them, reads the failures, and iterates until the implementation is solid.

The unit of work is not a line. It is a feature branch with passing CI.

Claude Code Workflow

What Makes It Different: The Tool Loop

Most people think Claude Code is a smarter chat for code questions. It is not.

Claude Code is an agent with tools. Real tools. Tools it can invoke without asking permission:

  • Read — reads any file in your codebase, knows your architecture
  • Write / Edit — creates new files, modifies existing ones with surgical precision
  • Bash — runs commands: npm test, pytest, git diff, anything
  • Glob / Grep — searches patterns across your entire repo in seconds
  • WebFetch — reads docs, API references, GitHub issues inline

The loop this enables is completely different from autocomplete:

  1. Read context — CLAUDE.md, existing code, failing tests, error logs
  2. Plan — reason about the approach before writing a line
  3. Write — implement across multiple files simultaneously
  4. Test — actually run the test suite, not just generate test code
  5. Iterate — read the failures, fix them, run again
  6. Branch and PR — commit to a feature branch, open a PR with description

That loop runs autonomously. You describe the outcome. Claude Code handles the implementation cycle.

CLAUDE.md: The Agent's Constitution

This is the most underrated lever in the entire system.

CLAUDE.md is a markdown file at the root of your project. Claude Code reads it at the start of every session. Whatever you put in it becomes standing instruction that persists across every invocation.

In the jeremyknox.ai repo, CLAUDE.md encodes:

  • Stack: Next.js 14, App Router, static export, Tailwind, MDX
  • Brand tokens: exact hex values for colors, component names
  • Post frontmatter schema: every required field, every allowed value
  • Content pipeline rules: how blog-autopilot works, what not to edit manually
  • Git workflow: always feature branch, never commit to main, PR via gh pr create
  • Deployment: Cloudflare Pages auto-deploys on merge to main

Every project-specific convention that I would otherwise have to re-explain in every session is in that file. Claude Code reads it, internalizes it, and operates accordingly.

INSIGHT

Think of CLAUDE.md as the onboarding document you would give a new senior engineer on day one. Every project convention, every guard rail, every "don't do this" that experience taught you — written once, enforced automatically across every session.

The ROI compounds as the project grows.

The PR Workflow: Non-Negotiable

The single most important discipline I enforce through CLAUDE.md is branch hygiene.

Never commit directly to main.

This is not a preference. It is infrastructure-level protection. Here is why it matters more with AI agents than with human engineers:

An AI agent moves fast. Very fast. It can write, test, and commit a hundred changes before a human would finish planning. If that agent is committing directly to main, every mistake goes live immediately. There is no review gate. There is no rollback conversation. There is just damage.

The workflow is non-negotiable:

# Claude Code always does this
git checkout -b feature/implement-thing
# ... implement, test, iterate ...
git commit -m "feat: implement thing with tests"
gh pr create --title "..." --body "..."

Main stays clean. Every change is reviewable. CI runs on the PR. Gemini and CodeRabbit auto-review. You merge when you are satisfied.

WARNING

The moment you give an AI agent direct write access to main, you have removed the review layer. That is not velocity. That is instability. Hard-won rule: feature branch is mandatory, no exceptions.

Hard-Won Lessons Baked Into the System

The E2E Validation mandate came from real failures. There were sessions where Claude Code wrote a feature, opened a PR, and I merged it — without running the actual production code path. The feature was "done." The feature was not working.

Now the rule is explicit in CLAUDE.md: deliver, validate end-to-end, do a retro, fix, repeat. "I opened the PR" is not done. "The PR passed CI, I validated in dev, and the code path works" is done.

The 90% coverage floor came from the same place. Test coverage is not bureaucracy. It is the feedback loop that catches the 11pm bug before it becomes a 2am incident.

The stop-and-replan rule is newer but just as important. If an approach fails twice, do not push harder. Stop, reassess, communicate the pivot, try a different angle. Forward-pushing past clear signal to stop is how you create bigger problems.

Test Coverage Floor
90%
no PR merges below this
Direct Commits to Main
0
hard rule, no exceptions
Branch Policy
Feature Branch
always, for every change

The Agent vs. The Tool

Here is the mental model that unlocks everything:

A tool executes what you give it. An agent understands what you need, plans an approach, and executes autonomously until the outcome is achieved.

Claude Code operates at the agent level. When I say "implement a search feature for the blog," it reads the existing blog architecture, understands the data model, implements the feature across whatever files it touches, writes tests, runs them, and opens a PR — without me specifying file names, function signatures, or test structure.

That is not autocomplete at scale. That is a different category of leverage.

Lesson 5 Drill

Write a CLAUDE.md for one project you own right now. Force yourself to encode:

  1. Stack — what frameworks, languages, and runtimes are in play
  2. Git rules — branch policy, commit conventions, PR workflow
  3. Architecture constraints — what should NOT be changed without discussion
  4. Quality gates — test coverage, linting rules, build requirements
  5. Do-not-list — the three things a coding agent should never do in this repo

That document is your agent's operating contract. Treat it like code.

Bottom Line

Every engineer will eventually have a coding agent in their toolchain.

The engineers who will get the most out of it are not the ones who write the best prompts.

They are the ones who build the best CLAUDE.md files, enforce the tightest quality gates, and treat the agent as a disciplined team member — not an autocomplete on steroids.

Build the discipline into the system. Let the system enforce it.

Explore the Invictus Labs Ecosystem