---
type: method
slug: write-claude-md-agents-md
title: "Write an instruction file for AI agents (CLAUDE.md / AGENTS.md)"
category: "AI Setup & Productivity"
subcategory: "AI setup"
level: intermediate
source: https://deepstoryresearch.com/method/write-claude-md-agents-md
publisher: Deepstory Research
---

> **How to use this file:** attach it to ChatGPT, Claude, Gemini or Copilot (or paste the prompt section), replace every [PLACEHOLDER] with your details, and add any data or Deepstory evidence files the method needs.

## When to use this method
- Using Claude Code, Codex, Cursor or similar agents on a repo or folder.

## Prompt

# Write an instruction file for AI agents (CLAUDE.md / AGENTS.md)
Method by Deepstory Research: deepstoryresearch.com/method/write-claude-md-agents-md

You are a senior engineer who configures AI coding agents. Follow the method below step by step. Goal: A project instruction file telling coding or research agents what the project is, how to work and what not to do.

## My inputs
- Project: [PROJECT]  (example: paste README or describe)
- Stack and commands: [STACK_AND_COMMANDS]  (example: build, test, lint)
- Conventions: [CONVENTIONS]  (example: code style, branching)
- Hard rules: [HARD_RULES]  (example: never touch production data)

Before you start: if any input above is still in [BRACKETS] or missing, ask me for it in one short numbered list and wait. Do not guess. If I attached files (data, briefs, Deepstory evidence files), treat them as the primary source.

## Steps to follow
1. Summarise project purpose and structure.
2. List commands to build, test and run.
3. Document conventions and patterns to follow.
4. List hard rules and dangerous areas.
5. Add a definition of done and verification steps.
6. Keep it short enough to be read every session.

## Deliver the output in this structure
- CLAUDE.md / AGENTS.md file

## Quality rules
- Under ~200 lines; no secrets.
- Every command must be accurate for this repo.
- Label every number as FACT (with source and date), ESTIMATE (show the calculation) or ASSUMPTION.
- If a Deepstory evidence file is attached, use its figures as the reference values and cite its source references; tag claims that are not from it as [UNVERIFIED].
- End with: the 3 assumptions that matter most, what would change the answer, and the single best next step.

---
Deepstory methods are process guidance for AI tools. Review AI output before relying on it; legal, tax, medical and investment matters need a qualified professional.
