AI assistants tend to write fresh code for each task because they only see what is in their context. Fix that by making the shared code visible and by stating your rules.
Create a short project instructions file (many tools read one automatically) saying where shared utilities live, how they are named, and that new logic should reuse them. Point the assistant at the specific shared files in your prompt. Ask it to search the codebase for an existing function before writing a new one. For larger changes, ask for a plan first and check it for reuse. Afterwards, request a review pass that looks only for duplicated logic and proposes moving it into a shared module.