Custom Experts
Experts enable HAI Build Code Generator to deliver context-aware code generation tailored to specific technologies, frameworks, or domains. Create custom experts to encode your team’s best practices, coding standards, and institutional knowledge.Overview
Experts provide:- Domain-specific guidelines: Tailored coding standards and best practices
- Reference documentation: Up to 3 external documentation links
- Context injection: Automatically loaded when relevant to the task
- Reusable knowledge: Shared across team members
Built-in Experts
HAI Build includes four ready-to-use experts:- .NET: C# and .NET ecosystem best practices
- Terraform: Infrastructure as Code guidelines
- Node.js: JavaScript/TypeScript development standards
- Go: Golang idioms and patterns
Custom Expert Structure
Custom experts are stored in the.hai-experts folder:
metadata.json
Contains expert configuration:name(required): Expert display namecreatedAt(required): ISO timestampdocumentLinks(optional): Array of up to 3 URLs
prompt.md
Contains the expert’s guidelines (required):State Management
- Use useState for local component state
- Use useContext for shared state across few components
- Use Redux Toolkit or Zustand for complex global state
- Avoid prop drilling - use composition or context
Testing
- Write tests using React Testing Library
- Focus on user behavior, not implementation details
- Aim for > 80% coverage
- Test accessibility with jest-axe
Accessibility
- Use semantic HTML elements
- Include ARIA labels where needed
- Ensure keyboard navigation works
- Test with screen readers
Creating a Custom Expert
Via VS Code Extension
- Open the HAI Build sidebar
- Navigate to the Experts section
- Click “Create New Expert”
- Fill in the required fields:
- Name: Expert display name (e.g., “FastAPI Best Practices”)
- Guidelines: Detailed coding standards and examples
- Document Links (optional): Up to 3 reference URLs
- Click “Create”
- Creates the folder structure in
.hai-experts - Generates
metadata.jsonandprompt.md - Processes document links (if provided)
- Syncs the expert across workspace
Manual Creation
- Create expert folder:
- Create
metadata.json:
- Create
prompt.md:
Content Guidelines
- Be Specific: Provide concrete examples, not abstract advice
- Show Code: Include real code snippets demonstrating patterns
- Explain Why: Don’t just say what to do, explain the reasoning
- Cover Edge Cases: Address common pitfalls and edge cases
- Keep Updated: Review and update guidelines as frameworks evolve
Effective Examples
Good Example:Reference Documentation
Adding Document Links
Provide up to 3 URLs to external documentation:Best Link Types
- Official Documentation: Framework guides and API references
- Style Guides: Community-accepted coding standards
- Best Practices: Curated resources and patterns
Processing Behavior
When links are provided:- HAI crawls each URL (up to 3 levels deep)
- Extracts and converts content to markdown
- Stores in
docs/folder - Updates
status.jsonwith progress
Using Custom Experts
Automatic Context Loading
HAI automatically loads expert context when:- Files match the expert’s domain (e.g.,
.tsxfiles for React expert) - Task description mentions relevant keywords
- Explicitly requested by the user
Manual Selection
Select an expert explicitly in the HAI interface:- Open HAI Build sidebar
- Start a new task
- Click “Select Expert”
- Choose from available experts
Example Workflow
Managing Experts
Updating Experts
Edit expert files directly:Deleting Experts
Remove the expert folder:- Navigate to Experts section
- Click delete icon on the expert
- Confirm deletion
Sharing Experts
Commit.hai-experts to version control:
Advanced Use Cases
Multi-Framework Experts
Create experts for full-stack scenarios:Team-Specific Standards
Encode institutional knowledge:Deployment
Follow company CI/CD patterns:- Use
.company.yamlfor configuration - Run
npm run build:prodbefore deploy - Tag releases with semantic versioning
Security
- Use company SSO library for authentication
- Encrypt sensitive data with @company/crypto
- Log all security events to audit trail
New Root API
Before:Views
Use class-based views for CRUD operations:- Validate JSON syntax:
- Restart HAI Build extension
Document Processing Failed
Checkstatus.json for errors:
- Delete
docs/folder - HAI will re-process on next usage
Next Steps
CLI Usage
Use HAI from the command line
COR-Matrix
Track AI code retention patterns