The Package README, Section by Section
For most people, your README is the package. It is what the registry page displays, what search results quote and what someone skims before deciding whether to depend on your code. A good one answers the reader's questions in the order they ask them. This guide gives that order, with notes on what to include and what to cut.
The first screen
A reader decides within a few lines whether to keep reading. Put these at the top:
- Name and one sentence saying what the package does, in plain words. "Parses ISO 8601 durations into objects", not "a blazing-fast, modern duration solution".
- Install command for each ecosystem you publish to.
- The smallest useful example, five to ten lines, that a reader can paste and run.
npm install example-duration
import { parse } from "example-duration";
const d = parse("P1DT2H");
console.log(d.hours); // 2
Badges are optional. If you use them, keep to ones that carry information, such as CI status and the latest version, and drop decorative ones.
The middle: what an adopter needs
| Section | What to write |
|---|---|
| Compatibility | Supported runtime versions (Node.js, Python, Go, Rust MSRV), module formats (ESM, CJS) and platforms |
| Usage | Three or four common tasks, each with a short example and expected output |
| Configuration | Every option, its type and default; a table works well |
| Errors | The error types callers should catch and what each means |
| Stability | Your versioning policy: semver, what counts as public API, how long old majors get fixes |
The stability section is the one most often missing and the one dependency reviewers look for. Even two sentences help: "This package follows Semantic Versioning. Anything not exported from the package root is internal."
The end: links and housekeeping
- Link to the changelog rather than pasting release notes into the README.
- Link to full API documentation if it is generated separately.
- Point to
CONTRIBUTING.md,SECURITY.mdand the code of conduct. - State the licence by its SPDX identifier and link to the licence file.
Registry rendering quirks
Each registry renders the README a little differently. Relative links and images may break when the README is shown on a registry page rather than in the repository, so use absolute URLs for images. On PyPI, the long description comes from the readme field in pyproject.toml; run twine check to confirm it renders. On npm, the README in the published tarball is the one displayed, so a fix only appears after the next publish.
What to leave out
Long feature comparisons with competitors age badly and invite arguments. Roadmaps go stale. Usage counts and walls of adopter logos are hard to keep accurate. A README that is short, current and runnable beats a long one that is half out of date. Review it at every major release, the same way you review code.
See also the changelog entry how-to and the contributor guideline files directory.