Skip to content
Technology, explained from the insideAI · Software · Digital payments
TayoTechTalk.

AI Software Development

Repository Instructions for AI Coding Agents: What to Write and What to Verify

By Temitayo Solomon Gbadebo · November 24, 2026
Illustration of an instruction card linked to repository folders, with a magnifying glass representing verification.

An AI coding agent can read your source files and still miss how your team works. It may edit generated output, copy a legacy pattern, or run a command from the wrong directory. Repository instructions help by making the important local knowledge explicit.

The useful starting question is simple: what would a capable new contributor need to know that the code alone does not explain? Write those answers down, then check that they remain true.

Choose a supported home for the guidance

AGENTS.md provides an open Markdown format for project guidance, including setup, conventions and checks. Its documentation describes using nested files for subprojects. Support and loading behavior still need checking in the particular agent you use.

For example, GitHub documents repository-wide and path-specific Copilot instructions, alongside agent instruction files. Those options have feature-specific support. A file that affects one workflow should not be assumed to affect every editor, review tool or background agent.

Choose one maintained home for shared project facts. If several tools require different entry files, use their supported reference or import mechanisms where appropriate. Otherwise, keep those entry files small and audit any repeated content. An ordinary link is useful navigation, but it does not guarantee that the agent loads the linked document.

Write the knowledge that prevents repeated mistakes

A useful instruction file usually answers five questions:

  • Where does the work belong? Explain the main directories and the boundaries between them.
  • Which examples should guide new code? Point to a maintained implementation, especially when older patterns remain nearby.
  • What must be preserved? Identify compatibility expectations and project-specific invariants.
  • How is a change checked? Give real commands, their working directories and prerequisites.
  • What should the agent report? Require a clear account of changed files, checks and unresolved uncertainty.

Prefer an observable direction over an adjective. “Keep the code clean” leaves the agent guessing. “Place transport parsing in the adapter layer; keep domain functions independent of request objects” explains a boundary that a reviewer can inspect.

Include a short reason when it helps resolve future choices. If a response field must remain present because older clients depend on it, say so. The reason makes the rule more useful than an unexplained prohibition.

A hypothetical repository instruction file

The following example is invented. Its paths and commands illustrate a structure; they are not a ready-to-run configuration. Replace every entry with something verified in your own repository.

# Project guidance

## Layout
- src/domain contains business rules without transport dependencies.
- src/adapters translates external inputs into domain operations.
- generated/client is produced from schema/service.yaml.
  Update the schema and use the documented generator rather than
  editing generated files directly.

## Examples and references
- Follow src/adapters/current-handler for new handler structure.
- Read docs/compatibility.md before changing a public response.

## Validation
- Run ./scripts/check from the repository root.
- This requires the runtime version recorded in .tool-versions.
- Read docs/local-services.md before service integration checks.
- Report each command, its result, and any check you could not run.

## Uncertainty
- If these instructions conflict with the current build or CI,
  describe the mismatch before choosing a workaround.
- Do not describe an unavailable check as passing.

This example stays short because the detailed procedures live elsewhere. It provides a map and a few important constraints. It also makes uncertainty visible instead of encouraging a confident guess.

Make scope and conflicts explicit

Place genuinely shared guidance at the repository level. Put a package-specific convention close to that package when the tool supports scoped instructions. A documentation package should not inherit an unrelated application’s build procedure simply because both live in one repository.

Do not assume every tool resolves conflicts identically. Check its documented loading and precedence rules, including how user-level settings interact with repository files. A sentence claiming priority cannot override the agent’s actual instruction hierarchy or permission controls.

Try a small exercise: choose a file in a nested package and identify all the guidance that should apply. Then ask the agent to summarize the applicable conventions and compare its answer with the tool’s available context information. The summary is a useful diagnostic, not proof that every instruction will be followed.

Verify the instructions as a contributor would

Start with mechanical checks. Do referenced paths exist? Are scripts executable where needed? Does each command run from the stated directory? Are required services, environment variables and runtime versions documented without exposing secrets?

Next, try a small, disposable change in a fresh worktree or equivalent isolated checkout. Look for whether the agent chooses the intended directory, finds the preferred example and reports validation honestly. Inspect its actual changes and command results rather than relying on its final summary.

Keep this exercise focused on the instruction file. You are checking whether project knowledge is discoverable and usable, rather than rebuilding the whole testing strategy. Where practical, automate cheap checks such as broken relative paths or references to removed scripts.

Keep guidance current and enforce critical rules elsewhere

Add instruction review to changes that move directories, replace scripts or alter important conventions. Update the guidance in the same change. Give each section an owner or a clear review route, and remove obsolete exceptions rather than accumulating them indefinitely.

A repeated correction is a good candidate for a new instruction. A one-off task detail usually belongs in the issue or task prompt. Before adding a paragraph, ask whether an existing rule should be clarified instead.

Finally, repository instructions are not a security boundary. Anthropic explicitly describes Claude’s instruction and memory files as context rather than enforced configuration. Apply that distinction when designing your workflow: use actual access controls, restricted credentials and approval mechanisms for consequential operations. Review instruction-file changes because they can influence agent behavior.

Start with the few facts that repeatedly save contributors from mistakes. Verify them, observe a real task, and improve the file from evidence. A compact, accurate guide earns its place in the repository by reducing avoidable confusion.

Continue reading