Skip to content
Back to log

How to create a README structure

Chainabit's Chao · · 7 min read

In short

A README explains what a project does, how to use it, and where to get help. Explore the content and file structure described by GitHub and Open Source Guides.

The scope of a README

GitHub defines a README as a file that shares important information about a project. It is often one of the first things a repository visitor sees. It can explain why the project is useful, what people can do with it, and how they can use it.

According to GitHub, README files commonly contain the following information:

  • What the project does
  • Why the project is useful
  • How users can get started with the project
  • Where to get help
  • Who maintains and contributes to the project

Open Source Guides also notes that a README covers more than usage. The file can explain why the project is important and what users can do with it. The project's goals, how contributions are handled, and license and attribution information can also be included here.

Describe the project and its use

Open Source Guides lists what the project does and why it is useful among the questions a README can answer. GitHub also identifies these two topics as information commonly found in the file. A README can be used to communicate the project's function and benefits to the reader.

What users can do with the project and how they can use it also fall within the scope of a README. Open Source Guides lists the project's goals among the topics that can be explained in the same file. How contributions are handled is another question a README can answer.

According to the guide, a project owner who only wants to show their work may not want to accept contributions. This choice can be stated in the README. If the project is not ready for production, that can also be stated in the file. Open Source Guides lists an unfinished project or a lack of interest in contributions among valid reasons to write a README.

GitHub lists who maintains the project and who contributes to it among the information commonly included in a README. This information can be shared in the same file alongside what the project does and how users can get started.

Include getting started and help information

GitHub lists how users can get started with the project among the information commonly included in a README. Open Source Guides also identifies getting started as one of the questions the file can answer. Such a section addresses how to get started alongside the explanation of what the project does.

Where to get help can also be explained in a README. GitHub lists this information among common topics. Open Source Guides treats where someone who needs help can turn as a question the README can answer.

According to GitHub, a README should contain the information developers need to start using and contributing to the project. It points to wikis for longer explanations. Information needed to get started can be included in the README, while longer explanations can go in the wiki.

Place license and contribution information

According to Open Source Guides, license and attribution information can be covered in a README. How contributions are managed can also be explained in the same file. If contributions are not accepted, stating this is also among the information a README can cover.

GitHub discusses the README alongside the repository license, citation file, contribution guidelines, and code of conduct. According to GitHub, these files communicate project expectations and help manage contributions. The README is part of this structure; the other files cover their respective topics.

Open Source Guides states that an open license allows people to use, copy, modify, and contribute to the project. The guide says that a project published openly should have a license. Information about the license can be provided in the README.

Explain participation steps in the CONTRIBUTING file

According to Open Source Guides, a CONTRIBUTING file tells people how they can participate in a project. It can include how to submit a bug report and propose a new feature. It can also explain how to set up the working environment and run tests.

Alongside technical details, a CONTRIBUTING file can include expectations about contributions. Open Source Guides gives the types of contributions sought as an example. The file can also explain how contributors should or should not communicate with project owners.

Turn this insight into action.

Use the mobile app to continue with guided workflows.

According to the guide, the CONTRIBUTING file can be simple in the early stages of a project. It calls for an explanation of how to report bugs or issues and the technical requirements for contributing, such as required tests. Other frequently asked questions can be added to this file over time.

Open Source Guides recommends linking to the CONTRIBUTING file from the README so that more people can see it. If the CONTRIBUTING file is in the project's repository, GitHub automatically links to it when someone creates an issue or opens a pull request.

According to Open Source Guides, a code of conduct sets ground rules for the behavior of people participating in a project. It explains how participants are expected to behave. The text can also explain who these expectations apply to and when, as well as what to do in the event of a violation.

Open Source Guides recommends placing the code of conduct text in a CODE_OF_CONDUCT file in the repository. It also recommends keeping the file in the project's root directory and linking to it from the README. The README can link to the code of conduct alongside the CONTRIBUTING file.

Determine the README location on GitHub

GitHub recognizes a README file in the repository's hidden .github directory, root directory, or docs directory. It automatically displays a README in one of these locations to repository visitors. Open Source Guides also notes that a README in the root directory automatically appears on the repository home page on GitHub.

If a repository has more than one README, GitHub selects the file to display based on its location. It looks first in the .github directory, then in the repository's root directory, and finally in the docs directory. This order determines which README is displayed to visitors.

A README added to the root directory of a public repository with the same name as the username also automatically appears on the profile page on GitHub. GitHub states that the profile README can be edited using GitHub Flavored Markdown. This file can be used to create a personalized section on the profile.

GitHub automatically generates a table of contents from section headings in the rendered view of Markdown files in a repository. This also applies to README files. The list can be opened through the Outline menu in the upper corner of the README's rendered view.

A section with a heading can be linked to directly. In the rendered file view on GitHub, a link icon appears when hovering over the section heading. Clicking the icon opens the address for that section in the browser.

GitHub states that relative links and image paths can be used in rendered files to navigate to other files in the repository. A relative link is resolved relative to the file containing it. GitHub transforms the link or image path based on the current branch.

In GitHub's example, the following link is used from a README in the root directory to the docs/CONTRIBUTING.md file:

[Contribution guidelines for this project](docs/CONTRIBUTING.md)

According to GitHub, links beginning with / are relative to the repository root directory. Relative link operators such as ./ and ../ can also be used. The link text must be on a single line; GitHub states that an example with the text split across lines will not work.

GitHub recommends using relative links when linking to other files in a repository. Absolute links may not work in clones of the repository. According to GitHub, relative links are easier for users who clone the repository.

The limits of a README

According to Open Source Guides, if a project is not ready for production, this can be stated in the README. If contributions are not accepted, this can also be stated. The guide notes that a README can also be written for an unfinished project.

GitHub places the information needed to start using and contributing to a project in the README and longer explanations in the wiki. The CONTRIBUTING file discussed by Open Source Guides also provides a separate place to explain participation steps, technical requirements, and contribution expectations.

Ready to start?

Download the app and continue from your phone.

End of Entry