DEV Community

Discussion on: How to write a good README? #discuss

Collapse
 
cjbrooks12 profile image
Casey Brooks

I like to think of a README very much like a college essay. Very formulaic, with a rigid and proven structure, with the intent of getting your idea across as quickly as possible.

While I am by no means an expert (or even really that great at following my own guidelines), here is the general structure I tend to stick with:

  • Introduction
    • Project name and description
    • Badges. Everyone loves badges. They help establish the trust between the project and the end-user. Badges are colorful and catch their eye, and ones like code coverage and build status build reputation. But don't go crazy. Much more than 1 full line of badges on a desktop gets too cluttery, but too few just looks lazy. 3-6 different badges is a good number for me.
    • Close the introduction with a hook, something to get a passerby interested. It might be a screenshot, a video gif with basic functionality, or a very short code snippet. You want this to be the first thing someone notices when scanning your README, which should make them pause and be interested enough to actually read the description above it and spend their precious seconds scrolling to see what's below it.
  • Body
    • Your README is not your documentation. Let me repeat this: Your README is not your documentation. It is an overview of your project, and it should get people interested in using it more.
    • Definitely include a quick-start for the project. The shortest possible example that gets someone fully up-and-running. For a library, it might be how to add the dependency and a minimal integration into an existing project. For a framework, maybe a scaffold command followed by the most basic run command.
    • A brief overview of features. Again, this is not documentation, it is just enough information to get users interested. For each notable feature, a small code snippet might be nice, and links to the full documentation page are a must. A project with a CLI might simply show a few of its commands, a library could do with a high-level overview of its API.
    • Basic configuration. What is the entry-point into tweaking the quick-start example to suit their needs. Again, this is not full documentation, but simply the first place someone should look to start changing stuff. Link back to the full API docs from here.
    • Next steps. After a user has completed the quick-start and has a basic idea of how to work with the API, it's time to lead them toward being a fully dedicated user. Link to the issue tracker, maintainer chat rooms, tags on Stack Overflow, and anything else they will need to keep going back to get get ongoing help or instruction.
  • Conclusion
    • This is the last stuff you want end-users to see. If they made it this far, it's time to bring it all home. This should primarily be targeted at contributors and maintainers rather than end-users, but should be a good reassurance to the end-users of the quality of the project and its development progress. Here are some examples of good things to put in your README conclusion, in no particular order:
    • Project license (although a link to the license is probably better, to keep the README shorter)
    • Contributor guidelines (again, a link is better). Code of conduct, how to set up and build the project for development, that kind of stuff that prospective contributors need to know.
    • References to other projects that inspired or are used in your project. Give credit where credit is due.
    • For small projects, a list of all contributors might be nice, especially in rapidly-growing projects.
    • Who's using this project?

My main point to all of the stuff above is that your README should be a springboard to everything that anyone needs to know about your project. It should primarily work to get new users intersted in trying it out, aid existing users in getting to the right channels for help, and hold the important bookmarks that maintainers will keep coming back to. And above all, Your README is not your documentation, but it should link out to the relevant pages in your full documetation whenever possible.

Collapse
 
jmfayard profile image
Jean-Michel πŸ•΅πŸ»β€β™‚οΈ Fayard

That makes a lot of sense, and I would have probably fallen into the "Your README is not your documentation" trap if you hadn't point it out that clearly. Thanks a lot!

Collapse
 
cjbrooks12 profile image
Casey Brooks • Edited

You're welcome! It's definitely a temptation to use the README for documentation, since it is right there and Github displays it nicely for you. But dumping full docs into a README is just going to make it too huge for a new user to easily scan and they will leave disinterested, and it is too difficult to navigate for existing users to easily find what they need.

Github's Wiki is just as easy to use and gives you proper navigation for small, flat documentation needs. For larger and more complex docs, it's probably better to keep your markdown in the project and integrate it with a static site generator1, so that the release of the project also publishes the docs to Github Pages or something like that. Either way, it's better for everyone than putting it in your README.


  1. Orchid is a great choice of SSG for documentation. It can generate full Java or Kotlin API docs along with wikis and blogs and publish it all to Github Pages automatically, and it integrates seamlessly into your Gradle build
    </shameless-self-promotion> ↩