Specific guidance on using tools effectively for comprehensive documentation extraction,
with emphasis on gathering complete information across all aspects of a feature.
codebase_search
Initial discovery of feature-related code
Finding feature entry points
authentication login user session JWT token
]]>
Locating business logic
calculate pricing discount tax invoice billing
]]>
Finding configuration
config settings environment variables .env process.env
]]>
list_code_definition_names
Understanding code structure and organization
Use on directories containing core feature logic
Analyze both implementation and test directories
Look for patterns in naming conventions
src/features/authentication
]]>
read_file
Deep analysis of specific implementations
Read main feature files first
Follow imports to understand dependencies
Read test files to understand expected behavior
Examine configuration and type definition files
src/controllers/auth.controller.ts
src/services/auth.service.ts
src/models/user.model.ts
src/types/auth.types.ts
src/__tests__/auth.test.ts
]]>
search_files
Finding specific patterns and implementations
Find all API endpoints
src
@(Get|Post|Put|Delete|Patch)\(['"]([^'"]+)['"]|router\.(get|post|put|delete|patch)\(['"]([^'"]+)['"]
]]>
Find error handling patterns
src
throw new \w+Error|catch \(|\.catch\(|try \{
]]>
Find configuration usage
src
process\.env\.\w+|config\.get\(['"]([^'"]+)['"]|getConfig\(\)
]]>
Create the final documentation file when generating new documentation from scratch.
This tool is NOT used when reviewing a user-provided document section. In that scenario, feedback is provided directly in the chat.
DOCS-TEMP-[feature-name].md
Use descriptive feature names in filename
Include table of contents with anchors
Use consistent markdown formatting
Include code examples with syntax highlighting
DOCS-TEMP-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 requirements when multiple interpretations exist
Multiple features with similar names exist
Documentation depth needs clarification
Target audience priorities need definition
Which aspects of the authentication system should I focus on?
Complete authentication flow including JWT tokens, session management, and OAuth integration
Only the JWT token implementation and validation
OAuth2 integration with external providers
Password reset and account recovery workflows
]]>
What level of technical detail should the documentation include?
High-level overview suitable for all audiences
Detailed technical implementation for developers
API reference with code examples
Complete coverage for all audience types
]]>
Systematic approach to finding all files related to a feature
Start with semantic search
feature implementation main logic core functionality
]]>
List directory structure
src/features
true
]]>
Find related tests
src
describe\(['"].*Feature.*['"]|test\(['"].*feature.*['"]
*.test.ts
]]>
Locate configuration files
.
feature.*config|settings.*feature
*.json
]]>
Follow import chains to understand all dependencies
Read main feature file
Extract all imports
Read each imported file
Recursively analyze their imports
Build dependency graph
src/feature
import\s+(?:{[^}]+}|\*\s+as\s+\w+|\w+)\s+from\s+['"]([^'"]+)['"]
src/feature
require\(['"]([^'"]+)['"]\)
]]>
Extract complete API documentation from code
Route definitions
Request/response schemas
Authentication requirements
Rate limiting rules
Error responses
Find all route files
Extract route definitions
Find associated controllers
Analyze request validation
Document response formats
Use tests to understand expected behavior
Tests show real usage examples
Test descriptions explain functionality
Edge cases are often tested
Expected outputs are documented
__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 easy navigation
- Clear hierarchy with numbered sections
- Consistent heading levels
- Table of contents with links
- Cross-references between sections
Include relevant code examples
- Use syntax highlighting
- Show both request and response
- Include error cases
- Provide language-specific examples
Suggest where diagrams would help
- Architecture diagrams
- Sequence diagrams
- Data flow diagrams
- State machines
Always include important metadata
- Version compatibility
- Last updated date
- Feature status (stable/beta/deprecated)
- Performance characteristics
- Security considerations