Agreed-upon conventions that reduce friction and enable collective ownership.
Coding standards are team agreements about how code should be written:
Standards enable collective ownership. When code looks the same everywhere, anyone can read any code. There's no "translation" between Bob's style and Alice's style.
Standards also reduce friction in code review. Instead of debating formatting, you discuss logic and design. The bikeshedding goes away.
Without standards: Every file feels different. Moving between modules requires mental context-switching. Code review becomes style warfare.
With standards: The codebase feels unified. Reading unfamiliar code is easier. Reviews focus on what matters.
The specific standard matters less than having a standard. Pick something reasonable and stick to it.
Not all conventions are equal. Distinguish between:
Semantic standards: Affect code behavior or maintainability
Stylistic standards: Affect appearance only
Semantic standards deserve discussion. How the team handles errors is a meaningful decision with real consequences.
Stylistic standards should be automated. Use Prettier, Black, gofmt—tools that format code automatically. Don't waste human time on tabs vs spaces.
The goal is to remove friction, not to achieve some platonic ideal of code style.
Modern tooling can enforce most standards automatically:
Formatters: Prettier (JavaScript), Black (Python), gofmt (Go), rustfmt (Rust)
Linters: ESLint, Pylint, Clippy, RuboCop
Type checkers: TypeScript, mypy, Flow
Pre-commit hooks: Husky, pre-commit
Configure once, enforce forever. Don't rely on human discipline—automate it.
The team uses Prettier with a shared config. Every commit triggers formatting. Code review never mentions formatting—it just focuses on logic and design.
The team has a 50-page style guide. Reviewers spend half their time pointing out style violations. Developers resent the nitpicking. New team members struggle to learn all the rules.
Standards can trigger strong opinions. Avoid endless debate:
Start with existing conventions. If the language or framework has standard style (Go, Rust), just use it. Don't reinvent.
Use industry defaults. Popular linter/formatter configs (Airbnb ESLint, Google style guide) are battle-tested.
Decide quickly, adjust later. Pick something reasonable. If it proves problematic, change it. Don't block progress waiting for the perfect standard.
Make it democratic but decisive. Let the team vote on contentious issues. Majority wins. The minority accepts the decision.
Remember the goal. Standards exist to reduce friction, not to express preferences. If a discussion is taking too long, any reasonable choice is fine.
Don't Optimize Prematurely
Spending a week debating semicolons is not a good use of time. Pick a formatter and move on.
Standards should be documented—but keep them living:
What to document:
Where to document:
Keep it current. Outdated documentation is worse than no documentation. When you change a standard, update the docs.
Make it findable. New team members should find the standards easily. Don't bury them in a wiki maze.
The best documentation is the code itself. If your standards are enforced automatically, the code demonstrates what's acceptable.