When working with OpenHands AI software developer, it's crucial to provide clear and effective prompts. This guide outlines best practices for creating prompts that will yield the most accurate and useful responses.
Good prompts are:
"Add a function calculate_average in utils/math_operations.py that takes a list of numbers as input and returns their average."
"Fix the TypeError in frontend/src/components/UserProfile.tsx occurring on line 42. The error suggests we're trying to access a property of undefined."
"Implement input validation for the email field in the registration form. Update frontend/src/components/RegistrationForm.tsx to check if the email is in a valid format before submission."
"Make the code better." (Too vague, not concrete)
"Rewrite the entire backend to use a different framework." (Not appropriately scoped)
"There's a bug somewhere in the user authentication. Can you find and fix it?" (Lacks specificity and location information)
Remember, the more precise and informative your prompt is, the better the AI can assist you in developing or modifying the OpenHands software.
See Getting Started with OpenHands for more examples of helpful prompts.
OpenHands can be customized to work more effectively with specific repositories by providing repository-specific context and guidelines. This section explains how to optimize OpenHands for your project.
You can customize OpenHands' behavior for your repository by creating a .openhands_instructions file in your repository's root directory. This file should contain:
Example .openhands_instructions file:
Repository: MyProject
Description: A web application for task management
Directory Structure:
- src/: Main application code
- tests/: Test files
- docs/: Documentation
Setup:
- Run `npm install` to install dependencies
- Use `npm run dev` for development
- Run `npm test` for testing
Guidelines:
- Follow ESLint configuration
- Write tests for all new features
- Use TypeScript for new code
When working with a customized repository:
Example customized prompt:
Add a new task completion feature to src/components/TaskList.tsx following our existing component patterns.
Include unit tests in tests/components/ and update the documentation in docs/features/.
The component should use our shared styling from src/styles/components.
.openhands_instructions file as your project evolvesBy customizing OpenHands for your repository, you'll get more accurate and consistent results that align with your project's standards and requirements.