Guidance on using tools for documentation extraction.
Use the most appropriate tools for the situation
Start with what you know - file names, directory structure, or keywords
Use multiple discovery methods to build understanding
Adapt your approach based on the codebase structure
Explore directory structure and find relevant files
- Starting exploration of a feature area
- Understanding project organization
- Finding configuration or test files
Examine specific files in detail
- Analyzing implementation details
- Understanding configuration
- Reading documentation or comments
Read multiple related files together for better context
Find specific patterns or text
- Locating API endpoints
- Finding configuration usage
- Tracking down error handling
- Discovering cross-references
Get overview of code structure
- Understanding module organization
- Identifying main components
- Finding test coverage
Semantic search when available
- Finding conceptually related code
- Discovering implementations by functionality
- When keyword search isn't sufficient
Optional - use when semantic understanding is needed
Start from high-level structure and drill down
List files in feature directory
Identify main entry points
Follow imports and dependencies
Examine implementation details
Use tests to understand expected behavior
Find test files for the feature
Read test descriptions and scenarios
Trace back to implementation
Verify behavior matches tests
Start with configuration to understand setup
Find configuration files
Identify feature flags and settings
Trace usage in code
Document impacts of each setting
Map external interfaces first
Search for route definitions
Find API controllers or handlers
Trace to business logic
Document request/response flow
Create extraction or verification report files.
Generates reports for documentation teams, not final documentation.
- For extraction: EXTRACTION-[feature-name].md
- For verification: VERIFICATION-[feature-name].md
Use descriptive feature name in filename.
Include table of contents.
Use consistent Markdown formatting.
Include syntax-highlighted code examples.
EXTRACTION-authentication-system.md
# Authentication System Documentation
## Table of Contents
1. [Overview](#overview)
2. [Architecture](#architecture)
...
## Overview
The authentication system provides secure user authentication using JWT tokens...
...
]]>
Clarify ambiguous requirements.
Multiple features have similar names.
Documentation depth is unclear.
Audience priorities are undefined.
Which authentication aspects should be the focus?
The complete flow (JWT, sessions, OAuth).
Only JWT implementation and validation.
Only OAuth2 integration.
Password reset and recovery workflows.
]]>
What level of technical detail is needed?
High-level overview for all audiences.
Detailed developer implementation.
API reference with code examples.
Full coverage for all audiences.
]]>
Find all files related to a feature using various methods.
Start by exploring likely directories
src
false
src/features/[feature-name]
true
]]>
Search for feature-related patterns
src
feature-name|FeatureName
src
describe\(['"].*Feature.*['"]|test\(['"].*feature.*['"]
*.test.ts
]]>
Find configuration files
config
true
.
feature.*config|settings.*feature
*.json
]]>
Use semantic search if available and helpful
feature implementation main logic
]]>
This is optional - use when other methods aren't sufficient
Follow import chains to map dependencies.
Read main file.
Extract all imports.
Read each imported file.
Recursively analyze imports.
Build dependency graph.
src/feature
import\s+(?:{[^}]+}|\*\s+as\s+\w+|\w+)\s+from\s+['"]([^'"]+)['"]
src/feature
require\(['"]([^'"]+)['"]\)
]]>
Extract API documentation from code.
Route definitions, request/response schemas, auth requirements, rate limiting, error responses.
Find route files.
Extract route definitions.
Find controllers.
Analyze request validation.
Document response formats.
Use tests to document expected behavior.
Tests provide usage examples.
Test descriptions explain functionality.
Tests cover edge cases.
Tests document expected outputs.
__tests__
(describe|it|test)\(['"]([^'"]+)['"]
__tests__/feature.test.ts
]]>
.env.example
config/*.json
src/config/*
README.md (configuration section)
Custom error classes
Error code constants
Error message templates
HTTP status codes
src
class\s+\w*Error\s+extends|new Error\(|throw new|ERROR_CODE|HTTP_STATUS
]]>
Authentication methods
Authorization rules
Data encryption
Input validation
Rate limiting
src
@Authorized|requireAuth|checkPermission|encrypt|decrypt|sanitize|validate|rateLimit
]]>
Organize output for navigation.
- Clear hierarchy, consistent headings, ToC with links, cross-references.
Include relevant code examples.
- Use syntax highlighting, show request/response, include error cases.
Suggest diagrams where helpful.
- Architecture, sequence, data flow, state machine diagrams.
Include important metadata.
- Version compatibility, last updated, status, performance, security.