Best Practice for AI Coding: Prompt Agents to Follow Existing Codebase Patterns

tristanbob · x · 2026-08-02

A developer shared a key best practice when using agentic coding tools on existing projects: always instruct the AI to look for and understand existing codebase patterns related to the task.

The author points out that while there are multiple "right" ways to implement a feature, the chosen approach should be consistent with how the project currently operates. This helps ensure the Pull Request (PR) is accepted and maintains the project's overall consistency.

However, an exception applies: if the project currently uses a bad pattern, developers should avoid blindly following it. Instead, it might be the right time to help the project refactor and improve alongside adding the new feature.

Original post →

More from coding & agent

coding & agent channel →