0xMorty (@0xMortyx) on X

X AI KOLs Tools

Summary

This article outlines a 9-step loop using Claude Code's built-in primitives (plan mode, subagents, hooks, CLAUDE.md, slash commands) to enforce a disciplined, senior-engineer-style development workflow. It emphasizes understanding the codebase, planning, enforcing standards, and deterministic hooks to avoid costly mistakes.

https://t.co/FRtkxODjAf
Original Article
View Cached Full Text

Cached at: 06/15/26, 03:38 PM

The 9-Step Loop That Turns Claude Code Into a Senior Engineer

Most developers use Claude Code like a junior who needs constant supervision. They type a request, watch it edit a file, eyeball the result, type the next request. It works. But it’s not what Claude Code is for.

Follow my Substack to get fresh AI alpha: substack.com/@0xMortyx

A senior engineer doesn’t work that way. They understand the codebase first, make a plan, write the change, test it, review it against the team’s standards, and only then ship. That entire sequence can be built into Claude Code as a repeatable 9-step loop using its actual primitives: plan mode, subagents, hooks, CLAUDE.md, and slash commands.

Set this up once and every task runs through the same disciplined pipeline. Here are the 9 steps.

The difference isn’t the model. It’s the loop around it.

Claude Code ships with the exact primitives a disciplined workflow needs: a planning mode that thinks before touching code, subagents that work in isolated context windows, and hooks that run deterministically every single time. The gap between a junior-tier and a senior-tier setup is just whether you’ve wired these together into a loop.

1. Explore Before Touching Anything

A senior engineer reads the codebase first. So should your agent.

Explore subagent

The junior move is to start editing immediately. The senior move is to understand the codebase first. Claude Code has a built-in Explore subagent that reads your code in read-only mode, in its own context window, without cluttering your main session or risking changes.

Start every non-trivial task by sending Claude to explore the relevant area. It comes back understanding how things actually fit together, instead of guessing.

✓ The agent now understands the code before it writes a single line

2. Make a Plan in Plan Mode

Decide the approach before any code gets written.

Plan mode

Plan mode lets Claude think through the full approach without executing anything. It produces a step-by-step plan you can read, correct, and approve before a single file changes. This is where you catch a bad approach for free, instead of after it’s half-built.

The senior habit: never let it build until you’ve seen the plan and agreed with it.

✓ You approve the approach before any code exists to throw away

3. Put Your Standards in CLAUDE.md

Your conventions, written once, read every session.

CLAUDE.md

CLAUDE.md is the agent’s constitution for your repo. It reads this file every session to anchor your conventions, commands, and patterns. A senior engineer knows the team’s standards by heart, and this is how you give your agent the same baseline.

**Important nuance:**CLAUDE.md instructions are advisory. Claude follows them most of the time, but not with 100% reliability. For rules that absolutely cannot be broken, you need Step 5 (hooks), which are deterministic. CLAUDE.md sets the defaults; hooks enforce the non-negotiables.

✓ Every session starts with your conventions already loaded

4. Build the Change in Small, Reviewable Pieces

Senior engineers ship small. So should the agent.

main session

With the plan approved and standards loaded, the build step is almost boring, which is the point. Instruct the agent to implement the approved plan in small, self-contained pieces rather than one giant diff. Smaller changes are easier to verify and easier to roll back if something’s wrong.

✓ Changes arrive in pieces you can actually review, not one giant dump

5. Enforce the Non-Negotiables With Hooks

The senior move: make the important rules impossible to skip.

hooks

This is the step that separates a real senior setup from a polished junior one. Hooks are shell commands that fire at specific points in Claude Code’s lifecycle, and unlike CLAUDE.md, they run deterministically every single time. “Always run the linter after editing.” “Never let a commit through with failing tests.” These become guarantees, not suggestions.

✓ Your critical rules now run automatically, no exceptions

6. Make It Prove the Change Works

No “looks good to me.” Tests, every time.

tests + hooks

A senior engineer doesn’t trust code that hasn’t been tested, including their own. Instruct the agent to write tests for every change and run them. Combined with the Step 5 hook, the test suite runs automatically, so “it works” means the tests actually passed, not that the diff looked plausible.

✓ “Done” means the tests passed, not that the code looked fine

7. Have a Second Agent Review the First

The senior move: a fresh pair of eyes that didn’t write the code.

review subagent

Code review works because the reviewer didn’t write the code. You can replicate this: spin up a review subagent with a clean context window whose only job is to critique the change. Because it has its own context and a critic’s mandate, it catches things the builder rationalized past.

✓ A clean-context critic catches what the builder talked itself past

8, Fix What the Review Found, Then Re-Check

The loop closes here. Fix, re-test, re-review until clean.

the loop

This is what makes it a loop instead of a line. The review surfaces issues, the agent fixes them, and then the checks and review run again on the fixed version. You don’t move forward until the change comes back clean. This is exactly how a senior engineer handles review comments.

✓ Issues get fixed and re-verified, not just acknowledged

  1. Ship It With a Slash Command

Wrap the whole loop into one reusable command.

slash command

Once the change is clean, ship it: a clear commit, a PR with a real description. The senior touch is to turn this entire 9-step loop into a custom slash command so you never reassemble it by hand. Save the workflow once and trigger the whole pipeline with one command.

✓ The entire loop now runs from one command: /ship

Why This Actually Works

None of these steps are tricks. They’re the same discipline a senior engineer applies on every task, mapped onto the primitives Claude Code already ships with. The model was always capable. What was missing was the loop around it.

  • Exploration means it understands before it edits, like a senior reading the code first

  • Plan mode means bad approaches die before they cost you anything

  • CLAUDE.md plus hooks means your standards are loaded and the critical ones are enforced

  • Tests plus an independent review means “done” is earned, not claimed

  • The slash command means you set this up once and run it forever

**The honest takeaway:**This won’t make Claude Code infallible, nothing does. But the gap between “junior who needs watching” and “senior you can trust with a task” isn’t a better model. It’s whether you’ve built the loop. Build it once and every task runs through it.

Similar Articles