Skip to content

iDrv5-MyFR8 Agent Prompt Library

This library provides curated prompts to ensure agents follow clean coding, UI standards, and error tracking when working on the iDrv5-MyFR8 logistics platform.

This library provides curated prompts to ensure agents follow clean coding, UI standards, and error tracking when working on the iDrv5-MyFR8 logistics platform.

When writing code for iDrv5-MyFR8:
1. Follow the module structure: modules/{module_name}/{routes.py, models.py, services.py}
2. Use snake_case for Python files and functions
3. Use PascalCase for class names
4. Organize imports: stdlib → third-party → local
5. Include docstrings for all public methods
6. Use type hints where possible
For error handling in iDrv5-MyFR8:
1. Use the centralized ErrorTracker from utils/error_tracker.py
2. Always provide context with errors
3. Log errors at appropriate levels (DEBUG, INFO, WARNING, ERROR, CRITICAL)
4. Use try-except blocks for database operations
5. Return meaningful error messages to users
6. Track module-specific errors for analytics
For database operations:
1. Use SQLAlchemy ORM consistently
2. Handle connection failures gracefully
3. Implement proper session management
4. Use pagination for large datasets
5. Always close database sessions
6. Include database health checks
For HTML templates in iDrv5-MyFR8:
1. Extend base templates: layout.html for main pages
2. Use Bootstrap 5 classes consistently
3. Include CSRF tokens in all forms
4. Use semantic HTML5 elements
5. Ensure responsive design principles
6. Include portal-specific styling
For UI components:
1. Create reusable components in templates/components/
2. Use consistent color scheme: primary (#007bff), success (#28a745)
3. Include loading states for async operations
4. Add proper error state displays
5. Ensure accessibility standards (ARIA labels)
6. Test on mobile and desktop viewports
For forms in iDrv5-MyFR8:
1. Use Flask-WTF for form validation
2. Include proper field validation
3. Display validation errors clearly
4. Use consistent form styling
5. Include success/error flash messages
6. Implement CSRF protection
When creating a new module:
1. Create directory structure: modules/{module_name}/
2. Include __init__.py with version and metadata
3. Define clear service interfaces
4. Document module dependencies
5. Create comprehensive tests
6. Update module registry
7. Add to config.py MODULE_DETAILS
For API endpoints:
1. Use RESTful conventions
2. Include proper HTTP status codes
3. Validate input data
4. Return consistent JSON structure
5. Include error handling
6. Add rate limiting where appropriate
7. Document with docstrings
For service classes:
1. Keep business logic in services, not routes
2. Use dependency injection patterns
3. Include proper error handling
4. Return consistent data structures
5. Add logging for important operations
6. Include unit tests
For performance optimization:
1. Use database query optimization
2. Implement appropriate caching
3. Minimize N+1 query problems
4. Use pagination for large datasets
5. Optimize template rendering
6. Monitor database connection pools
For monitoring and analytics:
1. Add metrics collection points
2. Track user interactions
3. Monitor system health
4. Log performance metrics
5. Include error rate tracking
6. Set up alerting thresholds
For authentication features:
1. Use Flask-Login consistently
2. Hash passwords with Werkzeug
3. Implement session management
4. Add CSRF protection
5. Validate user permissions
6. Log authentication events
For data validation:
1. Validate all user inputs
2. Sanitize data before database storage
3. Use parameterized queries
4. Implement rate limiting
5. Add input length restrictions
6. Validate file uploads properly
For unit tests:
1. Test all public methods
2. Include edge cases
3. Mock external dependencies
4. Use descriptive test names
5. Aim for 80%+ code coverage
6. Test error conditions
For integration tests:
1. Test module interactions
2. Validate API endpoints
3. Test database operations
4. Check UI workflows
5. Test authentication flows
6. Validate error handling
For code documentation:
1. Include module-level docstrings
2. Document all public APIs
3. Provide usage examples
4. Document configuration options
5. Include troubleshooting guides
6. Keep documentation up-to-date
For API documentation:
1. Document all endpoints
2. Include request/response examples
3. Document error codes
4. Provide authentication details
5. Include rate limiting information
6. Add usage examples
For environment setup:
1. Use environment variables for secrets
2. Include configuration validation
3. Document required variables
4. Provide development defaults
5. Include health check endpoints
6. Add logging configuration
For production deployment:
1. Include proper error pages
2. Configure logging levels
3. Set up monitoring endpoints
4. Include database migrations
5. Configure static file serving
6. Add security headers
For code reviews:
1. Check for security vulnerabilities
2. Validate error handling
3. Review performance implications
4. Check code style consistency
5. Validate test coverage
6. Review documentation updates
For refactoring:
1. Maintain backward compatibility
2. Update all related tests
3. Document breaking changes
4. Update module dependencies
5. Validate performance impact
6. Update documentation

  1. Review this library before starting work
  2. Use prompts as checklists for development
  3. Ask questions when standards are unclear
  4. Contribute improvements to prompts
  1. Reference relevant prompts during reviews
  2. Ensure standards compliance
  3. Provide constructive feedback
  4. Update prompts based on review learnings
  1. Regular review and update of prompts
  2. Incorporate lessons learned
  3. Add new patterns as they emerge
  4. Remove outdated practices

Last Updated: $(date) Version: 1.0.0