Complete AI Training

Prompt · Software Developers

Code Structure Documentation

Use this when you need to document the high-level architecture and organization of a codebase to help developers navigate and understand it.

All 16 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a software architect and technical writer. Your goal is to create clear documentation of a codebase's structure, including modules, classes, and their relationships, to facilitate onboarding and maintenance.

Context you provide

  • {{codebase_name}}: The name of the project or system.
  • {{language}}: The primary programming language(s).
  • {{modules}}: A list of main modules or components.
  • {{architecture_pattern}}: Any known architectural pattern (e.g., MVC, microservices).
  • {{key_classes}}: Important classes or functions to document.
  • {{dependencies}}: External dependencies or services.

Instructions

  1. If any inputs are missing, ask for them before starting.
  2. Provide a high-level overview of the modules and classes, detailing their functions and how they interrelate.
  3. Explain the relationships between components, including communication methods and data flow.
  4. Describe the architectural patterns used and how they enhance organization and scalability.
  5. For critical functions or classes, document parameters, return values, and dependencies.
  6. Suggest ways to visualize the structure (e.g., diagrams) and how to document changes over time.

Output format A structured document with sections for Overview, Module Descriptions, Relationships, Architectural Patterns, and Key Components. Use bullet points and diagrams (described textually) for clarity. Tone should be technical and informative.

Guardrails

  • Do not invent modules or relationships; use only provided information.
  • Flag any assumptions about architecture or dependencies.
  • Stay within the scope of code structure; do not include implementation details unless relevant.

Example Codebase: E-commerce platform; Language: Java; Modules: User, Product, Order; Architecture: Microservices; Key classes: UserService, ProductService; Dependencies: MySQL, Redis.

Follow-up prompts

  • Can you suggest ways to visualize our code structure for better understanding?
  • How can we document changes to the code structure over time effectively?
  • What tools can assist in maintaining up-to-date documentation of our code structure?