How to Write a Good README: Sections, Badges and Install Steps
What a useful README contains, how to order its sections, add shields.io badges, install commands and a table of contents, and export a clean README.md.

How to Write a Good README: Sections, Badges and Install Steps
The README is the front door of a project. On GitHub, GitLab and package registries it is the first thing a visitor sees, and many people decide within a minute whether to try a library or move on. A good README does not need to be long. It needs to answer a few questions quickly: what is this, how do I install it, how do I use it, and under what terms. This guide covers what to include, how Markdown features like badges and tables of contents work, and how to assemble the file with a free generator.
What readers look for first
Readers scan from the top. A practical order is:
- Title and tagline – one sentence that says what the project does and for whom.
- Badges – version, build status and licence at a glance.
- Installation – the exact command for each supported package manager.
- Usage – a minimal working example someone can copy.
- Configuration – options, defaults and types, often as a table.
- Contributing, licence and support – how to help and what the terms are.
Optional sections such as a roadmap, FAQ, screenshots or a security policy are useful once the basics are solid. Put the essentials first; long background stories belong further down or in separate docs.
How badges work
Most README badges are images served by shields.io. A badge URL either asks shields.io to look up live data, such as the latest npm or PyPI version or the status of a GitHub Actions workflow, or describes a static badge with a label, message and colour. In static badge paths, a hyphen separates the parts, so hyphens and underscores inside your own text must be doubled. A workflow badge needs the workflow file name, such as ci.yml.
Tables of contents and anchors
GitHub generates an anchor for every heading. It lowercases the text, removes most punctuation and replaces spaces with hyphens; if two headings have the same text, the second gets -1, the third -2. A table of contents is simply a list of links to those anchors. It is worth adding once a README has more than four or five sections.
Building the README with the tool
Open the README and Documentation Generator and fill in the project details: name, tagline, GitHub owner, repository and package name. These values feed the badges and install commands.
Next, add badges. Pick from npm version, PyPI version, GitHub Actions status, GitHub licence, GitHub stars or a custom static badge. For static badges, enter the label, message and colour and the tool escapes the text for the shields.io path.
The section list is the heart of the editor. Every section has a title, an on/off switch and a Markdown body. Press Edit to open the body and use the arrows to reorder. Templates add starter text for FAQ, roadmap, screenshots, acknowledgements, support, security and development sections. In the Installation section, buttons insert ready-made blocks for npm, pnpm and yarn, pip, cargo, go get, docker run or cloning from source, filled with your names. A tips list warns when installation, usage, licence or a tagline is missing.
Switch on the table of contents to place a linked list of all ## and ### headings after the tagline. Then open Preview to read the rendered page, and README.md to copy or download the exact file.
Worked example
Imagine a small invoicing library called invoice-kit published by acme. You add npm version, Actions status and licence badges, switch on six sections and enable the table of contents. The output starts with the title, a single line of three badges and the tagline, followed by a six-entry contents list. Installation shows npm, pnpm and yarn commands with invoice-kit filled in, Usage holds a short JavaScript example you wrote, and Configuration is a three-row table of options. You then run the install command yourself in a clean folder to confirm it works.
Tips and common mistakes
- Test every command and code sample in a fresh environment; outdated examples are the most common README bug.
- Keep the usage example minimal. Link to fuller docs for advanced cases.
- Use relative links for files inside the repository so they work on forks.
- State the licence by name and include a
LICENSEfile; a badge alone is not enough. - Add alt text to screenshots so the README remains useful to screen-reader users.
Limits
The generator does not read your source code, so commands, options and examples are only as accurate as what you type, and you must check them. Badge images are requested from shields.io by the viewer's browser when the README is displayed on GitHub, not by this page. The preview uses a safe renderer that shows raw HTML as text, and platform-specific features such as GitHub alerts or Mermaid diagrams are kept in the file but not previewed.



