When to use it

Use this as a starting point for the project instructions file of a coding agent, such as a repository-level instructions file, or as the system prompt in an agent you build yourself. It suits teams that let an AI agent edit files and run commands, and want predictable behavior across tasks and developers. It is less necessary for simple autocomplete, where the tool does not take actions on its own.

How to customize it

  • [PROJECT CONTEXT] saves the agent from rediscovering basics on every task. Exact build, test and lint commands are the most valuable lines.
  • [CODE CONVENTIONS] should point to real examples in the repository; “follow the pattern in X” works better than abstract rules.
  • [DIRECTORIES YOU MUST NOT MODIFY] protects generated code, migrations and vendored libraries.
  • Safety rules should match your actual permission settings. The prompt guides behavior; permissions enforce it.
  • Reporting can be shortened for quick tasks, but keep “what you did not verify”.

Why it works

Agents fail in predictable ways: they make broad changes, add dependencies, weaken failing tests or report success they did not check. Each rule targets one of those failures. Asking for a plan before editing gives you a chance to stop a wrong approach early, and “smallest change” keeps diffs reviewable.

The instruction to treat file and web content as data addresses prompt injection, a real risk when agents read untrusted text. The structured report makes verification visible, so a reviewer can see exactly which commands were run. Our guide on writing a system prompt explains the general structure behind this template.

Tips and variations

  • Keep the file short and specific; long instruction files dilute the important rules.
  • Combine it with restricted credentials, as described in least-privilege API keys for AI coding agents.
  • Add a “Known pitfalls” section when the agent repeats the same mistake.
  • Review agent changes like any pull request, even when tests pass.
  • Update the instructions when the build or test commands change; stale commands are a common cause of wasted agent runs.
  • Start new agents on small, well-tested tasks before trusting them with larger changes.