If you are tired of AI coding assistants ignoring your design system, the solution is likely sitting in your repository, waiting to be written. A new guide from DEV.to contributor Riona He argues that the repetitive cycle of correcting an AI editor’s output stems from a lack of persistent context. Each session starts blank, meaning the tool has no memory of your previous bans on specific libraries or your preference for CSS tokens over raw pixels. The fix is a rules file, a plain text document that serves as standing instructions for the AI agent.

The Mechanics of Persistent Context

Most modern AI coding tools, including Cursor, Windsurf, GitHub Copilot, and Claude, are designed to ingest specific configuration files at the start of a session. While filenames vary by tool—such as AGENTS.md, CLAUDE.md, .cursor/rules, or .github/copilot-instructions.md—the function is identical. These files allow developers to define hard constraints that persist across sessions, effectively giving the AI the 'memory' it otherwise lacks. The content matters far more than the specific filename, provided the tool’s documentation confirms it reads from that path.

What to Include (and What to Cut)

The guide provides a starter template for a website repository, emphasizing brevity and strictness. Key sections include build commands (like npm ci and npm run build), styling rules (mandating the use of src/styles/tokens.css and forbidding !important or raw pixel values), and component guidelines (searching src/components before creating new files). Crucially, it advises against including long explanations or weekly-changing details. A rules file should be about one page long; longer files get skimmed, and rules at the bottom are often ignored. The golden rule is to write rules based on actual corrections you’ve made in the past, rather than hypothetical best practices.

Verifying Your Setup

Writing the file is only half the battle; you must verify the tool is actually reading it. The suggested test is to ask the AI at the start of a session: 'Which project rules are you following? List them.' If the AI cannot list them, the file is likely in the wrong location or not being loaded. A secondary test involves intentionally breaking a rule—such as asking for a banned carousel library—to see if the AI pushes back. This verification step ensures that your investment in configuration actually translates to better code output.

Key Takeaways

  • AI editors start with a blank slate each session; rules files provide persistent constraints.
  • Common configuration files include AGENTS.md, CLAUDE.md, and .cursor/rules, depending on the tool.
  • Keep rules files short (approx. one page) and focused on hard constraints like build commands and design token usage.
  • Derive rules from repeated corrections you’ve made manually, not from idealized documentation.
  • Always verify the AI is reading the file by asking it to list its active rules before starting work.

The Bottom Line

Stop treating AI coding assistants as fresh hires every morning; if you aren't writing down your hard constraints in a rules file, you are choosing to pay the tax of retyping corrections.