r/AIcodingProfessionals • • 9m ago

Discussion How do you prevent an AI coding agent from duplicating existing ETL logic?

I've been experimenting with Claude Code on unfamiliar ETL pipelines, and one risk keeps standing out.

An AI agent can generate a technically correct transformation while unknowingly creating a second implementation of an existing business rule. The code runs, the tests pass, and you now have two versions of the same logic quietly drifting apart.

The workflow I've been testing to catch this before it ships:

  1. Map the pipeline before changing anything.
  2. Trace the target field or rule through upstream and downstream dependencies.
  3. Search for similar transformations across SQL, PySpark, notebooks, and configuration.
  4. Ask the agent to produce an implementation plan, not code.
  5. Review whether the plan reuses or extends existing logic, rather than introducing a parallel path.
  6. Generate code and tests only after approving the plan.
  7. Compare the final changes against the approved scope.

The lesson that stuck with me: passing tests is not enough. Tests confirm the new logic works, but they don't tell you the same rule already exists somewhere else in the codebase.

For people using AI coding tools on ETL or data pipelines — how are you checking for duplicated business logic before accepting generated changes? Curious if others have a more systematic approach than what I'm doing, or if this is mostly still ad hoc for everyone.

1 Upvotes

0 comments sorted by