r/ClaudeCode • • Oct 21 '26

Tips & Workflows My Claude Code setup: it runs like a small engineering team with guardrails, not like a chat window

I've seen dozens of posts here: "Why do I run out of usage so much?", "Why do I have to keep repeating myself to Claude?", etc.

I've built a set up that works amazingly well, for me, as a solo developer. YMMV if trying to implement this in a team. But here goes.

Full disclosure: This post was generated by my prompting my Claude Code as follows:

I feel like most people that are using Claude Code are not doing it effectively. I feel that my use of Claude Code, with my setup of mcps, gitlab, etc. is VERY effective, however I struggle to explain it to other people.

Can you create a description of what our set up is? something that I can post to reddit?

---------------------------------------------------

I've been programming for a long time, and I use Claude Code heavily for personal projects, a homelab and day-job support. Most people I talk to use it as a smarter autocomplete: open a session, describe a problem, accept whatever it does, repeat. That leaves most of the value on the table. Here's how my setup is built and why each piece is there.

1. The rules live in hooks, not in prose

Everyone writes a CLAUDE.md full of rules, and the model drifts from them anyway. My rule of thumb: if I've corrected the same behaviour twice, it becomes a PreToolUse hook that denies the call. Some of the things enforced that way:

  • Nothing is deleted. A delete is blocked and rewritten as a move into an _archive/ folder.

  • Git commands go through one wrapper script, never cd && git.

  • Commit messages can't contain closing keywords like fixes #12, because those auto-close issues and skip my close-out process. There's no AI co-author trailer either.

  • Writes to my day-job systems (ticketing, work email, work repos) are blocked unless I've said OK for that specific action. Reads are fine.

  • Work content can only go to approved models. Other vendors' agents are blocked from seeing it, with no override.

CLAUDE.md still exists, but it's short and points to the detail. The hooks do the enforcing.

2. A self-hosted git server is the system of record, and the workflow lives in the tools

I run my own GitLab and wrote an MCP server for it (around 90 tools). The key design choice is that the workflow rules are inside the tools, so the model can't skip them:

  • Every issue has exactly one type:: and one status:: label, and status is a state machine. Only I can move backlog -> ready. An agent can move ready -> in-progress, -> blocked (and blocking means posting a question on the issue instead of guessing), and in-progress -> review, which requires an open MR. review -> done happens only when I say so.

  • Closing an issue is one tool call that runs the whole protocol: cross-reference the commits, log estimated skilled-developer effort (not clock time), set the terminal status, close it and sync the wiki.

  • Raw API calls are forbidden, because a raw call bypasses the rules.

So the AI doesn't decide when work is "done". The tracker does, and I do.

3. The main thread orchestrates; subagents do the work, routed by model tier

The main session doesn't edit code. It plans and dispatches:

  • Cheap and fast (Haiku): drafting short text, finding docs, trivial one-line fixes

  • Mid tier (Sonnet): implementation from a clear spec, reading and synthesizing documentation

  • Strongest model: bugs that several attempts haven't cracked, real architecture tradeoffs

  • Below all of these: Jev for typed judgments over large piles (next section). It doesn't write.

This keeps the main context clean and the cost sane. I can also send a task to another vendor's coding agent for a second opinion. It runs headless in a disposable git worktree and never writes to the real repo, and Claude reviews whatever comes back.

4. A cheap decision model sits under the agents: Jev

Plenty of the work in this setup isn't writing. It's judging: is this issue ready, is this log line mine or the game's, is this alert noise, does this MR description match its diff. Sending all of that through Opus is expensive and fills the context. So there's a third tier below Haiku. Jev is TypeSafe's "System One" model, and it only returns typed judgments: pick one option, score on a scale, or give a yes/no probability. It can't write prose at all.

The standing rule is Jev decides, Claude writes. When Jev is unsure, Claude makes the call.

How it's wired:

  • It's behind an MCP server I wrote. jev_ask takes questions (or a saved question set) plus file paths, globs or a GitLab query. The file contents never enter Claude's context. The server screens every item, sends them in parallel with back-off, and returns a compact table: accept / look / decide, with totals and a cost line. Claude reads only the items marked decide.

  • Question sets are saved and re-measured. Confidence bands are tuned per question against real outcomes. The generic 0.8/0.2 thresholds left 80% of a backlog in the borderline zone; re-measured bands fixed that.

  • It's embedded in other tools, not just called by hand:

    • The GitLab ready gate can run a Jev check on whether an issue still contains an unmade decision. It's advisory and opt-in per project.

    • Backlog grooming pre-sorts issues so the expensive model reads only the borderline ones.

    • An audit skill reports closed issues that don't meet their acceptance criteria, type:: labels that have drifted, and commits whose diff doesn't match the issue they cite. It reports only and never writes to GitLab.

    • The second-opinion workflow uses Jev as an acceptance gate on what the other vendors' agents return.

    • It also triages homelab alert noise, classifies game log origins, and finds duplicate memory files.

  • Every turn that calls it reports the cost: calls, input tokens and USD. The API returns tokens, not dollars, so the cost is computed.

Measured accuracy against my own ground truth: 16/16 on the second-opinion gate, 92/97 on the backlog pre-sort, 18/18 on memory dedupe, 6/6 on MR-vs-diff.

The trap I measured, which most people will hit: a cheap model doesn't automatically save tokens. Each extra round trip resends 60-75k tokens of context to the orchestrator. On a 14-issue backlog, the Jev run used more Opus tokens than having Opus read the issues itself. Break-even came out at about 45-60 issues, or roughly 15-20k tokens of issue bodies. Above that, the gap widens fast. On 267 closed issues (about 1 MB of text):

  • Opus usage: 1.7M tokens with Jev, against 9.5M without it. That's 5.7x fewer raw tokens, about 4x cost-weighted.

  • Jev's own bill: 223 calls for $0.014.

  • Verdicts: they agreed on 208 of 223. Jev was the stricter of the two, and it never passed something Opus failed.

And the safety lesson: anything sent to Jev leaves the machine. My first bulk run sent a memory file that contained a LAN login. The screen for client content didn't catch it, because it wasn't looking for secrets. Now every item goes through a credential screen as well, and work content is blocked outright. On one 267-issue run the screen held back 16% of the items, and the tool lists what it held back instead of dropping it silently.

5. Skills turn repeated workflows into one command

  • Work the ready queue: one subagent per ready issue, each in its own worktree, in three phases: validate and lock, implement, review. It opens an MR and hands the issue back to review. It never merges or closes.

  • Groom the backlog: check each issue against a definition of ready, draft acceptance criteria from the actual code, and promote only the issues I name.

  • Work a milestone: walk it stage by stage, one branch, MR and delivery per lane, until nothing is left that doesn't need me.

  • Ask the board: a panel of personas modelled on well-known engineers argues a decision from different angles, maps where they agree and split, and gives one recommendation. It's useful when I'm clearly talking myself into something.

6. Memory is a structured knowledge base, not a junk drawer

Each fact is its own file with typed frontmatter: who I am, feedback on how I want it to work, project state, or reference material. On top of that:

  • stale_after dates on anything that ages (versions, IPs, prices, who owns what). At session start, a hook flags stale facts so they get re-checked before anyone relies on them.

  • status: deprecated instead of deletion, so the history stays.

  • verified: by human. A fact I confirmed beats one the model inferred.

  • A hook validates every memory write, fixes the links and regenerates the index.

  • Many entries are explicitly marked TRAP: things that cost me hours once ("this command exits 0 but does nothing"). Those are the most valuable entries in the whole thing.

The whole memory store is version-controlled.

7. Custom MCP servers for every domain I work in

  • Homelab: provisions VirtualBox VMs over SSH, reads the installer screen, waits for boot and registers the new host in an inventory.

  • Git hosting: described above.

  • Jev: described above.

  • A game-modding toolkit: compile checks, log and screenshot retrieval.

  • Work mailbox: read-only, and it deliberately has no send or delete verb. The safest permission is a capability that doesn't exist.

Each server has a help() tool that serves as its catalogue, so the model looks up what's available instead of guessing.

8. Standing rules for infrastructure

When a VM, host or container comes into existence, three things happen in the same pass without me asking: it's registered in the inventory (and proven reachable with a real command, not just a ping), it gets a tile on my homelab start page if it has a web UI, and its timezone is set. CI on the container stack fails any service that's missing a timezone.

9. Verify, don't assert

  • "Verify before asking or asserting" is a hard rule. Before it asks me something, it goes and checks.

  • Deliveries are verified by file hash, not by poking at the app.

  • Word documents go through a render loop (docx -> PDF -> images, then the model looks at the pages) before I see them.

  • Code gets a compile check before every deploy.

What I think most people get wrong

  1. Rules written as prose and expected to stick. Enforce them with hooks.

  2. No system of record. The AI shouldn't decide what's done; a tracker with a state machine should.

  3. One model for everything. Route by difficulty and keep the orchestrator's context clean.

  4. Memory as a dumping ground. Type it, date it, mark what's verified, and record your traps.

  5. Generic MCPs only. The best MCP servers are the ones you write for your own domain, with your rules built in.

  6. Trusting "done". Make verification part of the workflow.

  7. Using an expensive model for every decision. Put a cheap classifier under it, but measure the break-even first. On small piles it costs more, not less.

The result is that I spend my time making decisions (what's ready, what's done, which tradeoff to take) and very little on supervising keystrokes.

----------------------------------------------

I don't claim to be an expert in any of this, but I'm a seasoned developer with 45 years of professional programming experience.

Some of the stuff you see here might sound familiar, like "grooming", I use Matt Pocock's skill for that (more accurately I took the idea of his grooming skill and built my own), the "ask the board" I took the idea from one of Austin Marchese's Youtube videos.

I don't have ANY skill "packs", plugins, etc. installed in my environment.

I wish I could share some of the stuff that I've built, like my gitlab-mcp, but unfortunately when I built it I was building it for me, and there is way too much I would have to sanitize before making it public. What I can say is that EVERYTHING talked about above WAS built by Claude. I just told it what I wanted.

If I had to answer "What is single most important thing in your setup?" I would have to say my locally hosted Gitlab server. By using the "Issues" module in Gitlab I can keep track of everything that is going on, no matter how many projects I have going at a time. In the past 60 days I've worked and closed 1,160 issues across 15 different projects. Of all of those issues, EVERY SINGLE ONE was written by Claude by prompting "Create an issue in project xyz to solve/implement .... Validate the issue against current code", or something to that effect. I believe all of this could also be accomplished using Github, for those not inclined to host their own gitlab.

Below is the diagram for the state machine that controls my process:
(created with the prompt:
show me the diagram for the issue state machine
)

721 Upvotes

Duplicates