reph

Templates · Engineering

Agent instructions template

The charter your AI coding agents work from, project overview through review checklist

Start with this template →Sign in

Opens on reph with the template ready to start. No account needed; sign in to keep your document.

Use it when

AI coding agents work in your repository and need one accurate file of commands, architecture, conventions and limits, such as CLAUDE.md or AGENTS.md

Who it's for

EngineerTech leadEngineering managerSRE

Part of a kit

Shipping AI features, step 3 of 4. Prompt spec, eval plan, agent instructions and the experiment that proves it works.

Filled example

The template filled in for a made-up company, so you can see what good looks like.

CLAUDE.md for fernhill-web

This is the file an AI coding agent reads before it touches Fernhill's code. Keep it accurate: a stale instruction costs an agent a wrong turn every single session.

Project overview

Fernhill is a booking platform for independent physiotherapy clinics. fernhill-web is the clinic dashboard: schedules, patient notes and invoices. It exists so a three-person clinic can run its week from one screen without a receptionist.

Commands

Task Command
Install dependencies pnpm install
Run the dev server pnpm dev (http://localhost:5173, uses the mock API)
Run the full test suite pnpm test
Run one test file pnpm test -- src/features/schedule/slots.test.ts
Type check pnpm typecheck
Lint pnpm lint
Build for production pnpm build
End-to-end tests pnpm e2e (needs pnpm dev running)

Architecture map

src/
  app/        router, auth guard, query client setup
  features/   schedule, patients, invoices, settings: each with api.ts, use*.ts hooks, views
  shared/     ui/ primitives, http/client.ts (the only fetch), date/ helpers
  mocks/      MSW handlers used by dev and tests

Views never call fetch or import an api.ts directly: data flows view to hook to api.ts to shared/http/client.ts. A feature may use another feature's hooks, never its api.ts. All dates are stored in UTC and formatted only in shared/date/format.ts, because clinics span time zones.

Conventions

  • Naming: components in PascalCase files, hooks start with use, tests sit beside the file as *.test.ts.
  • State: server state lives in TanStack Query; UI state in component state or a feature's Zustand store. Never copy server data into Zustand.
  • Errors: API errors surface through useToastError(); never alert() or a bare console.error.
  • Tests: every new hook gets a test against the MSW mocks; every new view gets at least one render test.

Do

  • Read the surrounding code before writing new code, and match its existing patterns.
  • Write or update a test alongside every behavior change.
  • Keep commits small and each one buildable on its own.
  • Add an MSW handler in src/mocks/ for any new endpoint you call.
  • Ask when a requirement is ambiguous rather than guessing at intent.

Don't

  • Don't invent a new pattern when an existing one already solves the problem.
  • Don't touch unrelated files in the same change, even to fix something adjacent.
  • Don't skip the test suite before claiming a change works.
  • Don't log or render patient notes in error messages; they are health data.
  • Don't commit secrets, .env files or generated build output.

Review checklist

Escalation

Stop and ask a human before: changing anything in src/features/patients/notes/ (health data rules apply), editing database migrations in the API repo, deleting files, or changing the auth guard. If a test fails for a reason you cannot explain in one sentence, report it rather than editing the test to pass.

The template

Show the blank template

Agent instructions

This is the file an AI coding agent reads before it touches [workspace]'s code. Keep it accurate: a stale instruction costs an agent a wrong turn every single session.

Project overview

One paragraph: what this product is, who it's for, and the single sentence that explains why it exists.

[workspace] is a [one-line description]. It serves [audience] by [core value].

Commands

The commands an agent needs before it can do anything useful, copy-pasteable.

Task Command
Install dependencies npm install
Run the dev server npm run dev
Run the full test suite npm test
Run one test file npm test -- path/to/file.test.ts
Type check npm run typecheck
Lint npm run lint
Build for production npm run build

Architecture map

Where things live, in enough detail that an agent can find the right file on the first try instead of grepping the whole tree.

src/
  app/        entry point, routing, top-level wiring
  features/   one folder per feature: api, hooks, views
  shared/     cross-feature utilities, UI primitives, the one http client

Note any layering rules here: what may import what, where business logic lives versus where the UI lives, and which files are the single source of truth for a given concern.

Conventions

The patterns a new contributor (human or agent) is expected to follow, not just the ones a linter enforces.

  • Naming: state the casing/prefix rules that matter (file names, component names, test files).
  • State: where does UI state live, where does server state live, and what talks to what.
  • Errors: the one way errors surface to a user or caller, so a new code path doesn't invent its own.
  • Tests: what a test for a new feature must cover before it merges.

Do

  • Read the surrounding code before writing new code, and match its existing patterns.
  • Write or update a test alongside every behavior change.
  • Keep commits small and each one buildable on its own.
  • Ask when a requirement is ambiguous rather than guessing at intent.

Don't

  • Don't invent a new pattern when an existing one already solves the problem.
  • Don't touch unrelated files in the same change, even to fix something adjacent.
  • Don't skip the test suite before claiming a change works.
  • Don't commit secrets, credentials, or generated build output.

Review checklist

What a reviewer, human or agent, should check before approving a change.

Escalation

When an agent should stop and hand back to a human instead of proceeding: an ambiguous requirement, a destructive operation, a decision only the team can make.

Questions

Where does this file live?
At the repository root as CLAUDE.md or AGENTS.md, which coding agents read automatically
How long should it be?
As short as it can be while still accurate; every line is read every session
How do I keep it current?
Update it in the same pull request that changes a command, a folder or a convention

Fill it with your agent

Connect Claude to reph over MCP, then paste this. The draft arrives as suggestions you accept or reject section by section. How to connect Claude.

Find my reph doc "Agent instructions" with search_docs, then read it with read_doc. Fill commands, architecture map and conventions from the repo's package scripts, top-level folder tree, lint and CI config and the CONTRIBUTING file I paste. State only rules the code or config enforces or the team confirmed. File it with suggest_edit, one replace_section op per section (heading line kept) so each can be accepted alone. Ask each open question (conventions you inferred rather than read) with add_comment quoting that section's heading line, then call request_review with a one-line summary.

Related templates

Start with this template →Sign in