Documentation for Open Source Projects
Documentation as a Contract
Documentation sets expectations between a project and its users. Installation steps describe a supported path; API references define observable behavior; contribution guides explain how proposed changes enter the project. If these statements drift from the implementation, users lose time and contributors make unsafe assumptions.
Start with Reader Tasks
Identify the reader and the task before choosing a document. A new user needs a short path to a successful first run. A contributor needs local setup, tests, review rules, and a clear way to ask questions. An operator needs deployment, configuration, backup, and recovery procedures. Keep each path close to the point where the reader needs it.
Choose a Source of Truth
Write each fact once when practical. Generate API references from maintained source annotations or schemas rather than copying signatures into a second manual. Link to the canonical policy or procedure instead of maintaining near-duplicate versions that will diverge.
Designing a Useful README
A README is the project's front door, not a full manual. It should answer what the project does, who it serves, how to evaluate it, and where to continue reading. The GitHub README guidance describes how repository hosts present this entry document.
Order Information by First Use
Lead with a precise summary, then provide prerequisites, a minimal installation path, a verified first-use example, and links to detailed guides. Move badges and project history below the information needed to try the software.
This excerpt shows a compact README flow. The HTML comments explain the purpose of each section to the author; remove them if the published README should contain only reader-facing prose.
<!-- State the user problem and supported audience in one or two sentences. -->
# Queue Inspector
Queue Inspector displays delayed jobs from a local development queue.
<!-- List only prerequisites required by the verified setup path. -->
## Requirements
- Node.js 20 or later
- A local Redis-compatible service
<!-- Keep these commands synchronized with package.json scripts. -->
## Run locally
npm install
npm test
npm run dev
<!-- Link to the full guide instead of copying every option here. -->
See [configuration](docs/configuration.md) for connection settings.
Verify Every Quickstart
Run README commands in a clean checkout or a reproducible environment. A command that succeeds only because of an undeclared global tool, a developer's local file, or a service that was never started is not a valid quickstart. State whether a step is for development, testing, or production.
Contributor Guides
A contributor guide turns project expectations into a repeatable path. Keep it welcoming and concrete: document the repository layout, supported runtime, setup, test commands, branch or pull request conventions, and the maintainer's review process. The GitHub contributor guidelines can be used as a checklist, but adapt them to the project's actual workflow.
Make the Local Workflow Reproducible
Show a sequence that a first-time contributor can follow without guessing. Commands should use the repository's real scripts and must not imply that tests pass when they were not run.
This shell excerpt separates setup, a focused change, and verification. Comments identify which values must be replaced with the repository's actual URL and commands.
# Replace this URL with the project's canonical public repository.
git clone https://github.com/example/queue-inspector.git
cd queue-inspector
# Install the runtime versions documented by the project.
npm ci
# Create a focused branch so the pull request has one reviewable purpose.
git switch -c docs/improve-install-guide
# Run the checks required by CONTRIBUTING.md before opening a pull request.
npm test
npm run lint
Document Policies and Templates
Put contribution instructions in CONTRIBUTING.md and place issue, pull request, and security-report templates where the hosting platform discovers them. State how to report a vulnerability privately; public issue templates are not an appropriate channel for undisclosed security details. Link to the project's code of conduct and explain how to contact maintainers about enforcement.
Guides and Reference Material
Separate task-oriented guides from reference material. A guide walks a reader through a goal; a reference gives exact options, types, defaults, and constraints for lookup. The Diataxis framework offers a vocabulary for distinguishing tutorials, how-to guides, explanations, and reference documentation.
Keep Reference Details Exact
For a command-line interface, document every supported option, its default, valid values, and interactions. For an API, document input and output types, errors, side effects, stability guarantees, and examples for boundary cases. Avoid vague statements such as “handles errors gracefully” when callers need to know which errors are returned or thrown.
Version Documentation with Behavior
When a release changes an option or public interface, make the documentation change in the same review as the implementation. For maintained release branches, make it clear which version a page describes and avoid sending users of older releases to unversioned instructions that no longer apply.
Changelogs and Release Notes
A changelog helps users understand meaningful changes between releases. It is not a raw commit log: group entries by user-visible effect, identify breaking changes, and explain the action a user may need to take. The Keep a Changelog format provides a practical structure.
Write Actionable Entries
Use concise entries that name the affected behavior and its impact. Include a migration note when users must change configuration or code. Do not claim a feature, fix, or security improvement that is not present in the release.
This changelog excerpt demonstrates categorized, user-facing entries. The comments are authoring guidance and should be removed from a published release note.
# Changelog
## [Unreleased]
### Added
<!-- Describe the capability and where users can find it. -->
- Added a `--format json` option to the queue inspection command.
### Fixed
<!-- State the defect and the corrected observable behavior. -->
- Preserve jobs whose retry count is zero when exporting a queue.
## [2.1.0] - 2026-10-20
### Changed
<!-- Put a migration instruction next to any breaking change. -->
- Renamed `QUEUE_URL` to `QUEUE_ENDPOINT`; update deployment settings before upgrading.
Align Notes with Versioning
Use a consistent release policy and distinguish breaking changes from compatible fixes and additions. Semantic Versioning defines a common contract for projects that publish a public API. If the project uses another versioning scheme, explain how users should interpret it.
Review and Validate Documentation
Documentation changes deserve the same review discipline as code. Check that examples compile or run, links resolve, commands match current scripts, and terminology is consistent. Prefer automated checks for mechanical errors so human reviewers can focus on correctness and reader comprehension.
Add Appropriate Automated Checks
Markdown linting catches formatting issues, link checking finds stale destinations, and documentation builds reveal broken references or invalid syntax. Treat external network checks carefully: make them retryable or schedule them separately when transient outages would otherwise block unrelated changes.
Use a Documentation Review Checklist
- Does the page identify its audience, prerequisites, and intended outcome?
- Are commands, defaults, version numbers, paths, and links current?
- Can a reader follow the procedure from a clean environment?
- Are security-sensitive steps clearly scoped and safe to perform?
- Does the change update related examples, navigation, and release notes?
Documentation Practice Lab
Improve a small project's onboarding without rewriting its entire manual. Work from a clean clone and make each change verifiable by another contributor.
Audit the README
- List the first three tasks a new user needs to complete.
- Run every documented setup and test command in a clean environment.
- Record missing prerequisites, undocumented environment variables, and stale links.
- Rewrite the quickstart so each step has an observable success condition.
Submit a Reviewable Documentation Change
- Add or correct one section in the README, contributor guide, or changelog.
- Run the repository's Markdown, link, or documentation checks where available.
- Open a focused pull request describing the reader problem and how you verified the fix.
- Ask a maintainer or new contributor to follow the updated instructions and report ambiguity.