Top Related Projects
GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
Style guides for Google-originated open-source projects
JavaScript Style Guide
Standards for developing consistent, flexible, and sustainable HTML and CSS.
Clean Code concepts adapted for JavaScript
Quick Overview
Thoughtbot/guides is a collection of best practices, style guides, and coding conventions for various programming languages and tools. It serves as a comprehensive resource for developers to maintain consistency and quality in their projects, covering topics from Git workflow to specific language guidelines.
Pros
- Comprehensive coverage of multiple languages and tools
- Regularly updated with community input
- Clear and concise explanations of best practices
- Easily accessible and free to use
Cons
- May not align with every team's specific needs or preferences
- Some guides might become outdated if not frequently reviewed
- Can be overwhelming for beginners due to the breadth of information
- Lacks interactive examples or exercises for practice
Getting Started
To use the thoughtbot/guides:
- Visit the GitHub repository: https://github.com/thoughtbot/guides
- Browse the
guides
directory for specific topics - Read the relevant Markdown files for guidelines and best practices
- Implement the recommendations in your projects as needed
For example, to access Ruby style guidelines:
guides/
└── ruby/
└── README.md
Consider bookmarking frequently used guides for quick reference in your development workflow.
Competitor Comparisons
GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
Pros of govuk-frontend
- Comprehensive design system for UK government websites
- Regularly updated with new components and features
- Extensive documentation and examples for implementation
Cons of govuk-frontend
- Focused specifically on UK government needs, less versatile for other projects
- Larger codebase and potentially steeper learning curve
- Stricter adherence to specific design guidelines may limit creativity
Code Comparison
govuk-frontend (SCSS):
.govuk-button {
@include govuk-font($size: 19);
@include govuk-focusable;
@include govuk-link-common;
@include govuk-link-style-default;
display: inline-block;
position: relative;
width: 100%;
margin-top: 0;
}
guides (Ruby):
class ApplicationController < ActionController::Base
include Clearance::Controller
protect_from_forgery with: :exception
end
Summary
govuk-frontend is a comprehensive design system for UK government websites, offering a wide range of components and extensive documentation. However, it's specifically tailored for government use and may be less flexible for other projects. guides, on the other hand, provides a set of best practices and style guides for various programming languages and tools, making it more versatile for different types of projects but less focused on specific design implementations.
Style guides for Google-originated open-source projects
Pros of styleguide
- Covers a wider range of programming languages, including C++, Java, Python, and more
- Provides more detailed and specific guidelines for each language
- Includes tools and linters for automated style checking in some languages
Cons of styleguide
- Less focus on general best practices and principles
- Updates and maintenance may be less frequent
- Some guidelines may be specific to Google's internal practices
Code Comparison
styleguide (Python):
def SampleFunction(a, b):
"""A sample function that does nothing."""
return
guides (Ruby):
def sample_function(a, b)
# A sample function that does nothing
end
Both repositories provide coding style guidelines, but they differ in scope and approach. styleguide offers more language-specific rules, while guides focuses on broader principles and practices across fewer languages.
styleguide is more comprehensive for the languages it covers, providing detailed rules and examples. However, guides offers a more holistic approach to software development, including topics like code review, git usage, and team communication.
The code examples show differences in naming conventions and comment styles between the two guides. styleguide follows Google's internal conventions, while guides adheres to community-standard Ruby practices.
Ultimately, the choice between these repositories depends on the specific needs of the development team and the languages they use most frequently.
JavaScript Style Guide
Pros of javascript
- More comprehensive JavaScript-specific guidelines
- Regularly updated with modern ECMAScript features
- Includes ESLint configuration for easy implementation
Cons of javascript
- Focused solely on JavaScript, lacking guidance for other languages or technologies
- May be overwhelming for beginners due to its extensive nature
Code Comparison
javascript:
// bad
const items = new Array();
// good
const items = [];
guides:
# bad
items = Array.new
# good
items = []
Summary
javascript provides in-depth JavaScript style guidelines with modern best practices and tooling support. guides offers a broader range of language and technology recommendations but with less depth in specific areas. javascript is ideal for JavaScript-focused projects, while guides is better suited for teams working across multiple languages and technologies. Both repositories aim to improve code quality and consistency, but with different scopes and levels of detail.
Standards for developing consistent, flexible, and sustainable HTML and CSS.
Pros of Code Guide
- More focused on front-end development, providing specific guidelines for HTML and CSS
- Includes visual examples to illustrate best practices
- Regularly updated with modern web development standards
Cons of Code Guide
- Less comprehensive in scope, primarily covering HTML and CSS
- Lacks guidelines for other programming languages and development practices
- Does not include community contributions or discussions
Code Comparison
Code Guide example (HTML):
<nav class="navbar">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
Guides example (Ruby):
class User < ApplicationRecord
validates :name, presence: true
validates :email, presence: true, uniqueness: true
has_many :posts
end
Summary
Code Guide is more specialized for front-end development, offering detailed HTML and CSS guidelines with visual examples. Guides, on the other hand, provides a broader set of best practices for various programming languages and development workflows. While Code Guide excels in its focused approach, Guides offers a more comprehensive resource for full-stack development teams.
Clean Code concepts adapted for JavaScript
Pros of clean-code-javascript
- Focuses specifically on JavaScript best practices and clean code principles
- Provides detailed explanations and examples for each concept
- Regularly updated with modern JavaScript practices
Cons of clean-code-javascript
- Limited to JavaScript, while guides covers multiple languages and technologies
- Less comprehensive in terms of overall software development practices
- Lacks team-oriented guidelines and workflow recommendations
Code Comparison
clean-code-javascript example:
// Bad
const locations = ['Austin', 'New York', 'San Francisco'];
locations.forEach((l) => {
doStuff();
doSomeOtherStuff();
// ...
// ...
// ...
dispatch(l);
});
// Good
const locations = ['Austin', 'New York', 'San Francisco'];
locations.forEach((location) => {
doStuff();
doSomeOtherStuff();
dispatch(location);
});
guides example (Ruby):
# Bad
def some_method
do_something
do_something_else
do_another_thing
do_yet_another_thing
end
# Good
def some_method
do_something
do_something_else
end
def another_method
do_another_thing
do_yet_another_thing
end
Both repositories provide valuable insights into writing clean, maintainable code. clean-code-javascript offers in-depth JavaScript-specific guidelines, while guides covers a broader range of languages and development practices. The choice between them depends on your specific needs and the technologies you're working with.
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Guides
Guides for working together, getting things done, programming well, and programming in style.
High level guidelines
- Be consistent.
- Don't rewrite existing code to follow this guide.
- Don't violate a guideline without a good reason.
- A reason is good when you can convince a teammate.
A note on the language
- "Avoid" means don't do it unless you have good reason.
- "Don't" means there's never a good reason.
- "Prefer" indicates a better option and its alternative to watch out for.
- "Use" is a positive instruction.
Guides by category
Collaboration
Protocols
Languages
- Bash
- CoffeeScript
- CSS
- Elixir
- ERB
- HAML
- Handlebars
- Haskell
- HTML
- Java
- JavaScript
- Objective-C
- Python
- Ruby
- Sass
- Scala
- Shell
- Swift
- TypeScript
Frameworks and platforms
Tools
Contributing
Please read the contribution guidelines before submitting a pull request.
In particular: if you have commit access, please don't merge changes without waiting a week for everybody to leave feedback.
Credits
Thank you, contributors!
License
Guides is © 2020-2024 thoughtbot, inc. It is distributed under the Creative Commons Attribution License.
About thoughtbot
This repo is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.
We love open source software! See our other projects. We are available for hire.
Top Related Projects
GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
Style guides for Google-originated open-source projects
JavaScript Style Guide
Standards for developing consistent, flexible, and sustainable HTML and CSS.
Clean Code concepts adapted for JavaScript
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot