Objective
Your mission
Write a context file for a project, deploy it to the right location, and test that the AI follows your conventions from the first message. Output: context_file.md.
You need: A project you're building with AI (any tool).
Time: 25 minutes.
Step 1: learn the context file template (5 min)
A context file is a markdown file the AI reads automatically. Different tools look in different places:
- Most coding agents:
AGENTS.md in the project root. It is the shared convention, read by Cursor, OpenAI Codex, GitHub Copilot's coding agent and others, so one file covers several tools. - Cursor:
AGENTS.md, or project rules as .mdc files inside the .cursor/rules/ folder (each rule can apply always, or only to matching files). The single .cursorrules file is the deprecated legacy format. - Claude Code:
CLAUDE.md in the project root. To share one file, put @AGENTS.md on a line in CLAUDE.md and Claude Code will import it. - GitHub Copilot in the editor:
.github/copilot-instructions.md - Browser builders: use the project's instructions or knowledge setting (Lovable calls it Knowledge) so every chat gets it. Only if your builder has no such setting, paste it as your first message in each new chat.
Template:
# Project Context
## Overview
[1-2 sentences describing what the app does]
## Tech Stack
- Frontend: [framework + language]
- Styling: [CSS approach]
- Build tool: [Vite, Next.js, etc.]
- Backend: [database, auth, etc.]
- State management: [approach]
## File Structure
- src/components/ — [what goes here]
- src/pages/ — [what goes here]
- src/lib/ — [what goes here]
## Conventions
- [patterns the AI should follow]
- [naming conventions, export styles, etc.]
## Current State
- [what's done]
- [what's in progress]
- [what's TODO]
## Do NOT
- [patterns to avoid — based on past AI mistakes]
- [things the AI keeps doing wrong]
The Do NOT section
The "Do NOT" section is often more valuable than the "Do" section. Each Do NOT entry is a correction you never have to make again. 'Do not use class components' means the AI tried class components and you had to correct it. 'Do not hardcode API keys' means the AI hardcoded one and you caught it.
Step 2: write your context file (10 min)
Write a context file for your project using the template above. Be specific — use real file names, real conventions, real tech stack details.
Write in your file (and save to the correct location):
# Project Context
## Overview
[your app description]
## Tech Stack
[your actual stack]
## File Structure
[your actual directories]
## Conventions
[your actual patterns]
## Current State
[your actual progress]
## Do NOT
[your actual corrections]
Step 3: deploy the context file (2 min)
- Cursor, Codex, Copilot's agent: save as
AGENTS.md in the project root (in Cursor you can instead split it into rules under .cursor/rules/) - Claude Code: save as
CLAUDE.md in the project root, or keep AGENTS.md and add a CLAUDE.md containing @AGENTS.md - Browser builder: paste it into the project's instructions or knowledge setting; failing that, keep the file and paste it as the first message of each new chat
Step 4: test it (5 min)
Start a new chat and ask the AI to build something small — a component, a feature, a page. Don't give any context beyond the request.
Write in your file:
## Test Result
Request to AI: [what you asked for]
Did the AI follow conventions from the context file? [yes/no]
Specific examples: [e.g., "The AI used Tailwind classes without being told" or "The AI used named exports as specified"]
What was missing? [anything the context file didn't cover that the AI needed]
Step 5: update (3 min)
Based on your test, add anything missing to the context file. If the AI made a wrong assumption, add a Do NOT entry.
Write in your file:
## Updates Made
[what you added or changed in the context file based on the test]
Which part of a context file does the lesson call often more valuable than the rest?
Each Do NOT entry is a correction you'll never have to make again, such as "do not hardcode API keys."