Back to main
Free guide · Nov 3, 2026

How to Actually Code Using AI: The Context Kit

Four small markdown files that live in your repo, so your AI coding agent stops starting from zero every session. Works with Claude Code, Codex, Cursor, GitHub Copilot, Windsurf, and similar tools.

AGENTS.md

Tech stack, conventions, project structure, rules

Update: When your stack or rules change

FLOW.md

How the app works end to end: requests, APIs, data

Update: When you add a feature or service

DECISIONS.md

Why you chose X over Y, and what you rejected

Update: Every time you make a technical choice

PLAN.md

The steps for the feature you're building right now

Update: Before every new feature

Where are you starting?

Pick one to see your prompt.

Each file below has a ready-to-paste prompt that makes the AI write it for you, plus a template if you'd rather fill it in yourself.

01

AGENTS.md: the instruction manual

AGENTS.md is the first file your AI reads. It tells the AI how this project works and how you want code written, so you stop repeating yourself every session.

What to put in it

  • Tech stack and versions
  • Project structure: which folder holds what
  • Commands to install, run, test and build
  • Coding conventions: naming, formatting, patterns to follow
  • Rules: things the AI must always or never do
AGENTS.md prompt
Read this codebase and create AGENTS.md in the project root. Include: tech stack with versions, folder structure with one line per important folder, commands to install, run, test and build, the coding conventions you can see in the code, and a "Rules" section. Only include what you can confirm from the code. Mark anything unsure as "TODO: confirm". Keep it under 150 lines.
Prefer to fill it in yourself? Show the template
AGENTS.md
# AGENTS.md

## Tech stack
- Frontend: React 18 + TypeScript, Tailwind CSS
- Backend: Node.js 20, Express
- Database: PostgreSQL 16 with Prisma
- Hosting: Vercel (frontend), Railway (backend)

## Project structure
- /client: frontend app
- /server/routes: API route handlers
- /server/services: business logic
- /server/prisma: database schema and migrations

## Commands
- Install: npm install
- Run locally: npm run dev
- Test: npm test
- Build: npm run build

## Conventions
- camelCase for variables and functions, PascalCase for components
- Keep business logic in /services, not in routes
- Use async/await, never .then() chains

## Rules
- Always run tests before saying a task is done
- Never edit migration files that are already committed
- Ask before adding a new dependency
- Read FLOW.md and DECISIONS.md before making architectural changes

The last rule matters. It tells the AI to read your other two files before big changes.

02

FLOW.md: how your app actually works

FLOW.md shows the AI the big picture in one read. Without it, the AI only sees the few files it opened and misses how they connect, which is where most broken changes come from.

What to put in it

  • How a request travels from frontend to backend to database and back
  • Main API endpoints and what each one does
  • How services or modules talk to each other
  • Auth flow: login, tokens, protected routes
  • Background jobs, queues, webhooks, third-party APIs
FLOW.md prompt
Trace how this application works end to end and write FLOW.md in the project root. Pick the most important user action (e.g. sign up, place an order) and describe every step from the UI click to the database and back, naming the actual files and functions involved. Then list the main API endpoints with one line each, the auth flow, and any background jobs or external services. Use numbered steps. Only describe what's in the code.
Prefer to fill it in yourself? Show the template
FLOW.md
# FLOW.md

## Main flow: user places an order
1. User clicks "Checkout" in client/pages/Cart.tsx
2. Frontend calls POST /api/orders with the cart items and auth token
3. server/middleware/auth.ts verifies the JWT
4. server/routes/orders.ts validates the request body
5. server/services/orderService.ts checks stock and calculates the total
6. Payment is created through the Stripe API
7. Order is saved to the orders table via Prisma
8. A job is added to the queue to send the confirmation email
9. API returns the order ID and the frontend shows the success page

## API endpoints
- POST /api/auth/login: returns a JWT
- GET /api/products: list products with pagination
- POST /api/orders: create an order
- GET /api/orders/:id: order details (owner only)

## Auth
- JWT in an httpOnly cookie, expires after 7 days
- Protected routes use the requireAuth middleware

## External services
- Stripe: payments
- Resend: emails
- Redis + BullMQ: background job queue
03

DECISIONS.md: why you built it this way

DECISIONS.md stops the AI from suggesting things you already considered and rejected. It records what you chose, why, and what you said no to.

What to put in each entry

  • The decision: what you chose
  • Why: the reasoning, in one or two lines
  • Rejected: the alternatives you considered and why not
  • Date: so you know how old the decision is
DECISIONS.md prompt
Create DECISIONS.md in the project root. Look at the codebase and list the main technical choices: database, framework, ORM, auth, hosting, state management, styling, testing. For each, write the decision and the likely reason, marked "(inferred, confirm)". Then ask me, one at a time, why I made each choice and what alternatives I rejected, and update the file with my answers.

Add a decision later (use after any big choice)

Add a decision
We just decided to [decision]. Add an entry to DECISIONS.md with today's date, the reasoning we discussed, and the alternatives we rejected.
Prefer to fill it in yourself? Show the template
DECISIONS.md
# DECISIONS.md

## PostgreSQL instead of MongoDB (2026-03-10)
- Why: our data is relational (users, orders, products) and we need joins and transactions for payments
- Rejected: MongoDB (weak multi-document transactions for our use case), MySQL (team knows Postgres better)

## Docker for local development (2026-04-02)
- Why: same environment for every developer; Postgres and Redis start with one command
- Rejected: installing services locally (version mismatches between machines)

## REST instead of GraphQL (2026-04-15)
- Why: simple CRUD app, small team, easier caching
- Rejected: GraphQL (extra complexity we don't need yet)

## Do not suggest
- Switching to a NoSQL database
- Adding Redux; React Query + context is enough for us

The "Do not suggest" list is the fastest way to stop repeat suggestions.

04

PLAN.md: plan first, then code

Before any feature, make the AI write a plan and wait for your OK. You see every file it will touch before it touches anything, and you catch wrong approaches when they cost nothing to fix.

The workflow

  1. Describe the feature and ask for a plan, not code (prompt below).
  2. Read PLAN.md. Check the files it lists and the approach it picked.
  3. Push back on anything wrong: "Don't add a new table, reuse orders".
  4. Approve and let it build one task at a time, ticking tasks off as it goes.
  5. When the feature is done, update FLOW.md and DECISIONS.md if anything changed, then delete or archive PLAN.md.

Create the plan

PLAN.md prompt
I want to build: [describe the feature].

Don't write any code yet. First read AGENTS.md, FLOW.md and DECISIONS.md. Then create PLAN.md with:
- Goal: one or two lines on what this feature does
- Approach: how you'll build it and why
- Files to change or create, with one line on what changes in each
- Tasks: a checklist of small steps, each one testable on its own
- Risks and questions: anything unclear or that could break existing features

Stop after writing PLAN.md and wait for my approval.

Start building

Start building
Plan approved. Work through PLAN.md one task at a time. After each task, run the tests, tick it off in PLAN.md, and tell me what changed. Stop and ask if you need to do anything that isn't in the plan.
Prefer to fill it in yourself? Show the template
PLAN.md
# PLAN.md: Add password reset

## Goal
Users can reset a forgotten password through an emailed link.

## Approach
Signed token stored in a new password_resets table, expires in 30 minutes. Reuse the existing Resend email service.

## Files
- server/prisma/schema.prisma: add PasswordReset model
- server/routes/auth.ts: add POST /forgot-password and POST /reset-password
- server/services/authService.ts: token creation and validation
- client/pages/ForgotPassword.tsx: new page
- client/pages/ResetPassword.tsx: new page

## Tasks
- [ ] Add PasswordReset model and migration
- [ ] Token create and validate functions + tests
- [ ] API endpoints + tests
- [ ] Email template
- [ ] Frontend pages
- [ ] End-to-end test of the full flow

## Risks and questions
- Should old sessions be logged out after a reset?
- Rate limit the forgot-password endpoint to stop email spam
05

Keep it working

Out-of-date context is worse than none, because the AI will trust it. After each feature, paste this:

After each feature
We just finished [feature]. Check whether AGENTS.md, FLOW.md or DECISIONS.md are now out of date. Show me the changes you'd make, then update the files after I approve.

Making sure your tool reads the files

  • Codex, Cursor, GitHub Copilot and most other agents read AGENTS.md from the project root automatically.
  • Claude Code reads CLAUDE.md instead. Create a CLAUDE.md that contains one line, @AGENTS.md, and Claude Code will load your AGENTS.md from it.
  • FLOW.md and DECISIONS.md aren't loaded automatically by any tool. The "Read FLOW.md and DECISIONS.md" rule in AGENTS.md is what makes the AI open them.
  • If you're unsure, start a new chat and ask "What does AGENTS.md say about our rules?" If it can't answer, the file isn't being loaded.

Setup checklist

cursor