This document explains the documentation structure for React Hook Form AI, designed for easy LLM consumption and better developer experience.
The documentation has been restructured following the react-hook-form approach:
- Modular - Separate files for different topics
- LLM-Friendly - Structured for AI-assisted coding
- Comprehensive - Complete API coverage with examples
- Maintainable - Auto-generated from TSDoc comments
react-hook-form-ai/
├── README.md # Concise overview with links
├── docs/
│ ├── README.md # Documentation index
│ ├── API_REFERENCE.md # Complete API documentation
│ ├── PROVIDERS.md # Provider configuration guide
│ ├── EXAMPLES.md # Practical examples
│ └── logo.png # Logo image
├── src/
│ ├── useForm.ts # Enhanced with TSDoc
│ ├── AIFormProvider.tsx # Enhanced with TSDoc
│ ├── utils/useAIAssistant.ts # Enhanced with TSDoc
│ └── types/ai.ts # Enhanced with TSDoc
├── tsdoc.json # TSDoc configuration
├── tsdoc-markdown.config.js # API generator config
└── package.json # Added generate:api-reference script
Purpose: Quick overview and navigation hub
Content:
- Feature highlights
- Quick start example
- Links to detailed documentation
- API overview
- Browser compatibility table
Target Audience: New users, quick reference
Purpose: Onboarding guide for new users
Content:
- Installation instructions
- Basic usage examples
- Key concepts explanation
- Next steps
Target Audience: Developers new to the library
Purpose: Complete API documentation
Content:
- All hooks with signatures
- All components with props
- All interfaces and types
- Usage examples for each API
- Parameter descriptions
- Return value descriptions
Target Audience: Developers needing detailed API information, LLMs
Generation: Auto-generated from TSDoc comments via npm run generate:api-reference
Purpose: Detailed provider configuration guide
Content:
- Chrome Built-in AI setup
- OpenAI configuration
- Custom server setup
- Browser AI configuration
- Multi-provider setup
- Security best practices
Target Audience: Developers configuring AI providers
Purpose: Practical usage examples
Content:
- Multi-provider setup
- Field-level suggestions
- Chrome AI download handling
- Excluding sensitive fields
- Custom debounce timing
- Partial form autofill
- Context-aware suggestions
Target Audience: Developers implementing specific features
All public APIs now have comprehensive TSDoc comments:
/**
* Brief description of the function/interface.
*
* @public
* @remarks
* Detailed explanation of the API, its purpose, and behavior.
*
* @typeParam T - Description of type parameter
* @param paramName - Description of parameter
* @returns Description of return value
*
* @example Basic usage
* ```tsx
* // Example code
* ```
*
* @example Advanced usage
* ```tsx
* // More complex example
* ```
*/src/useForm.ts- useForm hook and related interfacessrc/AIFormProvider.tsx- AIFormProvider component and hookssrc/utils/useAIAssistant.ts- useAIAssistant hooksrc/types/ai.ts- All AI-related types
npm run generate:api-reference
# or
pnpm run generate:api-reference- Parses TSDoc comments from source files
- Generates markdown documentation
- Outputs to
docs/API_REFERENCE.md
- After adding new public APIs
- After updating TSDoc comments
- After changing function signatures
- Before releasing new versions
Each document covers a specific topic, making it easy for LLMs to:
- Find relevant information quickly
- Provide focused answers
- Reference specific sections
All documentation follows consistent patterns:
- Clear headings and subheadings
- Code examples with syntax highlighting
- Parameter descriptions
- Return value descriptions
Every API includes working examples that LLMs can:
- Reference for code generation
- Adapt to user needs
- Combine for complex scenarios
Documents link to related content:
- API Reference ↔ Examples
- Getting Started → Provider Configuration
- Browser Compatibility → Provider Configuration
-
Write Code with TSDoc comments
/** * New feature description * @example * ```tsx * // Usage example * ``` */ export function newFeature() { }
-
Generate API Docs
npm run generate:api-reference
-
Update Relevant Guides
- Add to EXAMPLES.md with practical examples
- Update PROVIDERS.md if it affects configuration
-
Update README.md
- Add to features list if significant
- Update quick start if relevant
- Update TSDoc in source files
- Regenerate API docs
- Update examples if behavior changed
- Update guides if configuration changed
- Always add TSDoc to public APIs
- Include examples in TSDoc comments
- Regenerate API docs before committing
- Test examples to ensure they work
- Update guides for significant changes
- Review TSDoc in pull requests
- Ensure examples work before merging
- Keep docs in sync with code
- Update version in documentation
- Announce breaking changes clearly
Documentation improvements are always welcome! Please:
- Open an issue for suggestions
- Submit PRs for corrections
- Share your use cases for better examples
Last Updated: November 2025 Maintained By: React Hook Form AI Team