Ask HN: How do you keep AI coding agents aligned with your codebase standards?
1 comments
Two things that help:
Scope instructions to file patterns (services/* → "use ServiceFoo, no raw queries"). The agent only loads rules relevant to the code it's touching, and a small scoped file is easier to notice is wrong than line 47 of a monolithic doc.
Add a post-edit agent hook that asks the agent "does this change mean the scoped instructions need updating?" — turns maintenance from a chore someone forgets into part of the edit loop. Haven't battle-tested this at scale yet but the mechanism is there in Claude Code and Copilot.
For bootstrapping the initial instructions, check out microsoft/agentrc — it can generate and evaluate scoped instruction files so you're not writing them from scratch.
Scope instructions to file patterns (services/* → "use ServiceFoo, no raw queries"). The agent only loads rules relevant to the code it's touching, and a small scoped file is easier to notice is wrong than line 47 of a monolithic doc.
Add a post-edit agent hook that asks the agent "does this change mean the scoped instructions need updating?" — turns maintenance from a chore someone forgets into part of the edit loop. Haven't battle-tested this at scale yet but the mechanism is there in Claude Code and Copilot.
For bootstrapping the initial instructions, check out microsoft/agentrc — it can generate and evaluate scoped instruction files so you're not writing them from scratch.
Each fix is small, but across a team of 8 engineers, it adds up, making the codebase drift over time.
We've tried shared CLAUDE.md and multiple markdown doc files but they go stale fast and don't scale well.
How is everyone else handling this? Has anyone found something that actually works at scale?