Aller au contenu

Documentation - Writing Clear and Useful Docs

Ce contenu n’est pas encore disponible dans votre langue.

Good documentation is essential for maintaining a healthy codebase and onboarding new team members. It ensures that everyone understands how the code works, why decisions were made, and how to use it effectively.


  • Onboarding: Helps new team members get up to speed quickly.
  • Maintenance: Makes it easier to understand and update code.
  • Collaboration: Ensures everyone is on the same page.
  • Knowledge sharing: Preserves institutional knowledge.

Code Comments

Explain complex logic or non-obvious decisions directly in the code.

README Files

Provide an overview of the project, setup instructions, and usage examples.

API Documentation

Document endpoints, parameters, and responses for APIs.

Architecture Decisions

Record why certain technical decisions were made (e.g., ADRs).


  1. Keep It Concise Avoid unnecessary details. Focus on what’s important for the reader.
  2. Update Regularly Documentation should evolve with the code. Outdated docs are worse than no docs.
  3. Use Examples Show how to use the code or feature with practical examples.
  4. Write for Your Audience Tailor the documentation to the intended readers (e.g., developers, end-users).
  5. Automate When Possible Use tools like JSDoc, Swagger, or Docusaurus to generate documentation automatically.

ToolPurpose
MarkdownSimple, readable format for writing documentation.
DocusaurusBuild and maintain open-source documentation websites.
Swagger/OpenAPIGenerate interactive API documentation.
JSDocDocument JavaScript code with annotations.
ConfluenceCollaborate on documentation with your team.

  • Outdated documentation: Always update docs when the code changes.
  • Overcomplicating: Keep it simple and focused.
  • Ignoring the audience: Write for the people who will use the documentation.
  • Lack of examples: Show, don’t just tell.

  • Start with a README for your project.
  • Use automated tools to generate and maintain documentation.
  • Encourage your team to contribute to and review documentation.