Yeda AI Tips · #057

Español

Keep a Rules File for Your Agent

Stop repeating yourself to your AI assistant every session. Every new session starts with a fresh context window: your coding agent forgets the build command, the test runner, the "we use 2-space indentation" rule — all of it. The fix is a rules file: a markdown file in your repo that documents your conventions once, and that the agent reads automatically at the start of every session.

Why a rules file beats retyping

  1. Zero repetition. Build commands, coding standards, and project layout load automatically. You never re-explain them.
  2. Consistency. The same rules apply in every session, for every teammate — the file is version-controlled, so a convention change is a pull request, not a Slack thread.
  3. Instant onboarding. A new agent (or a new teammate) is productive from the first prompt, because the "how we work here" knowledge lives next to the code.

One idea, many file names

Every major coding agent supports the pattern; only the file name changes:

ToolRules fileNotes
Claude CodeCLAUDE.md (or ./.claude/CLAUDE.md)Loaded every session; ~/.claude/CLAUDE.md for personal rules across projects
Cursor.cursor/rules/*.mdcFour modes: always, intelligent, per-file-glob, manual
GitHub Copilot.github/copilot-instructions.mdPlain markdown, auto-added to every request in the repo
Cross-tool standardAGENTS.mdOpen format used by 60k+ open-source projects; Codex, Jules, Cursor, and others read it

If your repo already has an AGENTS.md, Claude Code can reuse it: put @AGENTS.md on its own line inside CLAUDE.md and the file is imported at session start — one source of truth, every tool reads it.

What to put in it

Write down what you'd otherwise re-explain. The best trigger: the agent makes the same mistake twice — that's a rules-file entry. Good content:

Keep it specific and short. Anthropic's guidance for CLAUDE.md is to target under 200 lines: longer files consume more context and instructions get followed less reliably. Concrete beats vague — "Run npm test before committing" works; "test your changes" doesn't.

Power-user moves

Keep it current

A stale rules file is worse than none: the agent will confidently follow last quarter's conventions. Review it whenever conventions change, delete contradictory entries (an agent facing two conflicting rules may pick either one), and treat rules-file edits as part of the code review that changed the convention.

Resources

Building an AI feature? Yeda AI designs, audits, and ships production LLM systems.

Talk to us · Read the blog