Your AI Agent Isn't Ignoring You -It Just Can't Read Your Mind
The coding standards exist in your head, your PRs, and your team's tribal knowledge. Your AI agent has access to none of that. Here's how to change that.
Why AI agents ignore your standards
AI coding agents don't have access to your team's accumulated knowledge. They know general patterns from training data -and they default to those patterns when you haven't told them otherwise. Your ESLint config partially helps (it catches violations after the fact), but the agent writes code first and gets corrected later, every session, without ever learning. The fix is a rules file that loads before the first line of code.
What makes a rules file actually work
Three things make agents actually follow rules: (1) Concrete examples -"Do this: X. Never do: Y" beats abstract descriptions like "write clean code." (2) Placement near the top -agents deprioritize content deep in long files. Put the most critical rules first. (3) Specificity -"use named exports" is followed. "write good components" is ignored.
The standards worth encoding first
Start with the rules that cause the most pain in code review: naming conventions (files, variables, booleans, handlers), import organization, export style (named vs default), TypeScript strictness, and folder structure. These are the violations you catch over and over. Get them into a rules file once.
Quick-start template
A minimal CLAUDE.md / AGENTS.md that covers the most commonly violated conventions.
# Coding Standards
## TypeScript
- strict mode. No `any`. No implicit returns.
- Interfaces for object shapes. Type aliases for unions.
- No enums -use union string literals.
## Components (React)
- Named exports only. NEVER default export a component.
- One component per file.
- Props typed with interfaces placed above the component.
- No anonymous arrow functions as JSX event handlers.
## Naming
- Files: kebab-case (user-profile.tsx)
- Components: PascalCase (UserProfile)
- Hooks: useCamelCase (useAuthState)
- Booleans: isX / hasX / canX (isLoading, hasError)
- Event handler functions: handleX (handleSubmit)
- Event handler props: onX (onSubmit)
- Constants: UPPER_SNAKE_CASE
## Imports
- Absolute imports using @ alias (import { X } from '@/components/X')
- Group: 1) external libraries, 2) internal @/ imports, 3) relative imports.
- No unused imports.
## What Never To Do
- Never use `null` -use `undefined`.
- Never put business logic in route/page files.
- Never commit console.log statements.