Documentation Guidelines (CLAUDE.md)
This guide provides comprehensive information about the documentation system for the Comma project. It covers how to set up, write, test, and maintain the project's documentation.
Documentation Structure
The documentation follows a component-based approach aligned with the project's architecture:
docs/
├── .vuepress/ # VuePress configuration and themes
├── api/ # API documentation
│ ├── rest/ # REST API documentation
│ └── graphql/ # GraphQL API documentation
├── components/ # UI component documentation
├── infrastructure/ # Infrastructure documentation
├── ai/ # AI-related documentation
│ ├── architecture/ # AI system design
│ ├── prompts/ # AI prompt engineering
│ └── labs/ # Experimental AI features
├── guides/ # User and developer guides
│ ├── development/ # Development setup and workflow
│ ├── deployment/ # Deployment procedures
│ └── operations/ # Monitoring and maintenance
└── CLAUDE.md # This documentation guide
Each section is designed to be self-contained while cross-referencing related content. The hierarchical structure helps users navigate through the documentation based on their specific needs.
VuePress Setup and Configuration
Environment Setup
Prerequisites:
- Node.js 16+ and npm
- Basic knowledge of Markdown and Vue.js
Local development setup:
# Clone the repository git clone https://github.com/your-org/comma.git cd comma/docs # Install dependencies npm install # Start the dev server npm run dev
Building for production:
npm run build
Troubleshooting Common Issues
If you encounter errors when running the development server, try these steps:
Missing dependencies:
# Clean and reinstall dependencies rm -rf node_modules package-lock.json npm install
Broken relative links:
- Make sure to use the correct relative paths based on the file structure
- For example, links from
guides/deployment/
toinfrastructure/
should use../../infrastructure/
as the path prefix
Configuration Files
The VuePress configuration is maintained in .vuepress/config.js
:
- Site metadata: Title, description, base URL
- Theme configuration: Navigation, sidebar, repo information
- Plugins: Search, medium-zoom, etc.
When making changes to the configuration:
- Update the
.vuepress/config.js
file - Test the changes locally using
npm run dev
- Commit configuration changes with detailed explanations
Custom Components
Custom Vue components can be added in the .vuepress/components/
directory and will be automatically registered globally. Use them to create consistent, reusable documentation elements.
Technical Writing Style Guide
General Principles
- Clear and concise: Use simple, direct language
- Task-focused: Organize content around user tasks and goals
- Consistent terminology: Use the same terms consistently throughout
- Progressive disclosure: Present basic information first, with details later
- Scannable content: Use headings, lists, and formatting to aid scanning
Voice and Tone
- Use active voice whenever possible
- Address the reader directly ("you") rather than using passive voice
- Maintain a professional but conversational tone
- Be inclusive and respectful in all content
Formatting Standards
- Use semantic heading levels (H1 for page title, H2 for major sections, etc.)
- Limit paragraphs to 3-5 sentences
- Use numbered lists for sequences and bulleted lists for unordered items
- Highlight important notes, warnings, and tips using callouts:
::: tip
This is a helpful tip for users.
:::
::: warning
This is an important warning.
:::
::: danger
This indicates a dangerous or destructive action.
:::
API Documentation Best Practices
REST API Documentation
Resource-oriented structure:
- Group endpoints by resource type
- Document resource models/schemas first, then operations
Endpoint documentation template:
## Endpoint Name `METHOD /path/to/endpoint` Brief description of what this endpoint does. ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | param1 | string | Yes | Description of parameter | ### Request Example ```http # Example request with proper formatting
Response Examples
Success Response (200 OK)
# Example response JSON
Error Response (400 Bad Request)
# Example error response
Notes
Additional information about usage, rate limits, etc.
Authentication: Clearly document authentication requirements
Error handling: Document common error codes and their meanings
Rate limiting: Document any API rate limits and quotas
GraphQL API Documentation
- Schema-first approach: Document types, queries, and mutations
- Interactive examples: Use embedded GraphQL playground when possible
- Operation examples: Provide example queries and mutations
Code Examples and Snippets Formatting
Code Block Standards
Use fenced code blocks with language identifiers for syntax highlighting:
```python
def example_function():
"""Example function docstring."""
return "Hello, World!"
```
Example Types
Include different types of examples:
- Context examples: Show where/when to use the code
- Basic examples: Simple demonstrations of core functionality
- Advanced examples: More complex use cases
- Error handling examples: How to handle exceptions and edge cases
Best Practices
- Include comments in code examples
- For longer examples, use line numbers
- Ensure all examples are tested and functional
- Link to complete example files in the repository when appropriate
- Use consistent naming conventions across examples
Documentation Testing and Verification
Content Validation
Technical accuracy:
- Verify all commands and code examples work as documented
- Cross-reference with the actual implementation
- Update when APIs or features change
Link validation:
- Test internal and external links regularly
- Fix broken links promptly
Spelling and grammar:
- Use automated tools to check spelling and grammar
- Maintain a project-specific terminology glossary
User Testing
Feedback methods:
- Incorporate user feedback mechanisms on each page
- Conduct periodic documentation reviews with new team members
- Track common support questions that might indicate documentation gaps
Metrics to track:
- Page views and time spent on pages
- Search terms used within the documentation
- Documentation issue reports
Version Control for Documentation
Git Workflow
Branch strategy:
- Use feature branches for significant documentation changes
- Create branches from
main
or the appropriate development branch - Follow the naming convention:
docs/topic-name
Commit guidelines:
- Write clear commit messages explaining what changed and why
- Group related documentation changes in a single commit
- Reference related issues or tickets in commit messages
Documentation versioning:
- Tag documentation versions alongside code releases
- Maintain separate branches for major version documentation when needed
Document Review Process
Review Workflow
Pre-review checklist:
- Run local build to verify formatting
- Check links are working
- Verify code examples run as expected
- Ensure content follows style guidelines
Review steps:
- Submit documentation changes via pull request
- Request reviews from subject matter experts
- Address all comments and suggestions
- Obtain final approval before merging
Quality criteria:
- Technical accuracy
- Completeness
- Clarity and readability
- Adherence to style guide
Markdown Best Practices
Structure and Formatting
File organization:
- Use one Markdown file per major topic
- Place files in appropriate directory based on content
- Use lowercase, hyphenated filenames (e.g.,
api-authentication.md
)
Content structure:
- Start with an H1 title
- Use hierarchical headings (H2, H3, etc.) for subtopics
- Add table of contents for longer documents
Formatting guidelines:
- Use backticks for inline code:
`code`
- Use triple backticks for code blocks with language identifier
- Use bold (text) for emphasis and important terms
- Use italics (text) for new terms and parameters
- Use blockquotes (> text) for notes or quotes
- Use backticks for inline code:
Markdown Extensions
VuePress supports several Markdown extensions:
Frontmatter: Add metadata at the top of files
--- title: Page Title description: Page description for SEO tags: [tag1, tag2] ---
Custom containers: Use for tips, warnings, and notes
::: tip This is a tip ::: ::: warning This is a warning ::: ::: danger This is a dangerous warning :::
Table of contents: Insert table of contents
[[toc]]
Emoji: Use emoji shortcodes
:smile: :tada: :warning:
Search Optimization for Documentation
Content Optimization
Page titles and headings:
- Use descriptive, keyword-rich titles
- Structure content with proper heading hierarchy
- Include common terms users might search for
Metadata:
- Add description in frontmatter for each page
- Include relevant tags for categorization
Content quality:
- Answer common questions clearly
- Use terminology consistently
- Include synonyms for technical terms
Technical Optimization
Search index configuration:
- Customize the search plugin in
.vuepress/config.js
- Configure search weights for different content types
- Include code blocks in search when relevant
- Customize the search plugin in
Monitoring and improvement:
- Review search analytics to identify common searches
- Add content addressing frequently searched topics
- Adjust terminology based on search patterns
Documentation Maintenance
Regular Updates
Scheduled reviews:
- Review each section quarterly
- Update for new features after each release
- Perform full audit annually
Deprecation process:
- Clearly mark deprecated features
- Provide migration guidance
- Maintain archives of historical documentation when needed
Feedback Loop
Collecting feedback:
- Add feedback mechanisms on documentation pages
- Monitor support channels for documentation-related questions
- Check analytics for poorly performing pages
Implementation process:
- Prioritize feedback based on impact and user needs
- Schedule regular documentation sprints
- Assign documentation tasks to subject matter experts
Contributing to Documentation
We welcome contributions to improve our documentation! Here's how you can help:
- Report issues: Found an error or unclear explanation? Open an issue.
- Suggest improvements: Have ideas for better documentation? Share them.
- Submit changes: Make a pull request with your proposed changes.
For substantial contributions, please follow the full documentation process outlined in this guide.
This CLAUDE.md guide serves as a living document. Update it as documentation processes evolve.