Docs and READMEs

Play this lesson

Who wrote this, and why?

Six months after building the Garden Defense shop, Kai opens shop.js and finds this:

price = price * 0.85; // change price

Why 0.85? A sale? A bug? Kai wrote it and can't remember. Meanwhile, you just cloned the repo (downloaded your own copy) and can't even find how to start the game.

Documentation, or docs, is the writing that explains a project: how to run it, how it's organised, and why it was built this way. Code tells the computer what to do. Docs tell people, and AI agents, why.

Who reads the docs?

Bolt says: A CLAUDE.md can point to the README by writing @README, so Claude Code loads it at the start of each session. The facts stay in one file instead of two.

Quick check

Kai and Remy talk every day, so docs are only worth writing once the studio gets bigger.

Show the answer

False

Future Kai is a different reader from today's Kai, and every new teammate and AI agent starts from zero. A short README written today saves hours of questions later.

The README: the front door

A README is the first file to read in a project, usually README.md at the top of the repo. GitHub shows it on the repo's front page automatically. Ours answers five questions:

Markdown in two minutes

README.md ends in .md because it's written in Markdown: plain text with a few symbols that turn into formatting. John Gruber created it in 2004, and GitHub, Discord and Claude all use it.

GitHub shows the formatting. The editor shows the symbols, and it still reads well.

Read the README

README.md
# Hyper ShardsA space shooter PWA, built with PixiJS. ## Run it```npm installnpm run dev``` ## Where things live- `src/` game code- `balance.json` all the numbers

You clone Hyper Shards and read this README. Before your first pull request, what is missing that you need?

  1. How to run the tests
  2. The name of the game
  3. How to start the dev server
Show the answer

How to run the tests

Line 1 names the game, and lines 5 to 8 give the dev server commands in a code block. Nothing says how to test, so you can't check your change before the robot does. A ## Test it section with npm test fixes that.

Comments say why, not what

A comment is a note in the code that the computer skips, after // in JavaScript. Kai's // change price only repeats what the code already says. A good comment explains what the code can't: the reason, the trade-off, the warning.

// Weekend sale: 15% off seeds, agreed in #48.
// Remove when the sale ends.

When a comment only explains what, try a better name instead. calc2() needs a comment. applyWeekendSale() doesn't.

Comment pick

Which comment above const maxBounces = 3; in lasers.js is worth keeping?

  1. // set maxBounces to 3
  2. // More than 3 bounces filled the screen and dropped phones below 60 FPS in playtests (#42)
  3. // laser stuff
Show the answer

// More than 3 bounces filled the screen and dropped phones below 60 FPS in playtests (#42)

It says why the number is 3 and where the decision was made, which the code can't say. The first only repeats the code, and the last tells nobody anything.

Docs live next to the code

Docs on a forgotten website, or only in someone's head, go out of date. So we keep them in the repo: the README at the top, longer guides in a docs/ folder, all in Markdown.

Then docs change in the same pull request as the code. Renaming npm run dev to npm start? Update the README in that PR, and the reviewer checks it. A README with the wrong command can waste more time than no README at all.

Write each fact in one place, and link to it from everywhere else. Two copies of a fact drift apart.

A changelog for every version

A CHANGELOG.md lists the notable changes in each version, newest first. A popular convention, Keep a Changelog, sorts them under headings like Added, Changed, Fixed and Security, with an Unreleased section at the top that fills up as pull requests merge.

## [1.2.0] - 2026-10-09
### Fixed
- The ship can shoot again after the pause menu.

It is written for people, not machines. Turning it into patch notes for players is a Stage 9 lesson: Version numbers and patch notes.

Bolt says: Docs say what the code should do. Next lesson: tests, small programs that check it really does.

Fact-checked 9 October 2026