These four template files solve the problem. They give your AI a memory, a personality, and clear boundaries. Set up once, they work across sessions.
The 4 files at a glance
File
Purpose
Core question
IDENTITY.md
Role & personality
How should the AI act?
STYLE.md
Tone & formatting
How should the AI express itself?
CONTEXT.md
Project background
What does the AI need to know?
RULES.md
Hard limits
What must the AI never do?
IDENTITY.md — role, personality, working style
What goes in?
The Identity file defines who the AI is in your project. Not in the sense of role-play, but in the sense of: what stance should it take? How should it make decisions?
Core tasks: the 3–5 most important things the AI should do
Personality traits: proactive vs. reserved? Opinionated vs. neutral? Creative vs. analytical?
Decision principles: what to prioritise? (e.g. "speed over perfection", "revenue over features")
Working style: when to ask, when to act independently?
Why this improves results
Without identity, the AI behaves like a generic assistant — polite but without stance. With identity you get consistent, context-aware answers that fit your project. Instead of "Here are 5 options" you get "I recommend option A because it fits your goal X."
Common mistakes
Too vague: "Be helpful" says nothing. Better: "Always propose exactly ONE next step."
Too many traits: 3–4 strong traits beat 10 generic ones.
Contradictions: "Be proactive" and "Always ask first" clash. Be precise about when each behaviour applies.
STYLE.md — tone, language, formatting
What goes in?
The Style file defines how the AI communicates. Tone, language, format — everything that shapes how the output feels.
Core elements:
Base tone: Casual-technical? Professional-warm? Sober-precise?
Language rules: which language for what? "Du" or "Sie"? Jargon allowed?
Good/bad example: shows the AI concretely what you want
Why this improves results
The AI defaults to a generic "assistant tone" — overly polite, with phrases like "Of course!" and "Great question!". The Style file kills that. The good/bad example is especially powerful: one concrete example beats 10 abstract rules.
Common mistakes
Only defining don'ts, no dos: the AI needs to know what to do INSTEAD.
No example: abstract style rules are interpretable. Concrete examples aren't.
Forgetting language: if you work in multiple languages, define clearly when each applies.
The Context file gives the AI the domain knowledge it needs to work within the right frame.
Core elements:
Project profile: name, type, status, elevator pitch
Tech stack: a table of technologies per layer
Architecture: folder structure, key patterns
Audience: primary, secondary, anti-audience
Current state: checklist — what exists, what's missing
Priorities: what takes precedence right now and why
Glossary: project-specific terms and acronyms
Why this improves results
Without context the AI guesses. It proposes React when you're using Vue. It explains basics you already know. It ignores your architectural decisions. With context it works inside your project instead of alongside it.
The glossary is especially important on projects with their own jargon. If the AI knows "Binder" is a player role in your project and not a folder, you avoid misunderstandings.
Common mistakes
Too much at once: only include what the AI needs regularly. Move deep dives into sub-files.
Not kept current: stale context is worse than no context. Update priorities and status regularly.
Forgetting paths: in code projects, the AI needs the folder structure or it creates files in the wrong place.
RULES.md — hard limits for code, communication, and scope
What goes in?
The Rules file defines what the AI must never do. These aren't preferences, they're hard limits.
Code rules: no any types, no console.log, no unused imports
Communication rules: don't hallucinate, don't hide things, no over-engineering
Scope rules: no scope creep, no unrequested refactors
Privacy: no personal data in logs, no credentials committed
Why this improves results
AI models are inherently eager to please — they want to help and tend to do more than asked. That leads to scope creep, needless refactors, and sometimes dangerous actions (e.g. changing production data). The Rules file sets clear guardrails.
Especially important: the golden rule at the end — "When in doubt, ask, don't act." That shifts the AI's default from "just do it" to "verify first".
Common mistakes
Too restrictive: if everything's forbidden, the AI can't work. Focus on things with real damage potential.
No explanation: "No any" is a rule. "No any because TypeScript strict mode is our first defence against bugs" is better obeyed.
Not project-specific: generic rules like "write good code" do nothing. "No class components, only functional with hooks" is concrete.
How to set up the files
Step 1: copy the templates
Create a .claude/ folder in your project root (or wherever your AI looks for context files). Copy the four templates in.
Step 2: fill in the placeholders
Each file has [PLACEHOLDER]s and HTML comments with explanations. Go through them in order. Only fill in what you're sure of. The rest can be added later.
Recommended order:
CONTEXT.md first — that's the foundation (project, tech stack, glossary)
IDENTITY.md second — how should the AI act within this context?
STYLE.md third — how should it express itself?
RULES.md last — what limits do we need?
Step 3: iterate
The files get better the more you work with the AI. When it does something that bothers you: write a rule for it. When it does something well: document the pattern.
Maintenance tips
Weekly check:
Are the priorities in CONTEXT.md still right?
Is the project status current?
Per new project:
Refill CONTEXT.md from scratch
Adjust IDENTITY.md (different role?)
STYLE.md and RULES.md are often reusable — just add project-specific bits
On problems:
AI talks too much? → STYLE.md: add a length limit + don't
AI does too much on its own? → RULES.md: tighten scope rule
AI doesn't grasp context? → CONTEXT.md: extend glossary and architecture
AI is too generic? → IDENTITY.md: sharpen decision principles
Using with other AIs (not just Claude)
The templates work across platforms, but with differences:
Claude (Anthropic)
Reads .claude/CLAUDE.md automatically as project context
Tip: merge all 4 files into a single CLAUDE.md or reference them via @ import
Supports multi-level hierarchy: global → entity → project
ChatGPT / GPT-4 (OpenAI)
No native filesystem reading. Context must be pasted as Custom Instructions or System Prompt
Tip: IDENTITY + STYLE into "Custom Instructions" (persistent). CONTEXT + RULES as the first message in the chat.
Mind the character limit: Custom Instructions cap around ~1,500 chars. Cut aggressively.
Cursor / Windsurf / other code editors
They read .cursorrules, .windsurfrules, or similar files
Tip: drop the content of the 4 templates into the editor's rules file. Format is usually Markdown.
Gemini (Google)
System Instructions in API mode, "Gems" in the web UI
Tip: IDENTITY + STYLE as System Instruction. CONTEXT as the first turn.
General notes for other AIs
RULES.md is the most important across all models. Every AI needs clear limits.
Good/bad examples (from STYLE.md) work universally — all models learn better from examples than from abstract rules.
Shorter = better for models with small context windows. When in doubt: prioritise RULES + CONTEXT, trim STYLE + IDENTITY.
Test: every model interprets instructions differently. After setup, hand it a test task and check the output fits.