How to Write an AI Instruction File

How do you write an instruction file like CLAUDE.md so an AI works the same way every time? Put up to 10 absolute rules at the top, then a table of tools by task type, point to detail files by path, date each rule with a reason, and keep the file short.

To make an AI work the same way every time, keep the rules in a file. Keep it short, because a long file becomes a cost in every conversation.

How to use it

  • Put 10 or fewer absolute rules at the top: tone, handling of secret keys, approval before deploying, stopping before anything irreversible.
  • Next, list in a table which tools and skills to use first for each type of work.
  • Put detailed explanations in other files and write only the path. The instruction file acts only as a table of contents.
  • Add a date and a reason to each rule in one line. It gives you grounds for judging later whether the rule can be deleted.
  • Do not delete changed rules. Move them down into a history so it records why they changed.
  • Do not let it build a new feature right away. First get a one-line description and 2 to 3 completion criteria, and start after approving them.

Prompts to copy

Instruction file skeleton

# Project Instructions

## Absolute rules
1. Never print secret key values on screen.
2. Deploy only after approval.
3. Stop and report the risk before any irreversible action.
4. For a new feature, first show "a one-line description + 2 to 3 completion criteria" and start after approval.

## What to use first, by task
| Task | Use first |
|---|---|
| (e.g. building a screen) | (e.g. design-check skill) |

## Detail documents
- Product description: docs/product.md
- Design standards: docs/design.md

## Change history
- YYYY-MM-DD: (what changed and why)

All cards (27)