README.md:what it is, what to write, and a template to copy.
Every project needs a README. Here is what goes in it, a template you can copy, and how to check it before you push.
macOS 14 or later. Reading is free; editing and reviews are one payment.
Quick answer
A README.md is the Markdown file at the top of a project that explains what it is and how to use it, and GitHub shows it on the repository's front page. Put in the name, a one-line description, install steps, usage, configuration, contributing and the license. Start from the template below.
# Project name
One sentence on what it does.
## Install
## Usage
## License
·
What README.md is
A README is a Markdown file that tells a reader what a project is and how to start. The usual name is README.md, written in capitals, and it sits at the top of the project. GitHub looks for it in the hidden .github folder, the root of the repository or a docs folder, and shows the first one it finds in that order. It displays the rendered README on the repository's front page. Rendered READMEs are cut off after 500 KiB.
What to write in a README
GitHub's guidance is that a README says what the project does, why it is useful, how to get started, where to get help, and who maintains it. In practice that gives these sections:
- Name and one-line description. A reader decides in a few seconds whether this is for them.
- Install. The exact commands, in a code block.
- Usage. One short, working example.
- Configuration. Options and defaults, a table works well.
- Contributing. How to report a bug and how to run the tests.
- License. One line and a link.
Keep the README to what a person needs to start. Longer documentation belongs in a docs folder or a wiki.
A README.md template to copy
Copy this into a new README.md and replace the example text.
# Project name
One sentence on what it does and who it is for.
## Install
```bash
npm install project-name
```
## Usage
```js
import { run } from "project-name";
run("example");
```
## Configuration
| Option | Default | Description |
|---|---|---|
| `port` | `3000` | Port to listen on |
## Contributing
How to report a bug, how to run the tests, and where to send a pull request.
## License
Name of the license, and a link to the LICENSE file.
README.md, AGENTS.md and CLAUDE.md
The README is written for people. AGENTS.md and CLAUDE.md are instructions for coding agents: commands to run, style rules, folders to avoid. Keep them apart. A README that is full of agent rules is harder for a person to read, and agent files that repeat the README go out of date twice as fast. See CLAUDE.md vs AGENTS.md.
Preview a README before you push
A broken table or a missing image is easier to fix before the commit than after. On a Mac, open the README in DotMD: it shows the file rendered like on GitHub, with tables, code, task lists and Mermaid diagrams, and reading is free. Press ⌘O and choose the file, or the project folder. See Reading Markdown.
Common mistakes
- Broken relative links and images. GitHub adjusts relative paths to the branch being viewed, so prefer them to full URLs. A link that starts with a slash resolves from the repository root. Check the file name case, and keep link text on one line.
- A wall of badges. A long row of status images pushes the description down. Keep the few that a reader uses.
- No install steps. A project that cannot be started from the README is not documented.
- An example that no longer runs. Run the code in the README each time the project changes.
GitHub builds an outline from the headings, so use real heading levels and not bold lines. See Markdown images and Markdown tables for the syntax.
When an AI agent writes the README
Agents write and update READMEs often, and they sometimes invent commands or options. Read the result rendered, comment on each passage that is wrong, and let the agent fix it before you accept the change. See Technical writers.
Questions about README.md
What is a README.md file?
A Markdown file at the top of a project that explains what the project is and how to use it. GitHub renders it on the repository's front page.
Where does GitHub look for a README?
In the .github folder, the root of the repository or a docs folder. If there are several, it shows the one in .github first, then the root, then docs.
What should a README contain?
What the project does, why it is useful, how to get started, where to get help, and who maintains it. Install, usage and license sections cover most of that.
Is README.md the same as AGENTS.md or CLAUDE.md?
No. The README is for people. AGENTS.md and CLAUDE.md are instructions for coding agents.
How do I preview a README before I push?
Open it in a Markdown viewer that renders like GitHub. On a Mac, DotMD does this, and reading is free.