Left to itself, your agent writes each new file in whatever style feels right that session: camelCase here, snake_case there, one file with tabs and the next with spaces. Each piece works, but the codebase reads like five people who never met wrote it. This chapter gets you one consistent hand across the whole project, enforced by a file, not by your memory.
3.7.1Pick one way and keep it
A convention is a decision you make once and then repeat everywhere: quote style, indentation, how files are named, how a boolean reads. Which way you pick matters far less than picking one and never drifting. Two reasonable styles applied consistently beat one perfect style applied half the time.
The purely mechanical decisions (spacing, quotes, trailing commas) you should not decide by hand at all. A formatter like Prettier rewrites every file to one layout on save, and a linter like ESLint flags the rest, so that whole category stops being a discussion.
3.7.2Names that read as one hand
Naming is where a codebase either reads like one author or like a committee. Variables and functions, the named blocks of code you call to do one job, go in camelCase. The other standard buckets are worth adopting as-is: types and components in PascalCase, filenames in kebab-case, constants in UPPER_SNAKE_CASE. Booleans start with is, has, should, or can, so they read like a yes-or-no question.
| Category | Inconsistent | Consistent |
|---|---|---|
| Function | GetUser, fetch_user | getUser, fetchUser |
| Boolean | active, loaded | isActive, hasLoaded |
| File | UserCard.tsx, user_card.tsx | user-card.tsx |
3.7.3Write the conventions down
Rules you only hold in your head get applied when you remember and skipped when you do not. Put them in the rules file your agent already reads every session, so it writes to them from the first line instead of you correcting them after.
Keep it short and concrete, the kind of block you can paste straight in:
3.7.4Consistency beats personal taste
Your preference for single quotes is not worth a codebase split down the middle. Once a convention is written, treat it as settled and let the agent apply it everywhere, including code you would have styled differently. The value is uniformity, not being right.
This prompt has your agent record your conventions and follow them from now on:
Do this now: paste the prompt so your agent writes the conventions into your rules file, then read the choices it made and change any single one you disagree with.