Your Sunday, upgraded. Free live AI class · 5 PM ISTReserve your seat
AI-ASSISTED DEVELOPMENT

Write Project Instructions Files That AI Coding Agents Actually Follow

Coding agents read instruction files in your repository to learn how the project works. Short, specific and verifiable instructions improve their output far more than long lists of preferences.

On this page

The core idea

Tools such as Claude Code, Cursor and GitHub Copilot can read repository files that describe conventions, commands and constraints; names include CLAUDE.md, AGENTS.md and editor-specific rule files. The agent treats this content as context for every task. Good instructions describe facts the agent cannot easily infer: how to run tests, which framework version is in use, which directories are generated and must not be edited and which patterns the team prefers. Vague guidance such as 'write clean code' adds length without changing behaviour.

A practical approach

Step 1

Start with commands: how to install, run, test, lint and type-check the project, exactly as typed.

Step 2

State versions and non-obvious technology choices, especially where they differ from common defaults the agent might assume.

Step 3

List rules that must not be broken, such as generated files to leave alone, secrets handling and required review steps.

Step 4

Point to example files that show preferred patterns instead of describing patterns in the abstract.

Step 5

Keep the file short and current; review it when the agent repeats a mistake and add the specific rule that would have prevented it.

Worked example

An agent repeatedly edits files in a generated client directory, and its changes are overwritten on the next generation. Adding one line, 'Do not edit src/generated; change the OpenAPI spec and run npm run generate', stops the problem. A second line naming the test command means the agent now runs the right tests before reporting a task as done.

A mistake to avoid

Do not put secrets, internal URLs that should stay private or personal data in instruction files. They are committed to the repository and sent to the tool as context.

Try it yourself

Write an instructions file for one of your projects with four sections: commands, technology versions, rules and example files. Ask an agent to complete a small task and note whether it follows each rule.

Your implementation checklist

  • Exact commands for running and testing are listed
  • Unusual versions and choices are stated
  • Hard rules are explicit and specific
  • Example files illustrate preferred patterns
  • The file is short, current and free of secrets

Share or cite this guide

Innovate with Ajay Editorial (2026-10-07). Write Project Instructions Files That AI Coding Agents Actually Follow. https://innovatewithajay.com/blogs/write-instructions-files-for-ai-coding-agents

Editorial approach, sources and corrections

YOUR NEXT CHAPTER

You have the curiosity.
Let’s turn it into capability.

Start with a practical workshop or bring a specific question to Ajay.

Chat with Ajay