Refactor documentation standards and structure; consolidate clean code principles and service documentation requirements
This commit is contained in:
195
AGENTS.md
195
AGENTS.md
@@ -3,163 +3,68 @@
|
||||
## Project Overview
|
||||
LabFusion is a unified dashboard and integration hub for homelab services, built with a polyglot microservices architecture using Java Spring Boot, Python FastAPI, Node.js Express, and React.
|
||||
|
||||
## Documentation References
|
||||
- **Main README**: @README.md
|
||||
- **Project Structure**: @docs/structure.txt
|
||||
- **Progress Tracking**: @docs/progress.md
|
||||
- **Clean Code Guide**: @CLEAN_CODE.md
|
||||
|
||||
## Service Documentation
|
||||
Each service has comprehensive documentation:
|
||||
- **API Gateway**: @services/api-gateway/README.md and @services/api-gateway/CLEAN_CODE.md
|
||||
- **Service Adapters**: @services/service-adapters/README.md and @services/service-adapters/CLEAN_CODE.md
|
||||
- **API Docs**: @services/api-docs/README.md and @services/api-docs/CLEAN_CODE.md
|
||||
|
||||
## Frontend Documentation
|
||||
- **Frontend README**: @frontend/README.md
|
||||
- **Clean Code Guide**: @frontend/CLEAN_CODE.md
|
||||
- **Resilience Features**: @frontend/RESILIENCE.md
|
||||
|
||||
## Code Style
|
||||
|
||||
### Naming Conventions
|
||||
- **Java**: PascalCase for classes, camelCase for methods, UPPER_SNAKE_CASE for constants
|
||||
- **Python**: PascalCase for classes, snake_case for functions, UPPER_SNAKE_CASE for constants
|
||||
- **JavaScript/TypeScript**: PascalCase for classes, camelCase for functions, UPPER_SNAKE_CASE for constants
|
||||
|
||||
### Component Design
|
||||
- Single responsibility per component
|
||||
- Maximum 50 lines per component file
|
||||
- Props validation with PropTypes
|
||||
- Error boundary protection
|
||||
- Reusable and composable design
|
||||
Follow the naming conventions and standards defined in @CLEAN_CODE.md:
|
||||
- **Java**: PascalCase classes, camelCase methods, UPPER_SNAKE_CASE constants
|
||||
- **Python**: PascalCase classes, snake_case functions, UPPER_SNAKE_CASE constants
|
||||
- **JavaScript/TypeScript**: PascalCase classes, camelCase functions, UPPER_SNAKE_CASE constants
|
||||
|
||||
## Architecture
|
||||
Follow the architecture patterns detailed in each service's CLEAN_CODE.md:
|
||||
- **Service Structure**: Repository pattern, dependency injection, clear separation of concerns
|
||||
- **Frontend Structure**: Functional components, custom hooks, error boundaries, component composition
|
||||
|
||||
### Service Structure
|
||||
- Follow the repository pattern
|
||||
- Keep business logic in service layers
|
||||
- Use dependency injection
|
||||
- Implement proper error handling
|
||||
- Clear separation of concerns
|
||||
|
||||
### Frontend Structure
|
||||
- Use functional components in React
|
||||
- Implement custom hooks for state logic
|
||||
- Use error boundaries for error handling
|
||||
- Follow component composition patterns
|
||||
- Centralize constants and utilities
|
||||
|
||||
## Documentation Requirements
|
||||
|
||||
### README Files
|
||||
Every service MUST have a comprehensive README.md that includes:
|
||||
- Service overview and purpose
|
||||
- Architecture and key components
|
||||
- Features and capabilities
|
||||
- API endpoints with descriptions
|
||||
- Configuration and environment variables
|
||||
- Development setup and running instructions
|
||||
- Dependencies and versions
|
||||
- Reference to CLEAN_CODE.md
|
||||
|
||||
### Clean Code Documentation
|
||||
Every service MUST have a CLEAN_CODE.md that includes:
|
||||
- Architecture overview
|
||||
- Clean code principles applied
|
||||
- Code quality improvements
|
||||
- Best practices and guidelines
|
||||
- Performance optimizations
|
||||
- Testing strategies
|
||||
- Code review checklist
|
||||
- Future improvements
|
||||
|
||||
### Project Documentation
|
||||
- Update docs/structure.txt when adding files
|
||||
- Update docs/progress.md when completing tasks
|
||||
- Update service READMEs when modifying functionality
|
||||
- Update main README.md when adding features
|
||||
## Clean Code Principles
|
||||
Apply the SOLID principles detailed in @CLEAN_CODE.md:
|
||||
- Single Responsibility Principle
|
||||
- Open/Closed Principle
|
||||
- Dependency Inversion Principle
|
||||
- Interface Segregation Principle
|
||||
|
||||
## API Standards
|
||||
|
||||
### OpenAPI Documentation
|
||||
- All endpoints MUST have OpenAPI documentation
|
||||
- Include request/response schemas
|
||||
- Provide example requests and responses
|
||||
- Document error responses
|
||||
- Include authentication requirements
|
||||
|
||||
### Error Handling
|
||||
- Use consistent error response format
|
||||
- Implement proper HTTP status codes
|
||||
- Provide user-friendly error messages
|
||||
- Log errors for debugging
|
||||
|
||||
### Validation
|
||||
- Validate all inputs
|
||||
- Use appropriate data types
|
||||
- Implement rate limiting
|
||||
- Sanitize user data
|
||||
Follow the API standards defined in each service's documentation:
|
||||
- OpenAPI documentation for all endpoints
|
||||
- Consistent error response format
|
||||
- Proper HTTP status codes
|
||||
- Input validation and sanitization
|
||||
|
||||
## Testing
|
||||
|
||||
### Unit Tests
|
||||
- Test business logic
|
||||
- Test error conditions
|
||||
- Test edge cases
|
||||
- Maintain high coverage
|
||||
|
||||
### Integration Tests
|
||||
- Test API endpoints
|
||||
- Test service interactions
|
||||
- Test error scenarios
|
||||
- Test configuration
|
||||
|
||||
### End-to-End Tests
|
||||
- Test critical user flows
|
||||
- Test service integration
|
||||
- Test error recovery
|
||||
- Test performance
|
||||
Follow the testing strategies outlined in each service's CLEAN_CODE.md:
|
||||
- Unit tests for business logic
|
||||
- Integration tests for API endpoints
|
||||
- End-to-end tests for critical flows
|
||||
|
||||
## Quality Assurance
|
||||
|
||||
### Code Review Checklist
|
||||
- [ ] Naming conventions followed
|
||||
- [ ] Error handling implemented
|
||||
- [ ] Input validation present
|
||||
- [ ] Documentation updated
|
||||
- [ ] Tests written and passing
|
||||
- [ ] Clean code principles followed
|
||||
|
||||
### Documentation Review
|
||||
- [ ] README files comprehensive
|
||||
- [ ] Clean code documentation complete
|
||||
- [ ] Project structure updated
|
||||
- [ ] Progress tracking current
|
||||
- [ ] Links working and relevant
|
||||
Use the code review checklists from @CLEAN_CODE.md:
|
||||
- Naming conventions followed
|
||||
- Error handling implemented
|
||||
- Documentation updated
|
||||
- Tests written and passing
|
||||
- Clean code principles followed
|
||||
|
||||
## Performance
|
||||
|
||||
### Database Optimization
|
||||
- Use appropriate indexes
|
||||
- Implement connection pooling
|
||||
- Use lazy loading where appropriate
|
||||
- Optimize queries
|
||||
|
||||
### Caching
|
||||
- Implement appropriate caching
|
||||
- Use Redis for distributed caching
|
||||
- Cache frequently accessed data
|
||||
- Implement cache invalidation
|
||||
|
||||
### API Performance
|
||||
- Use pagination for large datasets
|
||||
- Implement response compression
|
||||
- Use appropriate HTTP methods
|
||||
- Optimize response sizes
|
||||
|
||||
## Security
|
||||
|
||||
### Input Validation
|
||||
- Validate all inputs
|
||||
- Sanitize user data
|
||||
- Use appropriate data types
|
||||
- Implement rate limiting
|
||||
|
||||
### Error Handling
|
||||
- Don't expose sensitive information
|
||||
- Log errors appropriately
|
||||
- Use consistent error responses
|
||||
- Implement proper status codes
|
||||
|
||||
### Authentication
|
||||
- Implement proper authentication
|
||||
- Use secure token handling
|
||||
- Implement authorization checks
|
||||
- Follow security best practices
|
||||
Follow the performance guidelines from @CLEAN_CODE.md:
|
||||
- Database optimization
|
||||
- Caching strategies
|
||||
- Resource management
|
||||
- API performance optimization
|
||||
|
||||
## When Working on This Project
|
||||
|
||||
|
||||
Reference in New Issue
Block a user