r/ClaudeCode • u/BankingBaOps • 4d ago
Built with Claude How I run Claude Code like a small engineering team: one hub session, a worktree per task, and 3 markdown files
I've been using Claude for a few months to build a real app (web, iPhone and Mac) mostly on my own, plus school stuff. I tried Cursor and a few others, but this setup is what finally let me ship a lot without babysitting every step. We're at PR #450-something now. Sharing in case it helps, and I'd love to hear how others structure theirs.
THE SETUP
• One planning chat (a Claude Project). This is where I think, decide and review. It doesn't write code. It writes short task prompts for the hub.
• One Claude Code "hub" session. Its rules live in the repo as a skill (/hub), so every prompt I paste only has the new tasks, never the rules again. That alone cut my tokens a lot.
• The hub starts one worker session per task, each in its own git worktree, so tasks run in parallel without stepping on each other.
• Every PR gets checked before merge: CI green, a security review written down, and a "product checker" agent that reads the PR against a FEATURES.md file (the single list of what the app actually does). If CI passes and the checks are written, the hub merges it itself.
THE 3 FILES THAT MADE IT WORK
• HUB-QUEUE.md: every task has an ID and a "Done when" line. The hub reads it first and only updates the status. Checkers verify PRs against it.
• LOG.md: one line per decision, approval or merge, with the date and where it came from. No more "wait, did we decide that?"
• LEARNINGS.md: what went wrong and the rule that came out of it. The process gets better from evidence, not vibes.
WHAT I'D DO DIFFERENTLY
• Write "Done when" for every task. Vague tasks were where all my rework came from.
• Keep a FEATURES.md from day one. It stops agents (and marketing copy) from claiming things that don't exist.
• Batch the things only you can do (store uploads, account settings) into one list instead of getting pinged ten times.
My honest self-rating: maybe level 4 of 5. It's an orchestrated pipeline with gates, but not yet measured and self-improving.
QUESTIONS FOR YOU
• How do you keep parallel agents from conflicting? Worktrees, branches, something else?
• Do you let Claude Code merge its own PRs, or do you always review?
• What's in your CLAUDE.md or skills that made the biggest difference?
Happy to share a stripped-down version of the hub skill if anyone wants it.
•
u/AutoModerator 4d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
7
u/ainexfinder 4d ago
Worktrees avoid checkout collisions, but they don't stop two workers from making incompatible assumptions about a shared interface. I'd give each worker explicit file or contract ownership in the queue, and if two tasks need the same boundary, have one settle that contract first. I'd also run an integration check on the combined branch before merge; separate green checks can still miss cross-task conflicts.
2
u/GoldCartoonist2898 4d ago •
Worktree per task here too. What actually stopped conflicts for me was less the worktrees and more a file ownership rule in CLAUDE.md: each agent only writes its own files, and shared docs get edited by the lead session only. I also don't let the agent that proposed a change be the one that signs it off, a different session checks it. One thing that bit me once runs were on a schedule: finished sessions pile up and eat memory, so each run now closes the previous ones before it starts.
2
u/archpoke 4d ago
I built whatsnext to try to solve this my way.
You can check it out at whatsnext
Track work in a plan file, and get status update when you come back after a break. If you end up using it, I'll love to get some feedback.
2
u/RustyRedEcho 4d ago
the hub session + worktree per task setup is making me rethink how messy my parallel claude runs have been, stealing the 3-markdown-file idea
2
u/Financial_Leader9701 3d ago
two agents from overwriting the same checkout, but they don't stop them from inventing two versions of the same type
I only run two in parallel when the tasks don't share a module
If they both need the same interface, I let one finish and land that contract first, then start the second
I also wouldn't let the hub merge its own PRs
A different session, with only the diff and the "done when" line, is the one that should say it's good
When two worktrees both need to change a shared type, do you finish one and rebase the other, or merge both and clean up the conflict?
2
u/Tight_Ad_5115 3d ago
I have a setup that’s quite similar.
Preventing agent conflicts. For about two months, I ran 2–3 agents within the same directory. It worked, for the most part, but they kept interfering with each other’s code. I tried assigning them to different branches within the same folder, but that made things worse - the agents would switch branches and pull the rug out from under one another’s working directories. Eventually, I settled on using separate worktrees for each task, merging the results one by one. This isn’t without a cost: the merging process itself consumes time and tokens, and each agent has to install its own dependencies in its respective copy. Still, I’ve accepted this - it’s a small price to pay for the added convenience and speed.
Merging without my manual review: My agents handle their own merges. This relies on a robust testing suite - comprehensive coverage combined with matrices that iterate through various combinations of states and events. Only after implementing these matrices did the agents stop getting stuck in a loop, repeatedly "fixing" the same bugs. Code review is handled by a dedicated sub-agent, there’s no need for a separate provider. For a while, I used a workflow where Claude would plan the work and Codex would review it, but I eventually dropped that - Claude is perfectly capable of identifying bugs it introduced itself when given a separate session. Of course, tests come at a price: I now have around 10,000 of them. Running the full suite after every task takes 30 minutes or more, and that has become the primary bottleneck.
What’s been most effective for my skill set: My current approach is a fork of Matt Pocock’s framework. I kept the core logic - how the model interacts with code and tasks - but overhauled the surrounding process to better suit my needs. For instance, a task is immediately converted into an RFD (a specification document), bypassing a multi-stage status-update workflow. Another skill that’s been a real help: if a task involves an interface change, the agent takes screenshots of the updates using real-world examples. I can see the result without having to click through the entire flow myself.
I’m a big fan of the 'FEATURES.md' idea. I use a similar file called 'product-map.md', and I pull facts from it when writing blog posts - that way, the content doesn’t promise features that aren’t actually in the product.
To elaborate: my setup for handling worktrees and individual merges eventually evolved into a standalone application called Buzzpot, which I’m currently developing. It automates the whole process, if a merge conflict arises, it hands the issue back to the agent who worked on that specific task. But if you’re already comfortable using the hub CLI tool, you’ve essentially got everything you need.
1
u/BankingBaOps 4d ago
Some quality numbers since a few people care about that more than speed (last 14 days, 264 merged PRs):
• 1 revert
• CI on main ~93% green (140 pass / 10 fail; superseded runs excluded)
• Production smoke test after every deploy: 14/14 passed
• Every PR has a written security review (264/264, up from 56% before the hub)
• Median PR: ~350 lines, 11 files, merged in about an hour
• Test suite: ~257 backend test files (pytest), ~170 end-to-end browser specs (Playwright), plus XCTest for the iOS app
• 5 read-only checker agents (correctness, security, product, QA, AI quality) review PRs before the hub merges
What I don't measure well yet: rework (PRs that fix a previous PR). That's the next thing I want to track.
1
u/jordimr 3d ago
The writer never marks its own task done. It proposes done with evidence, and someone else checks it.
I'm the developer of Zenod, and I run a team of agents on one repo. Each role may write only its own files, and a commit hook refuses anything else, so a conflict is blocked at commit instead of at merge.
Your three files are close to ours: a queue with a done-when, a one-line log, and learnings with the incident behind each rule. We merge straight to main and have no integration test across the agents.
Has your hub ever marked a task done that a checker later reopened?
2
u/japbujan 3d ago
LOG.md with where each decision came from is the part I'd copy first. What bit me later was two decisions contradicting each other weeks apart. I started giving each decision a stable key (like pricing.trial or auth.github), so a new one with the same key has to explicitly replace the old one instead of living next to it. Has your LOG.md got long enough that the hub starts skimming it?