Issue 2: Your Agents Are Learning Bad Habits
Welcome back to The Context Loop — your weekly briefing on Claude, AI workflows, and the automation moves worth making.
This week we're getting into something I've been thinking about since watching AI agents on my own team start creating PRs that don't match how we work. The fix is simpler than you'd think.
🔵 The Dive: Stop Waiting for the PR to Fix the Problem
How Claude Rules in Your Repo Change the Game
Here's a pattern that plays out constantly on teams using AI agents: the agent creates a pull request, you review it, and it's wrong — not broken, just off. Wrong file structure, wrong naming conventions, wrong commit message format. So you ask the agent to split the PR or fix the style, and it does, and then it happens again next week.
You're always correcting after the fact. That's the problem.
The fix is to implement Claude rules in your repo proactively — before the agent ever touches your codebase. This is different from Claude skills (which define what Claude knows how to do). Rules define how Claude should behave specifically in your repo context.
A CLAUDE.md file at the root of your repo acts as a persistent briefing document. Every time an agent opens a session in that repo, it reads this file first. You write it once and stop correcting forever.
What goes in your CLAUDE.md:
PR size preferences — should agents keep PRs under 400 lines? Say so explicitly.
Branch naming conventions —
feature/,fix/,chore/— spell it out.Commit message format — conventional commits, ticket number prefixes, whatever your team uses.
File structure rules — where new components go, how tests should be named, folder conventions.
What NOT to do — if agents keep touching a config file they shouldn't, tell them explicitly.
The key insight here is that most of the friction between AI agents and your codebase isn't a capability problem — it's a context problem. The agent doesn't know your preferences because you never told it. CLAUDE.md is how you tell it once and never repeat yourself again.
This is especially powerful on fast-moving teams where multiple agents or developers are contributing simultaneously. The rules become the shared standard that keeps everything consistent regardless of who — or what — is making the commit.
📡 Surface Level: 3 Things Worth Knowing This Week
Claude's extended thinking is getting faster — the latency gap between standard and extended thinking mode has narrowed significantly. Worth re-evaluating for workflows where you previously ruled it out as too slow.
Multi-agent coordination is the next frontier — teams running more than 3 agents simultaneously are reporting coordination overhead that eats into productivity gains. Expect tooling specifically for this problem to emerge in Q2.
Prompt caching is underused — if you're running repetitive Claude API calls with the same system prompt, you're leaving money on the table. Prompt caching can cut costs by up to 90% on cached tokens. Most teams haven't set it up.
🛠️ The Toolkit: A Starter CLAUDE.md Template
Copy this into the root of your repo and customize it for your team:
# Claude Rules for [Your Repo Name]
## PR Guidelines
- Keep PRs under 400 lines where possible
- One concern per PR — don't mix features and refactors
- Always include a brief description of what changed and why
## Branch Naming
- Features: feature/short-description
- Bug fixes: fix/short-description
- Chores: chore/short-description
## Commit Messages
- Use conventional commits: feat:, fix:, chore:, docs:
- Keep subject line under 72 characters
## File Structure
- New components go in /src/components
- Tests live next to source files with .test.ts suffix
- Never modify /config directly — create a PR for review
## What Not To Do
- Don't add dependencies without noting them in the PR description
- Don't refactor code outside the scope of the current task
Paste this in, update it to match how your team actually works, and your agents will start behaving like they've been on your team for months.
That's Issue 2 of The Context Loop. If you found this useful, forward it to one person on your team who's dealing with messy agent PRs.
— Anel