Reverse Documentation Skill
Automatically generate comprehensive documentation for Rust and TypeScript codebases by analyzing existing code structure, patterns, and relationships.
When to use
Use this skill when you need to:
- Generate comprehensive API documentation for Rust crates
- Document React components and custom hooks
- Create architecture documentation from code analysis
- Generate migration guides for API changes
- Create README and implementation guides
- Document design patterns and relationships
- Build code examples and tutorials
- Cross-reference related functionality
Core concepts
Rust Documentation
This skill understands and documents:
- Module Organization: Workspace structure, crate dependencies, feature flags
- Types & Traits: Struct, enum, and trait definitions with full type signatures
- Error Handling: Result types, custom error types, error propagation patterns
- Async Patterns: Tokio-based async functions, futures, task spawning
- Generic Types: Type parameters, bounds, and lifetime annotations
- Implementation Details: Methods, associated functions, trait implementations
- Testing: Unit tests, integration tests, documentation examples
TypeScript Documentation
This skill understands and documents:
- Module Structure: Exports, re-exports, and module dependencies
- Type Definitions: Interfaces, types, generics, and utility types
- React Components: Functional components, props, state, lifecycle
- Custom Hooks: Hook composition, state management, side effects
- API Integration: Data fetching, request/response types, error handling
- State Patterns: useState, useReducer, Context API, state management libraries
- Next.js Patterns: Pages, layouts, API routes, middleware, server components
Quick start
For Rust codebases
Generate comprehensive documentation for the [crate-name] crate
Document the trait-based storage abstraction in edgequake-storage
Create API documentation for all public interfaces with examples
For TypeScript codebases
Generate documentation for all React components in src/components
Document the custom hooks in src/hooks with usage examples
Create type documentation for the API integration layer
Capabilities
Rust Capabilities
1. Crate Documentation
- Analyze Cargo.toml and workspace structure
- Extract and document all public types, traits, and functions
- Generate comprehensive README files
- Create architecture diagrams of trait relationships
- Document feature flags and optional dependencies
2. API Reference Generation
- Extract function signatures with parameters and return types
- Document error types and handling patterns
- Include working code examples
- Show generic type usage
- Cross-reference related types
3. Pattern Documentation
- Identify and document design patterns (Builder, Factory, Strategy, etc.)
- Explain async/await patterns and tokio usage
- Document error handling approaches
- Show trait implementations and polymorphism
- Explain generic type usage
4. Example Generation
- Create working code examples for public APIs
- Show error handling patterns
- Demonstrate async operations
- Include edge cases and common pitfalls
TypeScript Capabilities
1. Component Documentation
- Extract component props with types and defaults
- Document component behavior and event handlers
- Generate prop combinations and variants
- Create Storybook stories
- Show component composition patterns
2. Hook Documentation
- Document hook parameters and return values
- Show hook composition patterns
- Explain dependency arrays
- Include usage examples
- Identify potential performance issues
3. Type Documentation
- Extract and document all exported types and interfaces
- Show generic type parameters
- Document utility type usage
- Create type hierarchy diagrams
- Show API request/response types
4. Architecture Documentation
- Generate data flow diagrams
- Document state management patterns
- Show API integration patterns
- Identify dependency trees
- Document component hierarchies
Workflow
When you invoke this skill, the AI assistant will:
- Discovery Phase: Scan the codebase to find files and understand structure
- Analysis Phase: Parse code to extract types, functions, patterns, and relationships
- Understanding Phase: Identify design patterns, architectural decisions, and key concepts
- Generation Phase: Create comprehensive documentation in your chosen format
- Validation Phase: Verify examples compile and documentation is complete
Output formats
Markdown Documentation
- Module-level README files
- API reference documentation
- Architecture documentation
- Migration guides
- Best practices guides
Inline Documentation
- Rust doc comments (/// and //!)
- TypeScript JSDoc comments
- Follow language conventions
- Include examples and sections
Diagrams
- Trait relationship diagrams (Mermaid)
- Component hierarchy diagrams
- Data flow diagrams
- Module dependency graphs
Storybook Stories (TypeScript)
- Component prop variations
- Interactive examples
- Usage patterns
- Edge cases
Configuration options
Customize documentation generation:
# Scope of documentation
scope: "public" # or "all" for private items too
# Output format
format: "markdown" # or "inline" or "both"
# Include sections
include_examples: true
include_tests: true # Rust only
include_diagrams: true
include_stories: true # TypeScript only
# Documentation depth
depth: "comprehensive" # or "brief" or "detailed"
# Target audience
audience: "developers" # or "maintainers" or "contributors"
Best practices
Rust Documentation
- ✅ Document all public APIs
- ✅ Include working code examples that compile
- ✅ Show error cases and how to handle them
- ✅ Explain generic type parameters and constraints
- ✅ Document async/await usage and tokio requirements
- ✅ Cross-reference related types and traits
TypeScript Documentation
- ✅ Document all component props with types
- ✅ Show component prop variations
- ✅ Explain hook return values and side effects
- ✅ Document data flow and state management
- ✅ Include usage examples with actual code
- ✅ Document performance considerations
EdgeQuake-specific patterns
Rust
- Multi-crate Workspace:
edgequake-core, edgequake-storage, edgequake-llm, edgequake-api
- Trait Abstraction:
GraphStorage, LLMProvider, StorageAdapter traits
- Error Handling: Custom
StorageError, PipelineError types
- Async Pipeline: Document the entity extraction and graph building pipeline
- Entity Normalization: Special naming conventions (e.g., "SARAH_CHEN")
TypeScript
- Next.js 15 App Router: Document pages, layouts, and API routes
- shadcn/ui Components: Document UI component composition
- Data Fetching: SWR hooks and API integration patterns
- Form Handling: react-hook-form patterns
- State Management: Workspace, query, and document state patterns
- Streaming: SSE and streaming response handling
Examples
Rust Example
Generate comprehensive documentation for the edgequake-storage crate including:
- All trait definitions and implementations
- Storage backend comparison (Memory vs PostgreSQL)
- Error handling patterns
- Async operation patterns
- Integration tests
- Architecture diagram showing trait relationships
TypeScript Example
Generate documentation for the edgequake_webui components including:
- All React components with props
- Custom hooks in src/hooks
- API integration types
- Component composition examples
- Storybook stories for all components
- Data flow diagram
Troubleshooting
Documentation not generating
- ✓ Ensure files are accessible and readable
- ✓ Check file permissions
- ✓ Verify syntax is valid
Examples don't compile (Rust)
- ✓ Test examples before including them
- ✓ Ensure all imports are present
- ✓ Verify types are correct and in scope
Missing documentation
- ✓ Check if items are public/exported
- ✓ Verify exports are in correct module
- ✓ Ensure items are accessible from public API
Related skills
- makefile-dev-workflow: Development workflow commands
- playwright-ux-ui-capture: UI screenshot capture automation
- ux-ui-analyze-single-page: Single page UX analysis
See also
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: reverse-documentation3description: Automatically generate comprehensive documentation for Rust and TypeScript codebases by analyzing code structure, patterns, and relationships. Supports trait-based patterns, async operations, React components, and Next.js applications. Use when this capability is needed.4---56# Reverse Documentation Skill78Automatically generate comprehensive documentation for Rust and TypeScript codebases by analyzing existing code structure, patterns, and relationships.910## When to use1112Use this skill when you need to:1314- Generate comprehensive API documentation for Rust crates15- Document React components and custom hooks16- Create architecture documentation from code analysis17- Generate migration guides for API changes18- Create README and implementation guides19- Document design patterns and relationships20- Build code examples and tutorials21- Cross-reference related functionality2223## Core concepts2425### Rust Documentation2627This skill understands and documents:2829- **Module Organization**: Workspace structure, crate dependencies, feature flags30- **Types & Traits**: Struct, enum, and trait definitions with full type signatures31- **Error Handling**: Result types, custom error types, error propagation patterns32- **Async Patterns**: Tokio-based async functions, futures, task spawning33- **Generic Types**: Type parameters, bounds, and lifetime annotations34- **Implementation Details**: Methods, associated functions, trait implementations35- **Testing**: Unit tests, integration tests, documentation examples3637### TypeScript Documentation3839This skill understands and documents:4041- **Module Structure**: Exports, re-exports, and module dependencies42- **Type Definitions**: Interfaces, types, generics, and utility types43- **React Components**: Functional components, props, state, lifecycle44- **Custom Hooks**: Hook composition, state management, side effects45- **API Integration**: Data fetching, request/response types, error handling46- **State Patterns**: useState, useReducer, Context API, state management libraries47- **Next.js Patterns**: Pages, layouts, API routes, middleware, server components4849## Quick start5051### For Rust codebases5253```54Generate comprehensive documentation for the [crate-name] crate55```5657```58Document the trait-based storage abstraction in edgequake-storage59```6061```62Create API documentation for all public interfaces with examples63```6465### For TypeScript codebases6667```68Generate documentation for all React components in src/components69```7071```72Document the custom hooks in src/hooks with usage examples73```7475```76Create type documentation for the API integration layer77```7879## Capabilities8081### Rust Capabilities8283#### 1. Crate Documentation84- Analyze Cargo.toml and workspace structure85- Extract and document all public types, traits, and functions86- Generate comprehensive README files87- Create architecture diagrams of trait relationships88- Document feature flags and optional dependencies8990#### 2. API Reference Generation91- Extract function signatures with parameters and return types92- Document error types and handling patterns93- Include working code examples94- Show generic type usage95- Cross-reference related types9697#### 3. Pattern Documentation98- Identify and document design patterns (Builder, Factory, Strategy, etc.)99- Explain async/await patterns and tokio usage100- Document error handling approaches101- Show trait implementations and polymorphism102- Explain generic type usage103104#### 4. Example Generation105- Create working code examples for public APIs106- Show error handling patterns107- Demonstrate async operations108- Include edge cases and common pitfalls109110### TypeScript Capabilities111112#### 1. Component Documentation113- Extract component props with types and defaults114- Document component behavior and event handlers115- Generate prop combinations and variants116- Create Storybook stories117- Show component composition patterns118119#### 2. Hook Documentation120- Document hook parameters and return values121- Show hook composition patterns122- Explain dependency arrays123- Include usage examples124- Identify potential performance issues125126#### 3. Type Documentation127- Extract and document all exported types and interfaces128- Show generic type parameters129- Document utility type usage130- Create type hierarchy diagrams131- Show API request/response types132133#### 4. Architecture Documentation134- Generate data flow diagrams135- Document state management patterns136- Show API integration patterns137- Identify dependency trees138- Document component hierarchies139140## Workflow141142When you invoke this skill, the AI assistant will:1431441. **Discovery Phase**: Scan the codebase to find files and understand structure1452. **Analysis Phase**: Parse code to extract types, functions, patterns, and relationships1463. **Understanding Phase**: Identify design patterns, architectural decisions, and key concepts1474. **Generation Phase**: Create comprehensive documentation in your chosen format1485. **Validation Phase**: Verify examples compile and documentation is complete149150## Output formats151152### Markdown Documentation153- Module-level README files154- API reference documentation155- Architecture documentation156- Migration guides157- Best practices guides158159### Inline Documentation160- Rust doc comments (/// and //!)161- TypeScript JSDoc comments162- Follow language conventions163- Include examples and sections164165### Diagrams166- Trait relationship diagrams (Mermaid)167- Component hierarchy diagrams168- Data flow diagrams169- Module dependency graphs170171### Storybook Stories (TypeScript)172- Component prop variations173- Interactive examples174- Usage patterns175- Edge cases176177## Configuration options178179Customize documentation generation:180181```yaml182# Scope of documentation183scope: "public" # or "all" for private items too184185# Output format186format: "markdown" # or "inline" or "both"187188# Include sections189include_examples: true190include_tests: true # Rust only191include_diagrams: true192include_stories: true # TypeScript only193194# Documentation depth195depth: "comprehensive" # or "brief" or "detailed"196197# Target audience198audience: "developers" # or "maintainers" or "contributors"199```200201## Best practices202203### Rust Documentation204205- ✅ Document all public APIs206- ✅ Include working code examples that compile207- ✅ Show error cases and how to handle them208- ✅ Explain generic type parameters and constraints209- ✅ Document async/await usage and tokio requirements210- ✅ Cross-reference related types and traits211212### TypeScript Documentation213214- ✅ Document all component props with types215- ✅ Show component prop variations216- ✅ Explain hook return values and side effects217- ✅ Document data flow and state management218- ✅ Include usage examples with actual code219- ✅ Document performance considerations220221## EdgeQuake-specific patterns222223### Rust224225- **Multi-crate Workspace**: `edgequake-core`, `edgequake-storage`, `edgequake-llm`, `edgequake-api`226- **Trait Abstraction**: `GraphStorage`, `LLMProvider`, `StorageAdapter` traits227- **Error Handling**: Custom `StorageError`, `PipelineError` types228- **Async Pipeline**: Document the entity extraction and graph building pipeline229- **Entity Normalization**: Special naming conventions (e.g., "SARAH_CHEN")230231### TypeScript232233- **Next.js 15 App Router**: Document pages, layouts, and API routes234- **shadcn/ui Components**: Document UI component composition235- **Data Fetching**: SWR hooks and API integration patterns236- **Form Handling**: react-hook-form patterns237- **State Management**: Workspace, query, and document state patterns238- **Streaming**: SSE and streaming response handling239240## Examples241242### Rust Example243244```245Generate comprehensive documentation for the edgequake-storage crate including:246- All trait definitions and implementations247- Storage backend comparison (Memory vs PostgreSQL)248- Error handling patterns249- Async operation patterns250- Integration tests251- Architecture diagram showing trait relationships252```253254### TypeScript Example255256```257Generate documentation for the edgequake_webui components including:258- All React components with props259- Custom hooks in src/hooks260- API integration types261- Component composition examples262- Storybook stories for all components263- Data flow diagram264```265266## Troubleshooting267268### Documentation not generating269270- ✓ Ensure files are accessible and readable271- ✓ Check file permissions272- ✓ Verify syntax is valid273274### Examples don't compile (Rust)275276- ✓ Test examples before including them277- ✓ Ensure all imports are present278- ✓ Verify types are correct and in scope279280### Missing documentation281282- ✓ Check if items are public/exported283- ✓ Verify exports are in correct module284- ✓ Ensure items are accessible from public API285286## Related skills287288- **makefile-dev-workflow**: Development workflow commands289- **playwright-ux-ui-capture**: UI screenshot capture automation290- **ux-ui-analyze-single-page**: Single page UX analysis291292## See also293294- [Rust Book - Documentation](https://doc.rust-lang.org/book/ch14-04-installing-binaries.html#distributing-binaries-with-cargo-install)295- [TypeScript Documentation](https://www.typescriptlang.org/docs/)296- [React Documentation](https://react.dev/)297- [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/)298299---300> Converted and distributed by [TomeVault](https://tomevault.io/claim/raphaelmansuy) — claim your Tome and manage your conversions.301<!-- tomevault:4.0:skill_md:2026-04-11 -->