Your AI agent doesn't ignore your coding standards because it's lazy. It ignores them because you never actually told it what they are.
Most teams treat "vibe coding" like a personality trait of the model -Claude writes messy imports, Cursor forgets your file structure, Copilot invents a naming convention nobody asked for. But swap in a properly written CLAUDE.md, .cursor/rules set, or AGENTS.md file, and the same model suddenly writes code that looks like your senior engineer wrote it.
This guide covers everything you need to actually make that happen -for React, Next.js, and TypeScript projects specifically.
What are AI coding standards, and why do agents ignore them without one
An AI coding agent has no memory of your codebase's unwritten rules. It doesn't know you always colocate types next to components, that you ban default exports, or that every API route needs a Zod schema. Without an explicit file telling it these things, it falls back on the most common pattern in its training data — which is rarely your pattern.
💡 A coding standards file (CLAUDE.md, .cursor/rules, AGENTS.md) is the agent's onboarding document. Skip it, and every session starts from zero.
CLAUDE.md vs .cursor/rules vs AGENTS.md -what's actually different (2026 update)
| File | Used by | Status | Format |
|---|---|---|---|
| CLAUDE.md | Claude Code, Claude in IDEs | Active -project-wide, can nest in subfolders | Markdown, freeform |
| .cursor/rules/*.mdc | Cursor | Active -the current format. Replaced the old single .cursorrules file, which still works for backward compatibility but is legacy | Markdown + YAML frontmatter, supports scoped activation (always-apply, auto-attached by file pattern, agent-requested, or manual) |
| AGENTS.md | Codex, Cursor, Jules, GitHub Copilot, Gemini CLI, and a growing list of others | Open, cross-tool standard -now stewarded by the Agentic AI Foundation under the Linux Foundation | Plain markdown, tool-agnostic, no required structure |
A few things worth knowing if you're setting this up today:
- Cursor moved on from
.cursorrules. The old single flat file loaded unconditionally on every request, which wasted tokens on irrelevant context. The.cursor/rules/directory splits rules into scoped.mdcfiles, so your React conventions don't load when you're editing a SQL migration. - AGENTS.md isn't a niche experiment anymore.It's the closest thing the industry has to a universal standard right now, precisely because it's dead simple -plain markdown, no proprietary syntax, readable by a person or an agent.
- Many teams keep one canonical source of truth and generate the tool-specific variants from it (an
AGENTS.mdat the root, with a symlinked or generatedCLAUDE.md/.cursor/rules/main.mdcpointing at the same content) so nothing drifts out of sync between tools.
Core categories every ruleset needs
- Naming conventions -components, files, variables, boolean props (
isLoadingnotloading) - File and folder structure -where components, hooks, utils, types live
- Error handling -how errors are caught, logged, surfaced
- Testing rules -what needs a test, naming pattern, mocking
- State management rules -when to reach for Context vs Zustand
React & Next.js specific conventions
- Server vs Client -be explicit about when
"use client"is actually necessary - Folder structure -feature-based vs type-based -pick one and state it
- Component patterns -one component per file, no inline anonymous functions passed as props
- Data fetching -where fetch happens, handling loading/error states consistently
TypeScript conventions
any without a documented reasonT, TProps, TData)How to enforce rules with an AI agent
Writing the file is half the job. To make an agent actually follow it:
- Keep it under ~300 lines -agents deprioritize instructions buried deep in a huge file
- Use concrete examples, not just descriptions ("do this, not that" beats abstract prose)
- Re-state critical rules near the top -recency and repetition both help
- Periodically test it: ask the agent to write a small feature, check if it followed the rules
Common mistakes teams make
- Writing it once and never updating it as the codebase evolves
- Conflicting instructions -telling the agent to use both Zustand and Context without defining when
- No examples-abstract rules ("write clean code") give the agent nothing to pattern-match
- Making it too long -a 1000-line rules file gets partially ignored; concise beats exhaustive
Generate yours in 3 minutes
Instead of writing this file by hand, StandarX generates a CLAUDE.md / .cursor/rules/*.mdc file tailored to your stack, conventions, and team preferences -ready to drop into your repo.