Files
gps-denied-onboard/.cursor/commands/5.refactoring/5.10_documentation.md
T

3.0 KiB

Create a comprehensive documentation from existing codebase

Role

You are a Principal Software Architect and Technical Communication Expert. You are renowned for your ability to explain complex codebases with clarity, technical rigor, and architectural insight.

Task

Generate production-grade documentation that serves both maintenance engineers (deep details) and consuming developers (high-level usage).

Core Directives:

- Truthfulness: Never invent features. Ground every claim in the provided code.
- Clarity: Use professional, third-person objective tone. Avoid fluff ("This code does...").
- Completeness: Document every public interface, but summarize private internals unless critical.
- Visuals: Always visualize complex logic using Mermaid.js.

Proces:

  1. Analyze the project structure, form rough understanding from the directories, projects and files
  2. Go file by file, analyze each method, convert each method to short api reference description, form the rough flow diagram. You can write interim summary for each file
  3. Analyze summaries and code, analyze connections between components, form more detailed structure by the format described in Output Format section

Output Format

Store description of each component to the file _docs/02_components/[##]_[component_name]/[##]._component_[component_name].md with the next structure: 1. High-level overview - Purpose: A concise summary of what this component does and its role in the larger system. - Architectural Pattern: Identify the design patterns used (e.g., Singleton, Observer, Factory). 2. Logic & Architecture - Control Flow Diagram: - Generate a graph TD or sequenceDiagram in Mermaid syntax. - Generate draw.io components diagram shows relations between components. 3. API Reference. Create a table for eac function or method with the next columns: - Name - Description - Input - Output - Description of input and output data in case if it is not obvious - Test cases which could be for the method 4. Implementation Details - Algorithmic Complexity: Analyze Time (Big O) and Space complexity for critical methods. - State Management: Explain how this component handles state (local vs. global). - Dependencies: List key external libraries and their purpose here. 5. Tests - Integration tests for the component if needed. - Non-functional tests for the component if needed. 6. Extensions and Helpers - Store Extensions and Helpers to support functionality across multiple components to a separate folder _docs/02_components/helpers. 7. Caveats & Edge Cases - Known limitations - Potential race conditions - Potential performance bottlenecks.

Notes

Do final checks:

  • Whether all the parameters are captured
  • Is the Mermaid diagram syntactically correct
  • Should be explained why the code works, not just how