"The code is the documentation" sounds elegant until six months later you can't understand your own API. Good technical documentation isn't just supplementary — it determines whether an open source project gets adopted, whether an API gets integrated correctly, and whether a new engineer can onboard in two weeks. This guide builds a practical, maintainable documentation system from the ground up.
1. The Four Types of Technical Documentation
The Diátaxis framework divides technical documentation into four quadrants, each with different purposes and audiences:
| Type | Purpose | Example |
|---|---|---|
| Tutorial | Guide beginners to their first success | "Get Started in 5 Minutes" |
| How-to Guide | Step-by-step instructions for specific tasks | "How to Configure Environment Variables" |
| Reference | Precise technical specifications | API endpoint docs, config parameter lists |
| Explanation | Background concepts and design rationale | Architecture Decision Records (ADR) |
Most engineering teams only write Reference docs (listing API endpoints) and skip Tutorials and How-to Guides — which are often what users need most.
2. README: Your Project's First Impression
A good README should contain:
- One-sentence description: What this is and what problem it solves
- Quick Start: Get it running in 3 steps or fewer
- Usage examples: The most typical scenario, with code
- Configuration: Environment variables, config file format
- Contributing guide: How to report bugs, submit PRs
- License: MIT, Apache 2.0, etc.
Common README Mistakes
- Assuming reader background knowledge ("first install Node.js" without specifying version)
- Example code that's outdated but never updated
- Listing features without explaining use cases
- Not describing what the project is not for (preventing misuse)
3. Markdown Standards for Technical Docs
Heading Hierarchy Rules
#(H1): One per document, typically the document title##(H2): Major sections###(H3): Subsections — avoid going deeper than H3- Never skip levels: don't jump from H2 directly to H4
Code Block Best Practices
Always specify the language for syntax highlighting:
```bash
npm install your-package
```
```json
{
"key": "value"
}
```
Links and Images
- Avoid bare URLs — use meaningful anchor text:
[Configuration Guide](#configuration) - Images need alt text:
 - Internal links use relative paths; external links use full HTTPS URLs
4. API Documentation: The Core of Developer Experience
API documentation is the manual for engineers integrating your service. Its quality directly affects integration success rates and support burden.
Required API Documentation Elements
- Endpoint description: HTTP method + path + purpose
- Parameters: Path params, query params, request body — each with name, type, required/optional, default, example
- Request example: Complete HTTP request with real (not foo/bar) example values
- Response schema: Both success and error response structures, all HTTP status codes
- Error codes: All custom error codes with descriptions and troubleshooting steps
OpenAPI / Swagger Specification
For RESTful APIs, adopt the OpenAPI 3.0 specification (YAML or JSON). Benefits include:
- Auto-generates interactive Swagger UI — users test APIs directly in the browser
- Importable into Postman/Insomnia for automatic test request creation
- Auto-generated from code in frameworks like FastAPI, SpringDoc
- Structured format is easy to version-control and diff
5. Docs as Code: Managing Documentation Like Software
"Docs as Code" applies the same version control, review, and CI/CD practices to documentation as to code:
- Docs in the same PR as code changes: API behavior changes must include doc updates in the same PR — no doc update, no merge
- Doc review: Have non-engineers review for clarity and comprehension
- Broken link checks: CI/CD automatically scans for dead links in documentation
- Test documentation examples: Code snippets in tutorials run as part of CI to catch regressions
6. Keeping Documentation Current: Engineering Mechanisms
- Doc owner: Assign a maintainer to each critical document, with quarterly reviews
- Automated example testing: Tutorial code snippets run in CI so breakage is caught immediately
- User feedback channel: Add "Was this helpful?" and issue reporting links at the bottom of doc pages
- Changelog discipline: Maintain a CHANGELOG.md for every release — added, changed, deprecated, removed
- "Pending documentation" markers: Mark unfinished sections with TODO or warning callouts — more honest than silence
Summary
- Technical docs have four types: Tutorial, How-to Guide, Reference, Explanation — most projects only have Reference
- READMEs must get users to a working state in ≤3 steps, with real (not placeholder) examples
- Markdown best practices: don't skip heading levels, specify code block language, use meaningful link anchor text
- API docs must include: endpoint description, all parameters, request example, response schema, error codes
- Docs as Code — same PR, same review, same CI as code — is the foundational mechanism for keeping docs alive