7 Best Official Style Guides by Language, and Why They Exist
Key takeaways
- A published style guide saves a team from writing its own and gives new members a reference they may already know.
- PEP 8, Effective Go and the Kotlin coding conventions come from the language maintainers, so they set the baseline most code follows.
- The Google Style Guides and the Airbnb JavaScript Style Guide are company guides that became widely adopted outside their origin.
- The best guides explain the reason behind each rule, and most pair with a tool that enforces them automatically.
What style guides are for
A style guide records decisions so that people stop remaking them. Naming, layout, comments, error handling, how to structure a module: each one is a small choice, but a codebase with fifty different answers is slow to read and easy to break. The convention of writing these choices down is old.
The guides below are all free to read online. Some are official, written by the people who maintain the language. Others come from organisations whose internal rules proved useful enough to be adopted widely. The practical advice is to adopt one rather than invent your own, then record a short list of local exceptions. A guide that matches what formatters and linters already enforce gives you the most value for the least argument.
Quick comparison
| Tool | Best for | Starting price | Free plan |
|---|---|---|---|
| Google Style Guides | Teams working across many languages | Free | Yes |
| PEP 8 | Every Python project | Free | Yes |
| Airbnb JavaScript Style Guide | JavaScript teams wanting a detailed rule set | Free | Yes |
| Effective Go | Learning idiomatic Go | Free | Yes |
| Rust API Guidelines | Authors of public Rust crates | Free | Yes |
| The Ruby Style Guide | Ruby and Rails teams | Free | Yes |
| Kotlin coding conventions | Kotlin on the JVM and Android | Free | Yes |
The best official style guides by language
1. Google Style Guides
- Official site: https://google.github.io/styleguide/
- Best for: Teams working across many languages
- Starting price: Free
- Free plan: Yes
- Pros: Covers C++, Java, Python, JavaScript, TypeScript, Shell and more in one place; Rules come with stated reasons
- Cons: Some rules reflect Google's own tooling and scale; Each guide has a different depth
Google publishes the style guides it uses for its open source projects on a single site. The collection covers C++, C#, Java, Python, JavaScript, TypeScript, Shell, HTML and CSS, Objective-C, R and more, with links to related guides for Go, Kotlin, Swift and Dart.
The guides work well for organisations that use several languages and want one consistent source. The C++ guide in particular explains the reasoning behind its choices, which makes it useful even for teams that disagree. The limit is context: some rules exist because of Google's build systems and code size, so read them as strong defaults rather than universal truths.
2. PEP 8
- Official site: https://peps.python.org/pep-0008/
- Best for: Every Python project
- Starting price: Free
- Free plan: Yes
- Pros: The official Python style reference; Supported by nearly every Python linter and formatter
- Cons: Leaves some choices open; Line length advice is often adjusted by teams
PEP 8, the Style Guide for Python Code, is the Python Enhancement Proposal that sets conventions for the code in the Python standard library, and it has become the reference for Python code in general. It covers indentation with four spaces, maximum line length, imports, whitespace, naming conventions and comments.
Its best-known section warns that a foolish consistency is the hobgoblin of little minds, and says consistency within a project matters more than consistency with the guide. Formatters like Black follow it closely but adjust a few points, such as line length, so many teams treat PEP 8 as the base and the formatter as the final word.
3. Airbnb JavaScript Style Guide
- Official site: https://github.com/airbnb/javascript
- Best for: JavaScript teams wanting a detailed rule set
- Starting price: Free
- Free plan: Yes
- Pros: Very detailed, with good and bad examples for each rule; Matching ESLint configs make it enforceable
- Cons: Opinionated choices not every team shares; Parts focus on older JavaScript patterns
The Airbnb JavaScript Style Guide calls itself a mostly reasonable approach to JavaScript. It is a long document on GitHub covering references, objects, arrays, destructuring, strings, functions, modules, naming and much more, with code samples showing what to do and what to avoid. There is also a companion guide for React and JSX.
Its biggest practical advantage is the eslint-config-airbnb package, which turns much of the guide into lint rules. It suits teams that want a strict, ready-made standard. The limit is that it is one company's opinion, and some teams find it stricter than they need.
4. Effective Go
- Official site: https://go.dev/doc/effective_go
- Best for: Learning idiomatic Go
- Starting price: Free
- Free plan: Yes
- Pros: Written by the Go team; Explains the reasoning behind Go idioms
- Cons: Not updated for newer language features; Not a rule-by-rule checklist
Effective Go is the Go project's guide to writing clear, idiomatic Go. It covers formatting, commentary, names, control structures, functions, data, methods, interfaces, embedding, concurrency and errors, and it explains why Go code looks the way it does, starting with the decision to let gofmt handle layout.
It is the right first read for developers coming to Go from another language. The page itself notes that it was written for Go's release in 2009 and has not been significantly updated, so it does not cover modules, generics or newer tooling. Pair it with the Go Code Review Comments wiki and the standard library source for current practice.
5. Rust API Guidelines
- Official site: https://rust-lang.github.io/api-guidelines/
- Best for: Authors of public Rust crates
- Starting price: Free
- Free plan: Yes
- Pros: Checklist format with an identifier for each guideline; Focus on public API design, not only layout
- Cons: Aimed at library authors more than application code; Assumes comfort with traits and generics
The Rust API Guidelines are recommendations on how to design and present APIs for Rust, authored largely by the Rust library team. They cover naming, interoperability, documentation, predictability, flexibility, type safety, dependability and future proofing, with a checklist that links to each guideline.
Layout is handled by rustfmt, so this guide addresses the conventions a formatter cannot: how to name conversion methods, which common traits to implement, how to document errors and panics. It is most useful for crate authors who publish to crates.io. Application developers will find parts of it more than they need.
6. The Ruby Style Guide
- Official site: https://rubystyle.guide/
- Best for: Ruby and Rails teams
- Starting price: Free
- Free plan: Yes
- Pros: Community-maintained with explained rationale; RuboCop enforces it directly
- Cons: Long enough to be hard to absorb in one sitting; Some rules invite debate
The Ruby Style Guide is a community document that collects best practices so that real-world Ruby programmers can write code other Ruby programmers can maintain. It covers layout, naming, flow of control, methods, classes and modules, exceptions, collections and strings, with examples throughout.
Its close link with RuboCop is the main advantage, since RuboCop is a linter and formatter based on this guide, so most of it can be enforced automatically. It suits any Ruby team, from small scripts to Rails applications. The length can be a barrier, and teams typically adopt the guide through RuboCop defaults and then tune rules they disagree with.
7. Kotlin coding conventions
- Official site: https://kotlinlang.org/docs/coding-conventions.html
- Best for: Kotlin on the JVM and Android
- Starting price: Free
- Free plan: Yes
- Pros: Official guidance from the Kotlin documentation; IntelliJ IDEA can apply the code style automatically
- Cons: Shorter than some company guides; Android teams may also follow a separate Android guide
The Kotlin coding conventions are part of the official Kotlin documentation. They cover source code organisation, naming rules, formatting, documentation comments, avoiding redundant constructs and idiomatic use of language features such as immutability, default parameters and scope functions.
IntelliJ IDEA and Android Studio can apply this code style through their formatter, and the documentation links a migration guide for older projects. It suits any Kotlin codebase. Android teams should also check the Android Kotlin style guide, which builds on similar ideas with a few extra rules.
How they differ
Language-owned guides such as PEP 8, Effective Go and the Kotlin conventions set a baseline for a whole community. Company guides such as Google's and Airbnb's are stricter and more detailed. The Rust API Guidelines stand apart because they focus on API design rather than formatting, while the Ruby Style Guide is maintained by the community and tied closely to its linter.
How to choose
Start with the language-owned guide where one exists, then add a stricter guide only if the team wants more detail. Python teams adopt PEP 8, Go teams read Effective Go and let gofmt handle the rest, and Kotlin teams follow the official conventions. JavaScript teams can choose between the Google and Airbnb guides, preferably through an ESLint config. Rust library authors should work through the API Guidelines checklist. Whichever you pick, link it from your contributing file and enforce what you can with tools.
How we chose
We selected guides that are published by language maintainers or widely adopted organisations, are free to read, and explain their reasoning. Our comparison relied on official project pages and public documentation. We did not survey teams or run our own comparisons.
FAQ
Should a team write its own style guide?
Usually not from scratch. Adopt a published guide and keep a short document of local exceptions.
Is PEP 8 mandatory for Python code?
No. It is the convention for the standard library and widely followed, but the guide itself says project consistency comes first.
Which JavaScript style guide is best?
There is no single official guide. Airbnb and Google both publish detailed guides, and the right one is the one your team will enforce through ESLint.
Is Effective Go still worth reading?
Yes, for the reasoning behind Go idioms. It does not cover newer features, so pair it with current Go documentation.
Do style guides replace linters and formatters?
No. Guides explain the rules and the reasons, and tools apply them on every change.