How do you effectively use AI code tools on large, legacy codebases with deep dependencies?

by•

AI code generators work like magic on fresh boilerplates and isolated components, but as soon as I drop them into our 4-year-old monolithic codebase the hallucinations spike. It misses hidden side effects invokes deprecated helper functions and breaks existing context because it can't grasp the full tree.

For devs working on established production systems what context-pruning strategies or tools do you use to keep AI generations accurate and context-aware?

17 views

Add a comment

Replies

Best

more context made it worse for me, not better.. what worked was a check after the edit. i'd put the deprecated helpers in a hook that fails the change when it calls one, a line about them in the rules file kept getting skipped. and one small change per commit so a hidden side effect shows up right away. is the breakage mostly shared state or db calls?

An agent touched legacy analytics and silently stubbed an upstream dependency. The report showed a confident number nobody had actually measured, and it took a day to realize it was a placeholder. When an agent touches deep calculations, verify the live pipeline, not just that the code compiles cleanly.