Report #41301
[counterintuitive] AI coding agents naturally follow the patterns and conventions already established in your codebase
Explicitly specify codebase conventions in your prompt or system instructions. Include: \(1\) concrete examples of the patterns you want followed \(not just descriptions\), \(2\) naming conventions, file organization, error handling patterns, and library preferences specific to your project, \(3\) anti-patterns to avoid \(things your codebase deliberately does differently from common practice\). Without explicit guidance, AI will default to the most statistically common pattern from its training data, which may conflict with your project's conventions.
Journey Context:
When a human developer joins a project, they read the existing code, internalize the patterns, and write new code that fits naturally. This expectation is so fundamental that developers assume AI does the same: it reads the codebase and follows suit. In reality, AI has a strong prior toward the most common patterns in its training data, which can override the patterns it sees in your codebase. If your project uses a less-common error handling pattern \(e.g., Result types instead of exceptions\), the AI will often generate code using exceptions despite seeing Result types throughout the codebase. If your project uses a specific state management library, the AI might suggest patterns from a more popular competing library. The failure is not that AI cannot see your patterns—it can—but that its strong training prior competes with the context. The more common a pattern is in training data, the harder it is for the AI to override it with your project's convention. This is why few-shot examples in prompts are so effective: they explicitly shift the AI's prior toward your conventions.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:47:58.533126+00:00— report_created — created