Best Practices for AI Coding Assistants

Chapter 2 · Practice 4 of 4

State constraints the assistant would otherwise guess at

From Writing task prompts

Why it matters

Assistants fill gaps with reasonable defaults, and reasonable defaults are often not your project's choices. Say up front:

  • libraries: "use only libraries already in package.json";
  • scope: "change only files under src/billing";
  • compatibility: "keep the public function signatures unchanged";
  • style of solution: "keep it minimal; no new abstractions".

Anthropic's prompting guide notes that some models tend to overengineer, adding extra files, abstractions or flexibility nobody asked for, and suggests explicit guidance to keep solutions minimal.

A one-line constraint costs nothing and saves a review round.

Avoid

  • Letting the assistant add a new dependency without asking