AGENTS.md and CLAUDE.md, specs, rules and skillsWhat an agent should know about a project and where to keep it
Four kinds of persistent context for AI (AGENTS.md, CLAUDE.md, skills): the task spec, the project bible, rules and skills. What goes into each, when it enters the context, and what ChatGPT and Claude offer. Based on Anthropic, OpenAI, GitHub, Cursor and Cline docs.
A model does not remember a project between sessions. Four kinds of files give that context back.
Four layers of context
Layer
What goes in
When in context
Files
Spec
requirements, plan, steps of one task
for one task
spec.md · plan.md · tasks.md
Bible
product goal, users, decisions
at task start
projectbrief.md · productContext.md
Rules
commands, style, prohibitions
every session
CLAUDE.md · AGENTS.md · .cursor/rules
Skill
procedure with examples and scripts
description always, body on call
SKILL.md
Takeaway
In this exampleThe layers differ in lifetime and in when they enter the context.
In generalRules load into every session, so they are kept short: Anthropic recommends under 200 lines per file. Long and rarely used content moves into skills, whose body loads only on call.
Next stepGo through your instructions file: keep facts in the rules, move procedures into skills and the product description into the bible.
Spec: one task before the code
A spec describes the task before work starts: first what and why, then how.
1Principlesonce per project
→
2Specwhat and why
→
3Planhow
→
4Taskssteps
→
5Implementcode step by step
Main steps of GitHub Spec Kit. How to split a large spec into parts: Specs by aggregates
Takeaway
In this exampleSpec Kit takes a task from project principles through the spec and plan to steps and code.
In generalRequirements are written before the code, and the review checks the result against that text. How a spec fits into the harness is covered in HDD and specs.
Next stepFor a task longer than a day, write a spec: what, why and how you will know it is done.
Project bible: what the product is
The bible is a standing description of the product: why it exists, who it serves, how it works and what has been decided. The term comes from practice; the closest documented analogue is Cline’s Memory Bank.
projectbrief.mdgoals and requirements
productContext.mdwhy it exists, what it solves
systemPatterns.mdarchitecture and patterns
techContext.mdstack and constraints
activeContext.mdcurrent focus and next steps
progress.mdwhat works, what is left
Takeaway
In this exampleSix Memory Bank files: from the product goal to current progress.
In generalThe bible answers the questions otherwise asked in every new chat: what the product is, which decisions were made, what is in progress. The current-context file changes most often.
Next stepStart with one file: product goal, users, key terms and recent decisions with dates.
Rules: in every session
Rules are instructions the harness puts at the start of every session.
CLAUDE.md
Claude Code, path-scoped rules in .claude/rules/
AGENTS.md
“A README for agents”: Codex, Cursor, Gemini CLI, Copilot and others
.cursor/rules
Cursor, four ways to apply
When a rule enters the context · Cursor
Alwaysevery chat
By descriptionthe agent decides
By filespath pattern matches
Manually@rule
≤ 200lines per CLAUDE.md file
Takeaway
In this exampleThree formats of one idea: an instructions file the harness reads at the start.
In generalRules stay context, and the model can break them; an action that must never happen is blocked with a hook. The more specific and concise a rule, the more consistently it is followed.
Next stepCreate AGENTS.md or CLAUDE.md: build and test commands, code style, prohibitions. Move folder-specific rules into path-scoped rules.
Skills: a procedure on call
A skill is a folder with a SKILL.md instruction, examples and scripts for a recurring procedure.
Session start
reportPR reviewreleaseclient email
name + description
↓ the agent picked “PR review”
On call
SKILL.mdinstructions, examples, scripts
full body
Takeaway
In this exampleDescriptions of all skills are always in context; the body loads once one is picked.
In generalSo a long reference inside a skill costs almost nothing until it is used. A skill is worth creating when the same instruction or checklist keeps being pasted into chat, or when a section of the rules has grown into a procedure.
Next stepFind a section of your rules that describes a procedure and move it into a skill with a precise description of when to use it.
The same in a chat: projects and skills
Project instructions ≈ rules
Role and format once, for every chat in the project
Project files ≈ bible
Sample replies, policies and templates live in the project
Skills = skills
A repeatable workflow with instructions and examples
Takeaway
In this exampleThree places where a prompt outlives a single chat: instructions, files and skills.
In generalA role, examples and format moved into a project work in every new chat without copying. A shared project gives the whole team one set of examples.
Next stepCreate a project for your most frequent weekly task and move the role and format from your best prompt into its instructions.
What goes where
If it is…
Where
a command, style or prohibition needed in every task