This document provides guidelines and standards for creating, maintaining, and organizing documentation across all Bayat projects.
- Introduction
- Documentation Types
- File Organization
- Writing Style Guide
- Markdown Standards
- Documentation in Code
- Diagrams and Visuals
- Documentation Review Process
- Versioning Documentation
- Tooling and Automation
- Translation and Localization
- Accessibility Guidelines
- Implementation Checklist
Documentation is a critical aspect of software development that ensures knowledge transfer, maintenance, and effective onboarding. This meta-documentation guide establishes standards for all documentation at Bayat.
- Accurate and Current: Documentation must be correct and up-to-date
- Audience-Focused: Written with specific users in mind
- Discoverable: Easy to find through search and navigation
- Consistent: Following established conventions and formats
- Concise: Communication with clarity and brevity
- Maintainable: Designed for easy updates
Documentation should follow a defined lifecycle:
- Planning: Identify audience and purpose
- Creation: Write according to standards
- Review: Validate for accuracy and clarity
- Publication: Make accessible to intended audience
- Maintenance: Regular updates and revisions
- Archiving: Proper handling of outdated material
-
README.md:
-
Every project must have a README.md in the repository root
-
Must include: project name, description, setup instructions, and contribution guidelines
-
Follow the standard README template
Example README structure:
# Project Name Brief description of the project. ## Features - Key feature 1 - Key feature 2 - Key feature 3 ## Installation Prerequisites and installation steps. ## Usage Basic usage examples. ## Development Instructions for setting up the development environment. ## Contributing Guidelines for contributing to the project. ## License License information.
-
-
Architecture Documentation:
- System overview diagrams
- Component descriptions
- Integration points
- Data models
- Decision records
-
API Documentation:
- API reference (endpoints, methods, parameters)
- Authentication details
- Request/response examples
- Error handling
-
User Guides:
- Step-by-step instructions
- Organized by user tasks
- Screenshots and visual aids
-
Tutorials:
- Goal-oriented learning content
- Progressive difficulty
- Complete workflow examples
-
FAQs:
- Common questions and answers
- Categorized by topic
- Updated based on support requests
-
Dev Environment Setup:
- Environment setup instructions
- Tool configurations
- Access requirements
-
Process Documentation:
- Development workflows
- Release procedures
- Testing protocols
- Incident response plans
-
Meeting Notes and Decisions:
- Standard format for meeting documentation
- Decision log with context and reasoning
- Action items with assignees and deadlines
Documentation should be organized in a consistent structure across all repositories:
-
Root Level Documentation:
README.md
: Project overviewCONTRIBUTING.md
: Contribution guidelinesLICENSE
: License informationCHANGELOG.md
: Version history
-
Documentation Directory Structure:
/docs
: Main documentation directory-
/docs/architecture
: Architecture documentation -
/docs/api
: API documentation -
/docs/user-guides
: End-user documentation -
/docs/contributing
: Developer guidelines -
/docs/operations
: Operational proceduresExample directory structure:
/ ├── README.md ├── CONTRIBUTING.md ├── LICENSE ├── CHANGELOG.md └── docs/ ├── architecture/ │ ├── overview.md │ ├── components.md │ └── decisions/ │ ├── 001-database-choice.md │ └── 002-authentication-system.md ├── api/ │ ├── overview.md │ ├── authentication.md │ └── endpoints/ │ ├── users.md │ └── products.md ├── user-guides/ │ ├── getting-started.md │ └── advanced-features.md ├── contributing/ │ ├── code-style.md │ ├── testing.md │ └── pull-request-process.md └── operations/ ├── deployment.md ├── monitoring.md └── incident-response.md
-
-
File Naming:
- Use kebab-case for all documentation files (e.g.,
api-reference.md
) - Use descriptive, concise names
- Group related documents in subdirectories
- Use kebab-case for all documentation files (e.g.,
-
Image Naming:
- Use consistent prefixes to indicate content type
- Include version number if applicable
- Example:
screenshot-user-profile-v2.png
-
Voice and Tone:
- Use active voice
- Maintain a professional but approachable tone
- Be direct and concise
-
Formatting Consistency:
- Standardize headings (sentence case)
- Use consistent terminology throughout
- Maintain consistent formatting for code, variables, and UI elements
-
Language Standards:
- Use American English spelling
- Avoid jargon and slang
- Define acronyms on first use
- Use inclusive language
-
Headers and Structure:
- Use clear, descriptive headers
- Maintain a logical hierarchy
- Limit nesting to 3 levels of headings
-
Paragraphs:
- Keep paragraphs short (3-5 sentences)
- Focus on one idea per paragraph
- Use transitional phrases between paragraphs
-
Lists:
-
Use bulleted lists for unordered items
-
Use numbered lists for sequential steps
-
Keep list items parallel in structure
Example of good vs. poor formatting:
Good Example: ## User Authentication To authenticate a user: 1. Call the `/auth/login` endpoint with user credentials 2. Store the returned JWT token 3. Include the token in the Authorization header for subsequent requests Poor Example: ## Authentication You need to authenticate. First call login, then you'll get a token. Make sure you use it in your API calls or they won't work. The API will return a 401 error if you don't include the token properly.
-
-
Headers:
- Use ATX-style headers with space after hash (
# Header
) - Maintain hierarchy (don't skip levels)
- Add blank lines before and after headers
- Use ATX-style headers with space after hash (
-
Lists:
- Use
-
for unordered lists - Add space after list marker
- Indent nested lists with 2 spaces
- Use
-
Code Blocks:
-
Use fenced code blocks with language specified
-
Use inline code for short references
-
Prefer syntax highlighting for readability
Example of proper Markdown formatting:
# Document Title ## First Section This paragraph explains the first section. - List item one - List item two - Nested item - Another nested item - List item three ### Subsection Here's how to use the function: ```javascript function example() { console.log('Hello, world!'); } ``` Inline code looks like `this` in a sentence.
-
-
Internal Links:
- Use relative links for internal documentation
- Include anchor links for specific sections
- Verify all internal links work
-
External Links:
-
Include descriptive link text (avoid "click here")
-
Specify when a link is external
-
Consider link durability
Example of proper linking:
See the \1\2) for more details. For additional background, review the [IETF OAuth specification](https://tools.ietf.org/html/rfc6749) (external link).
-
-
Comment Standards:
- Use consistent comment style per language
- Focus on why, not what (code shows what)
- Document non-obvious behavior
-
Function/Method Documentation:
-
Use standardized doc comments (JSDoc, Python docstrings, etc.)
-
Document parameters, return values, and exceptions
-
Include usage examples for complex functions
Example of good code documentation:
/** * Calculate the discount price based on user tier and product category. * * @param {number} price - The original product price * @param {string} userTier - Customer tier ('standard', 'premium', 'vip') * @param {string} category - Product category code * @returns {number} The calculated discount price * @throws {Error} If userTier is invalid * * @example * // Returns 85 (15% discount for premium user) * calculateDiscountPrice(100, 'premium', 'electronics') */ function calculateDiscountPrice(price, userTier, category) { // Implementation... }
-
- API Documentation Standards:
-
Use OpenAPI/Swagger for REST APIs
-
Document GraphQL schemas with descriptions
-
Include authentication requirements
-
Provide request/response examples
Example of OpenAPI documentation:
paths: /users/{id}: get: summary: Get a user by ID description: Returns a single user by their unique identifier parameters: - name: id in: path required: true description: The user's unique identifier schema: type: integer responses: '200': description: A user object content: application/json: schema: $ref: '#/components/schemas/User' '404': description: User not found
-
-
Diagram Types:
- System architecture diagrams (C4 model preferred)
- Sequence diagrams for interactions
- Entity-relationship diagrams for data models
- State diagrams for complex workflows
-
Creation Standards:
-
Use source-controlled diagram formats (e.g., Mermaid, PlantUML)
-
Include diagrams directly in Markdown when possible
-
Maintain consistent styling across diagrams
Example of a Mermaid diagram in Markdown:
## User Registration Flow ```mermaid sequenceDiagram participant User participant API participant DB User->>API: POST /users (Create Account) API->>DB: Store User Data DB-->>API: User Created API-->>User: 201 Created (User Data) API->>User: Send Verification Email User->>API: GET /verify?token=xyz API->>DB: Update User (Verified) API-->>User: 200 OK (Verification Complete) ```
-
-
Screenshot Guidelines:
- Capture only relevant portions of the UI
- Use consistent window size and zoom level
- Highlight important elements
- Use descriptive alt text for accessibility
-
Image Formats:
- Use SVG for diagrams and illustrations
- Use PNG for screenshots with transparency
- Use JPEG for photographs
- Optimize images for web (compress without quality loss)
-
Image Storage:
- Store images in
/docs/assets/images/
- Group by documentation section
- Add dimensions to image references when needed
- Store images in
-
Technical Accuracy Review:
- Ensure technical accuracy
- Validate all code examples actually work
- Verify API endpoints and parameters
- Test procedures as documented
-
Usability Review:
- Evaluate clarity and completeness
- Check for logical organization
- Ensure documentation meets audience needs
- Verify alignment with product functionality
-
Editorial Review:
- Check grammar and spelling
- Ensure consistent terminology
- Validate formatting standards
- Review for inclusive language
-
Documentation PR Template:
- Summary of changes
- Type of documentation updated
- Screenshot of changes (if applicable)
- Checklist for review criteria
-
Required Reviewers:
-
Technical reviewer (subject matter expert)
-
Editorial reviewer (documentation standards)
-
Stakeholder reviewer (product owner or manager)
Example PR template for documentation:
## Documentation Change Description <!-- Describe what's being documented --> ## Type of Documentation - [ ] User Guide - [ ] API Reference - [ ] Architecture Document - [ ] Process Document - [ ] Other: __________ ## Review Checklist - [ ] Information is technically accurate - [ ] Code examples work as described - [ ] Screenshots are current and clear - [ ] Conforms to documentation standards - [ ] No spelling or grammatical errors - [ ] Links work correctly ## Additional Notes <!-- Any special considerations for these changes -->
-
-
Documentation Versioning Strategy:
- Align documentation versions with product releases
- Clearly mark version-specific content
- Maintain documentation for supported versions
-
Indicating Changes:
-
Use change indicators for recent updates
-
Maintain a changelog for documentation
-
Date stamp significant revisions
Example version indication:
# API Reference *Version 2.3 - Last updated: 2023-09-15* > ⚠️ **Version Notice**: API v1 will be deprecated on December 31, 2023. Please migrate to API v2. ## Endpoints ...
-
- Breaking Change Documentation:
-
Highlight breaking changes prominently
-
Provide migration guides
-
Include before/after examples
-
Document rollback procedures
Example breaking change documentation:
## Breaking Changes in v3.0 ### Authentication Changes The authentication mechanism has changed from API keys to JWT tokens. **Before (v2.x):** ```http GET /api/users X-API-Key: your-api-key ``` **After (v3.0):** ```http GET /api/users Authorization: Bearer your-jwt-token ``` To migrate to the new authentication system: 1. Generate JWT tokens using the `/auth/token` endpoint 2. Update your API clients to include the token in the Authorization header 3. Update your error handling for the new authentication errors See the \1\2) for detailed instructions.
-
-
Recommended Tools:
- Markdown editor with preview (e.g., VS Code)
- Markdown linter (e.g., markdownlint)
- Spelling and grammar checker
- Diagram generation tools (Mermaid, PlantUML)
-
Documentation Generation:
-
API documentation from code annotations
-
Static site generators for documentation sites
-
Automated screenshot tools
Example documentation automation configuration:
# .github/workflows/docs-validation.yml name: Documentation Validation on: pull_request: paths: - '**/*.md' - 'docs/**' jobs: validate-docs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Markdown Lint uses: avto-dev/markdown-lint@v1 with: config: '.markdownlint.json' args: './docs' - name: Check Links uses: gaurav-nelson/github-action-markdown-link-check@v1 - name: Spellcheck uses: crate-ci/typos@master
-
-
Principles:
- Treat documentation like code
- Version control all documentation
- Apply CI/CD practices to docs
- Automate validation and publishing
-
Implementation:
-
Store documentation in Git repositories
-
Use pull requests for documentation changes
-
Implement automated checks
-
Generate documentation sites from source
Example documentation CI/CD pipeline:
# .github/workflows/publish-docs.yml name: Publish Documentation on: push: branches: - main paths: - 'docs/**' - 'README.md' jobs: build-and-deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Setup Node.js uses: actions/setup-node@v2 with: node-version: '14' - name: Install dependencies run: npm install - name: Build documentation site run: npm run docs:build - name: Deploy to GitHub Pages uses: JamesIves/[email protected] with: branch: gh-pages folder: docs/dist
-
-
Translation Process:
- Identify documentation requiring translation
- Use professional translation services
- Implement technical review of translations
- Update translations with source changes
-
File Organization:
-
Organize translations by language code
-
Maintain parallel structure between languages
-
Use consistent naming conventions
Example localized documentation structure:
/docs/ ├── en/ │ ├── getting-started.md │ └── api-reference.md ├── fr/ │ ├── getting-started.md │ └── api-reference.md ├── ja/ │ ├── getting-started.md │ └── api-reference.md └── assets/ └── images/
-
-
Content Guidelines:
- Use simple, clear language
- Avoid idioms and culture-specific references
- Maintain consistent terminology
- Use standard sentence structure
-
Implementation:
- Use translation management tools
- Implement language selection in documentation sites
- Include language identifiers in file names
-
Accessibility Requirements:
- Ensure screen reader compatibility
- Provide text alternatives for images
- Use sufficient color contrast
- Create accessible tables and lists
-
Implementation:
-
Add alt text to all images
-
Use semantic HTML in rendered documentation
-
Test with accessibility tools
-
Provide keyboard navigation
Example accessible documentation practices:
## Feature Overview  The dashboard provides these key functions: 1. **User Statistics**: View user activity and engagement metrics 2. **Activity Graph**: Visual representation of system activity over time 3. **Notification Center**: Central location for all system notifications | Feature | Basic Plan | Pro Plan | Enterprise Plan | |---------|:----------:|:--------:|:---------------:| | Statistics | ✅ | ✅ | ✅ | | Activity Graph | ❌ | ✅ | ✅ | | Notifications | ❌ | ❌ | ✅ |
-
- Create standard documentation directory structure
- Implement README template
- Configure documentation linting tools
- Set up documentation CI/CD pipeline
- Define document types needed for project
- Create documentation templates
- Develop style guide specific to project
- Implement diagram standards
- Establish documentation review process
- Create documentation PR template
- Implement automated checks
- Schedule regular documentation maintenance
- Set up documentation publishing workflow
- Configure access control as needed
- Implement analytics for documentation usage
- Create feedback mechanism for documentation