How to Write Documentation π
An extensive, 360Β° guide about crafting effective product, tech and company docs.
Organizing knowledge is one of my obsessions.
Today, this is a core part of my work as a writer, but even in my previous life, as a CTO, I invested a lot of energy into processes that enabled good, sustainable docs.
I have written many articles about this β but they mostly cover specific angles, so I thought this was a perfect topic for the second of our guides.
In the past few weeks I've talked with a ton of tech leaders, read plenty of case studies, and reflected on my own experience with tech documentation. So here is what we will cover today:
π Benefits of docs β these are non-trivial and crucial to understand.
π How to write successful docs β strategies to craft useful docs and make people stick with them.
π·οΈ Types of docs β we talk about product docs, design docs, specs, and code comments.
πΒ Docs cheatsheet β we summarize all the advice into a few easy steps.
π¨ Tools β the five best tools for writing modern docs.
π Resources β additional readings and case studies to learn more.
Letβs dive in!
π Benefits of docs
To every person I surveyed for writing this article, I always asked, at the end: are you happy about your docs? 100% of them said no. Literally all of them!
I have found that this is not (only) because people struggle at writing docs β itβs that they are generally confused about what those are useful for and how to use them.
Writing docs β of whatever kind β has many benefits:
πΒ Help your reasoningΒ β writing is thinking. Going through the process of writing a formal document helps solidify your reasoning and come up with a better solution.
β‘ Improve output β you can support your writing with previously created templates, checklists, and examples. These make the work lighter and lead to better results.
π¬ Improve communication β it is easier to have good conversations about complex topics when these are backed by writing. You get more thorough reasoning and easier convergence.
π Future reference β docs naturally record decisions and can be used for posterity.
These benefits happen throughout the whole life of a project, from inception to release to future maintenance.
Now, I have found that most teams over-index on the future reference use case, while neglecting the first two. But writing docs only after the fact is like retrofitting unit tests to production code: not completely useless, but you miss out on a lot of value.
Also, writing docs at the end is genuinely harder than doing it gradually while the work is in progress. Artifacts like meeting notes and design docs are not only useful per se β they naturally turn into long-term docs, later, with very little effort.
Minimizing such effort is crucial to helping people keep up with docs. In fact, people are only going to create docs if the value from their use is perceived as superior to the writing effort.
Based on how this equation turns out, you end up either in a vicious or a virtuous cycle π
1) β Vicious docs cycle
People write less docs because no one reads them
Docs become partial and outdated
People don't trust and read docs anymore
People write less and less docs
2) β
Virtuous docs cycle
People write more docs because they feel they are valuable
Knowledge grows larger, more insights are discovered, decisions are taken faster and better
People read more docs instead of having meetings
People write more and more docs
π How to write successful docs
So, if we trust the equation, we have two ways of avoiding the vicious cycle and encouraging the virtuous one:
Maximize the use of docs, and
Minimize the effort of writing them.
Over time, I have found (and written) a lot of advice about this. Here are the four best ideas you should try:
1) π Attach docs to processes
The best way to be consistent at writing documents is to attach them to existing processes. This turns writing into a habit, so that people do it naturally β like brushing their teeth.
For example, you can enforce agendas for meetings, or design docs for new initiatives. For larger projects, you can use checklists that detail everything that needs to be done, including writing down stuff. Or you can also use your onboarding process as an opportunity to update old docs π
A good practice we established, especially for higher-level technical documentation, is to assign every new hire the task of updating and filling in any gaps as part of the onboarding process.
β Nicola Ballotta
Also, you can create templates for any type of document that needs to be written. This is a low hanging fruit that 1) reduces the friction of writing, and 2) improves the overall quality.
So, for any doc you need to write, ask yourself:
What process can I attach this to?
Can I create templates to make this easier?
2) π» Keep docs close to code
For technical docs, I have found that the closer they are to the code, the higher the chance that they will stay relevant and up to date.
Ideally, you want tech docs to be updated in PRs β just like code.
I am a fan of commenting code (more on that later) because comments are extremely easy to update. Everything happens in the same PR, so it is also easy for others to verify that you actually did it. Also, code comments can turn automatically into docs with various tools.
These benefits also apply to READMEs and repo docs. Everything that lives in your repo is generally easy to update.
Tech docs, i.e. docs related to a specific project live in the github repo and undergo the same PR/CR process that code does. Format is markdown.
β Umberto Nicoletti, Head of R&D at Proemion
3) π± Organize by projects and areas
I am a fan of the PARA method by Tiago Forte for organizing information, and I have brought this to how I organize docs in my teams as well.
I believe, at a high level, you can separate between two major types of notes:
βοΈ Project notes β stuff you need to deliver a project. A project is an initiative that has a beginning and an end, and potentially involves multiple areas (cross-functional). Likewise, projects may need a diverse set of docs, including e.g. product requirements, design docs, rollout plans, and more.
βοΈ Area notes β long-lived documentation about a specific area. An area is anything for which you need to maintain a standard, and that stays relevant for indefinite time (as opposed to projects, that have an end). Engineering onboarding, database schemas, company org charts are all examples of docs that may not belong to a specific project, but rather to a long-lived area.
Most action happens in project notes, while area notes are more useful for future reference. This separation, though, is not static: after a project is delivered, you may archive most of its material, and move some of it into the respective areas, where it will stay useful for longer.
For example, you may move the database migration specs into the general database docs, or the PRD into the product area.
If your system supports it, you may tag content rather than actually moving it. E.g. I am a fan of using Notion for company docs because it allows you to be flexible with this and define areas and projects through relations and tags, rather than folders. But you can implement this in any system, like Confluence, or Google Docs.
4) π¦ Archive old stuff
One of the main reasons why people donβt read docs (and, eventually, stop writing them) is that, in your workspace, good docs are mixed with old, outdated ones.
In some cases, outdated docs can be updated, but in many others, those are simply not useful anymore.
For the latter, you should have a safe place where you can put all this stuff, like an archive folder. Do not delete anything β just move it away to declutter your space and keep signal-to-noise high.
π·οΈ Types of docs
We discussed how to organize docs and where to put them β but what docs should you actually write? Letβs see the main categories:
1) π± Product Requirement Docs (PRDs)
PRDs are the main product docs for new features/products. They outline the why and what should be built, while letting designers and engineers explore the how.
About what goes into a PRD, I like to think about three main areas:
π― Goals β what should be achieved from a business perspective. KPIs and targets should go here.
π€Ή Features β high level view of what users should be able to do. Might include some guidance on UX.
π Scope β assumptions, anti-goals, constraints, and anything non trivial that is useful to clarify to create alignment.
Each of these items can be more or less detailed based on whether we are talking of a small feature or a large product area.
Also, PRDs usually start high-level based on the PM input, and get richer and more detailed with the input of designers and engineers.
You can find various specific formats of PRDs. A notable one is PRFAQs, which mimics a future press release. It was popularized by Amazon and you can find a template here.
Lenny Rachitsky also published a great list of PRD templates here.
2) π Design Docs
A design doc illustrates the tech design and implementation strategy for a given initiative. It is meant to be createdΒ beforeΒ you start writing code, and to be shared with other stakeholders to converge on the solution.
Design docs are useful throughout the whole lifecycle of a project:
Before releaseΒ β they drive the process that makes people converge on a good solution.
After releaseΒ β they act as a decision record, which is often more useful than pure tech specs.
In my experience, design docs are the MVP of all tech docs, where in this case "MV" stands both for Minimum Viable, and Most Valuable.
I have written a full article about design docs, which includes my personal template, and answers to many FAQs. You can find it below π
An alternative to design docs β or a particular implementation of them β is Architecture Decision Records (ADR), which, as the name suggests, are meant to capture important architecture decisions together with context, consequences, and more.
You can find more ADR info and templates in this useful repo.
3) π Tech specs
Tech specs are different from design docs as they act as a description of whatβs live. They may include database schemas, API specs, or system diagrams.
Even if they are separate from design docs, they mostly stem from these. In fact, after a project has been delivered, you may move parts of the design doc from the project space to areas where these are more useful, turning them into specs.
A good workflow may look like this:
A change is described in a design doc
Design doc is finalized
Project is delivered
Design doc stays immutable, as a snapshot, but parts that describe specs are moved (copied) to the respective areas.
4) π¬ Code comments
Commenting code is a somewhat controversial practice, as many developers believe that good code documents itself.
I have found, instead, that top performing teams are consistently good at commenting code, by focusing on the right amount of comments that provide the most value to the codebase.
Here is my take about the most common types of comments:
β Β Comments at the top of the file/class β a few lines to describe the fileβs primary goal can go a long way to help maintainers. It also helps to avoid scope creep over time and to keep the file true to its original goal.
β Comments on complex functions β most functions should be simple enough to be understandable as-it-is, but there are algorithms and processes that cannot be so, no matter how well you write them. In these cases, it helps to include a description of the inputs, the logic, and the outputs of the function.
β In-line comments β while there is value in explaining the workings of a complex function, the need to comment single lines of code is most often a code smell. If people understand what the function does but not some of its lines, there is probably something you can rework, rather than commenting the lines themselves.
Code comments are also easier to keep up to date with respect to docs that live elsewhere, as you may update them in place whenever you are making changes to the code itself.
Likewise, it is easy to spot in PRs whenever somebody is changing the code without updating the comments, and report it.
5) π Principles, conventions, best practices
If design docs are about recording decisions, principles provide a blueprint for how such decisions should be made.
Without principles, you might meet goals in a way that doesn't reflect your culture. Engineers might deliver features without peer review, managers might meet deadlines by making people overwork, or teams might cut corners on security and accessibility.
So, principles are a set ofΒ shared beliefsΒ that create alignment over how you do things in your company. They are, simultaneously:
π A definition of whatΒ goodΒ looks like.
π£οΈ AΒ shared languageΒ to be used in daily work.
Healthy trust inside your team comes from the alignment around how things should be done, plus giving people the autonomy to go for them.
π Docs cheatsheet
So, here is a handy recap of what we covered:
What docs you should write
Focusing on tech docs, here is what you need, from the highest to lowest level π
π Principles β to describe how decisions should be made
π Design Docs β to describe how things are built, and record tech decisions
π Specs β to describe whatβs live, taking it from PRDs and DDs
π¬ Code comments β to help maintainers and to keep track of small debt. In most languages you also have ways to auto-generate specs from comments.
How you should write them
Attach to processes β review principles on every performance review, create a design doc for every project, write comments whenever you write code. Turn writing docs into a recurring habit, and support those habits with templates and checklists to make them easier.
Organize into projects and areas β separate working docs for deliverables from long-term materials. Eventually turn the former into the latter.
Archive old stuff β keep your workspace decluttered by hiding what is not useful anymore.
π¨ Tools
Here are the 5 best tools that I know for creating modern documentation:
NotionΒ β the most popular modern tool to create knowledge bases, workflows, and organize work and life in general. It is hard to even define what Notion does, as it replaces so many tools. It is my favorite and has a great ecosystem around it.
CodaΒ β close to Notion but slightly moreΒ techy.Β It also boasts integrations with popular tools like Github, Gmail, Intercom, and more options to build workflows and internal tools. A fantastic all-round tool.
SliteΒ β while Notion and Coda are as much about knowledge as they are about workflows, Slite is more focused on knowledge. It provides a beautiful canvas to create and organize written content, and plenty of collaboration features.
SlabΒ β closer to Slite than to Notion or Coda, it also includes deep integrations with Dropbox, Google Drive, Slack, to surface content from all of your sources. It is an interesting take and a good option for companies who have already invested in other doc tools.
ConfluenceΒ β this list wouldn't be complete without the flagship Atlassian product. If you are into JIRA and the Atlassian ecosystem, Confluence is a solid choice that ties in with the rest of your workflow.
π Resources
The PARA Method β by Tiago Forte. It is the best framework I know for organizing digital information. I use it both for life and work.
How Notion Uses Notion β even if you are not into Notion, this is a great read into how a 100+ people company organizes their knowledge. It is rare to find such in-depth case studies, and this one is really good. Also, most advice is general and applicable to any tool.
GitLab Handbook β this handbook is the central repository for how GitLab is run. GitLab is 100% remote and global, and people literally work and coordinate through the handbook. It is more than 2000+ pages and includes vast documentation about how the handbook itself is managed.
Slab Library β tons of examples of internal documentation from successful companies like Coinbase, Basecamp, Netflix and more. Check out Trello's remote policy, how Netflix runs code reviews, or Salesforce's meeting agenda template. It's a great resource.
Painless Functional SpecificationsΒ β legendary blog post (first of two parts) by Joel Spolsky about specs: why and how you should write them. Funny and very insightful.
How to Write a Good Software Design DocΒ β Angela Zhang, EM at Plaid, wrote this comprehensive piece that covers the why, the what, and the how around design docs.
See you next week! π
Sincerely,
Luca
I will apply this to the documentation I will have to write in the incoming Sprint! ππΌ
You're so cool! I don't suppose I've learn something like this before. So nice to search out anyone with some authentic thoughts on this. really thank you f or beginning this up. this hacker [hackerspytech @ gmail com] is one everyone looking for a hacker on the internet, somebody with a bit originality. I'm not a review type normally I just use my product and leave, but I have to recommend hackerspytech@ gmail com helpful job for bringing one thing new to the internet
If you wish to remove any unwanted content like intimate/nude pictures, videos from google or take down any website, i suggest you mail hackerspytech @ gm ail com , when i was been black mailed by my ex girlfriend few months back, Team Hacker Spytech helped me hack into her phone and deleted every thing that concerned me . He also gave me a link that i use to monitor every chat and call coming into her phone. I was able to listen to voice notes, record calls read her social media messages, with the Gps filter they installed in my phone i could tell the location of any phone number i wanted and this got my ex scared of me till today ..