/create-docs

Generates or regenerates documentation for a specified part of the project, establishing the foundation for AI-assisted development.

This command is essential for onboarding an existing project into the Claude Code Development Kit or for documenting a new, complex component from scratch.

AI-Optimized Documentation Principles

All documentation generated by this command adheres to principles that make it highly effective for AI consumption:

  • Structured & Concise: Clear sections, lists, and hierarchies.
  • Contextually Complete: Includes the "why" behind decisions.
  • Pattern-Oriented: Makes architectural patterns and conventions explicit.
  • Modular & Scalable: Designed for project growth and easy updates.

Auto-Loaded Project Context:

@/CLAUDE.md
@/docs/ai-context/project-structure.md
@/docs/ai-context/docs-overview.md

Command Execution

The process is adaptive, scaling its analytical depth based on the complexity of the target code.

Step 1: Analyze & Strategize

The AI first analyzes the target path provided in your arguments (e.g., /create-docs "backend/src/api/CONTEXT.md"). It assesses the complexity based on file count, technology mix, and architectural depth, then chooses one of three strategies:

  • Direct Creation: For simple targets, analysis is done during content generation.
  • Focused Analysis: For moderate complexity, 2-3 specialized sub-agents are launched.
  • Comprehensive Analysis: For high complexity, 3-4 agents are launched to cover all angles.

Step 2: Information Gathering (Analysis Phase)

If a sub-agent strategy is chosen, specialized agents are launched in parallel to analyze the code from different perspectives:

  • Code_Analyzer: Examines implementation patterns and logic flow.
  • Tech_Stack_Identifier: Identifies frameworks, libraries, and dependencies.
  • Architecture_Mapper: Maps dependencies, integration points, and data flow.
  • Doc_Validator: Checks for existing documentation to assess accuracy and find gaps.

Step 3: Documentation Generation

The AI synthesizes the findings from its analysis (or from the sub-agents) to generate the documentation content. It selects the appropriate template (Tier 2 for components, Tier 3 for features) and populates it, ensuring all key patterns, decisions, and integration points are captured.

Step 4: Finalization & Housekeeping

After writing the content to the specified file, the command performs several housekeeping tasks:

  • Updates docs-overview.md: Adds the new documentation file to the project's documentation map.
  • Updates project-structure.md: If new directories were documented, it updates the master file tree.
  • Tier 1 Validation: It compares newly discovered patterns against the foundational (Tier 1) documentation and recommends updates if inconsistencies are found.
  • Content Migration: It intelligently checks for redundant information in parent-tier documents and may suggest moving details to the more specific, newly created file, replacing them with a cross-reference.

Step 5: Generate Summary

Finally, the command provides a comprehensive summary of its work, including what was documented, what strategy was used, any recommended updates to foundational docs, and a report on any content migrations performed to improve the documentation hierarchy.