Sub topic 14
Structuring a README: title, install, usage, contributing, license
This chapter assumes you can write headings, lists, links, and fenced code blocks in GitHub Flavored Markdown (GFM). It also assumes you know what a project's install and usage steps are. Here you will arrange those pieces into a README that a new reader can act on quickly.
Order sections by the reader's questions
A visitor to a repository asks the same questions in roughly the same order. What is this? How do I install it? How do I use it? Can I help? May I use it? A good README answers them in that order, so the most common needs come first.
| Section | Question it answers | Typical content |
|---|---|---|
| Title and description | What is this? | Project name, optional badge, one sentence |
| Installation | How do I get it? | Commands in a `bash` block, requirements |
| Usage | How do I run it? | A short, working example |
| Contributing | How can I help? | A link to `CONTRIBUTING.md` |
| License | What am I allowed to do? | License name and a link to `LICENSE` |
Write each section
Title and description
Use exactly one # heading for the project name. Follow it with one sentence that says what the project does. Put a badge between them only if it carries useful information, such as build status.
Installation
State requirements first, then give commands the reader can copy. Name the language on each fence so GitHub highlights it.
Usage
Show the smallest example that produces a visible result. Readers judge a project by whether this example runs, so check it before you commit it.
Contributing and license
Keep these short and link to the full files with relative paths. Relative links keep working in forks and on other branches.
A complete skeleton
# Project Name

One sentence describing what the project does.
## Installation
Requires Node.js 18 or later.
npm install project-name
## Usage
import { run } from 'project-name'; run();
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md).
## License
Released under the MIT License. See [LICENSE](LICENSE).Common errors
- Skipping heading levels. Jumping from
#to###breaks the outline GitHub builds from your headings. - Several
#headings. Use one for the title and##for sections. - Untested commands. An install step that fails on a clean machine loses readers at the first hurdle.
- Absolute URLs to your own files. Use
[LICENSE](LICENSE)instead of a fullgithub.comlink. - Starting with history or philosophy. Put background after usage, or in a separate document.
Exercise
A reader opens your repository and sees a long "Background" section before any install commands. Which change fits this chapter's structure, and why?
Show answer
Move the Background section after Usage, or into a separate file, and put Installation and Usage directly after the title and description. Readers most often arrive wanting to install and run the project, so those answers should come first.
Exercise
Why write [LICENSE](LICENSE) rather than a full https://github.com/... URL?
Show answer
A relative link resolves against the current repository and branch, so it still works in forks, on other branches, and after the repository is renamed.