Vibe Coding - Using Copilot



Copilot is a genearative AI agent developed and maintained by Microsoft actively. It is very useful im vibe coding as it acts as pair programmer. It can provide code suggestions in realtime, can genearate code snippet based on natural language conversations. It can even write documentation and unit test cases. Copilot can be directly integrated with Visual Studio Code as well as in Visual Studio IDE. Copilot is also known Github Copilot.

Key Featues of Copilot

  • Code Generation − Copilot can genearate code based on natural language conversations. It can even complete the code, provide suggestions, can generate multi-file featuers based on existing code features.

  • Debugging − You can paste error blocks directly in Copilot chat window to ask for fix for logical errors. You can ask for security issues or performance improvements in the code.

  • Code Comments, Documentation − Copilot can analyze existing code and generate corresponding explanations which helps greatly in understanding new code bases. Copilot can generate documentations automatically.

  • Unit Testing − Copilot can genearate unit test cases and can conduct tests for developers improving test coverage and overall code quality.

  • Code Review − Copilot agent can be trained easily with custom code standard and practices and then it can review the code bases so that code adheres to project standards. It can provide suggestions/ feedbacks on the code without modifying it after code review.

Installing Copilot

GitHub Copilot is to be enabled as an extension in the IDE.

  • Take a Subscription − Copilot comes in various subscriptions ranging from free to pro+ versions. Visit https://github.com/features/copilot/plans for more details.

  • Install Compatible IDE − Download and Install Visual Studio Code or Visual Studio or any other IDE supporting Github Copilot.

  • Install and Enable Extension − Search, install and enable the copilot as extension.

  • Sign-in and Start Vibe Coding − Sign-in to the copilot and start vibe coding having Copilot as your pair programmer.

Best Practices

GitHub Copilot should be used as Code Assist AI. Following are the best practices to be used while using Github Copilot.

  • Always review generated code − Never promote the geneated code to the production before reviewing and understanding code. As a developer, you should own the code and understand it fully so that later if changes are to be made, you can maintain it easily. Have an eye for security issues as well.

  • Avoid ambigous prompt − Prompts should be clear and specific to generate a clean code. The more specific the prompt, better the generated code will be. Always state the goal clearly to set the context.

  • Use AI as a tool, not as replacement − Copilot should be treated as a learning partner instead of a programmer. It is always preferred to understand the AI generated code oneself.

  • Custom Instructions − Create copilot-instructions.md file to configure project specific coding standards, practices to get more aligned, relevant code suggestions. This way we can train copilot as per custom needs.

Advertisements