Pair Programming with Claude Code in a Large Monorepo
A useful pairing session starts with a bounded engineering problem. For this walkthrough, imagine a monorepo containing a checkout application, a shared pricing package, and a billing service. Your task is to fix a discount that disappears when a customer changes quantity. You will direct the investigation, challenge assumptions, and review each change while Claude Code handles focused searches, edits, and verification.
1. Define the behavior before opening the investigation
Write a task brief with a reproducible input, the observed result, and the expected result. Anthropic recommends giving Claude concrete ways to verify its work. ([anthropic.com](https://www.anthropic.com/engineering/claude-code-best-practices?trk=feed_main-feed-card_feed-article-content&utm_source=openai))
For example: “A customer applies a valid discount, then increases quantity from one to two. The discount disappears. Preserve the discount when eligibility still holds, and recalculate the total. Identify the relevant implementation and tests before editing.” Add explicit boundaries: preserve public API shapes, avoid dependency updates, and explain any proposed change outside checkout and pricing.
2. Establish the repository rules
Review the repository instructions before starting implementation. Keep CLAUDE.md focused on useful commands, architecture pointers, and conventions that are difficult to infer from code. ([claude.com](https://claude.com/resources/articles/steering-claude-code-skills-hooks-rules-subagents-and-more?trk=article-ssr-frontend-pulse_little-text-block&utm_source=openai))
Ask Claude to identify the package manager, the checkout test command, the shared pricing test command, and any generated files. Compare its answers with package manifests and existing automation. If the repository has several instruction files, ask which ones apply to the target paths. Resolve contradictory guidance before it becomes a patch that follows the wrong team's conventions.
3. Trace one execution path
Ask Claude to explore the relevant code and propose an approach before implementing it. This follows Anthropic's recommended separation between investigation, planning, and coding. ([anthropic.com](https://www.anthropic.com/engineering/claude-code-best-practices?trk=feed_main-feed-card_feed-article-content&utm_source=openai))
Use a narrow prompt: “Trace quantity changes from the checkout event handler through pricing recalculation. List the files and symbols involved, and explain where discount state is preserved or discarded.” Request a short path with evidence from each boundary. Inspect the actual call sites together. A similarly named function in another application should not become evidence for this checkout flow.
4. Turn the hypothesis into a regression test
Use a failing test to make the intended behavior concrete before asking for the implementation fix. Anthropic describes this test-first workflow for Claude Code. ([anthropic.com](https://www.anthropic.com/engineering/claude-code-best-practices?trk=feed_main-feed-card_feed-article-content&utm_source=openai))
Ask for a test that applies a valid discount, changes quantity, and checks both discount retention and the recalculated total. Have Claude run it and explain the failure. A missing fixture or broken import does not establish the bug. Add a second case where the quantity change makes the discount ineligible, so the fix cannot succeed by retaining every discount unconditionally.
5. Implement a patch you can explain
Now authorize the smallest coherent change that addresses the demonstrated failure. Ask Claude to explain why the correction belongs at that layer. If pricing owns eligibility, challenge a proposed checkout workaround that duplicates eligibility rules.
Review the diff immediately. Check whether the implementation mutates shared objects, changes rounding, alters exported types, or updates generated artifacts. Ask about every unexpected file. If the investigation reveals that billing uses the same recalculation function, expand the verification scope deliberately and record why that consumer matters.
6. Verify the changed boundary and its consumers
Have Claude run the regression test, the pricing package suite, and the relevant checkout checks using the repository's established commands. Then inspect the results yourself. Require the handoff to distinguish completed checks, failures, and checks that could not run.
Use the dependency graph to select additional consumer checks. If billing imports the changed pricing function, exercise its affected behavior. If a broader integration suite requires unavailable credentials, record that limitation and the command needed to finish verification. Keep unrelated baseline failures separate from failures introduced by the patch.
7. Finish with a reviewable handoff
Review and refine the patch throughout the session; Anthropic treats iteration as part of effective collaboration with Claude Code. ([anthropic.com](https://www.anthropic.com/engineering/claude-code-best-practices?trk=feed_main-feed-card_feed-article-content&utm_source=openai))
Ask for a final explanation covering the root cause, changed behavior, regression coverage, and remaining uncertainty. Read it against the diff. For teams using CodeRelay Hub, its pay-as-you-go API endpoint can support the surrounding tool workflow; keep repository instructions and verification expectations consistent across sessions.
Open a free workspace to try it.