AI Engineering

How to Write Effective AI Project Instructions

By nimblabs editorial··7 min read
Developer writing structured project instructions for an AI coding agent

Key takeaways

  • Vague instructions produce vague output — be specific and imperative.
  • State constraints and 'never do' rules explicitly; agents won't infer them.
  • Show examples of the conventions you want, not just descriptions.
  • Keep instructions in a persistent file, not re-typed every session.
  • Update them as the project changes — stale rules cause confident mistakes.

Why instructions matter

An AI coding agent does exactly what its context tells it — no more. Good project instructions are how you steer it toward your conventions and away from the patterns you've rejected.

The difference between a useful agent and a frustrating one is usually the quality of its instructions, not the model.

Be specific and imperative

Write directives, not vibes. 'Use the existing API client in lib/http for all requests' beats 'follow good practices'. Use clear MUST/avoid language and concrete names.

Specificity removes guesswork. The more precise the instruction, the less the agent improvises in directions you don't want.

Encode constraints and anti-patterns

Spell out the hard rules: 'never call the payments API directly', 'all timestamps are UTC', 'don't add new dependencies without flagging it'. Agents won't infer your non-negotiables.

Listing the anti-patterns you've already rejected is as valuable as listing what to do — it stops the agent rediscovering bad ideas.

Show, don't just tell

Include short examples of the conventions you want — a sample component, a preferred error-handling shape, a commit-message format. Examples communicate faster than prose.

One good example often replaces a paragraph of description and leaves far less room for misinterpretation.

Persist and maintain

Put the instructions in a project file the agent reads every session, not in a prompt you retype. That's the only way they survive across sessions and teammates.

Review them like code and keep them current; outdated instructions are worse than none because the agent follows them with confidence.

Frequently asked questions

What makes AI project instructions effective?+

Specific, imperative directives, explicit constraints and anti-patterns, concrete examples, and storage in a persistent file that's kept current.

Where should I keep AI instructions?+

In a project context file (like CLAUDE.md or your agent's rules) at the repo root, so the agent reads them every session.

Should I include things the agent should NOT do?+

Yes. Explicit 'never do' rules and rejected patterns are as important as positive instructions.

How often should I update them?+

Whenever conventions or constraints change. Stale instructions cause confident mistakes, so review them like code.

Keep reading